![]() |
|
|
|
#1
|
|||
|
|||
|
Still problems with texture replace or multi-texture
Any update on this?
I am also trying to apply a texture on another node that has a material pre-assigned in 3DS. No matter what image I use as a texture, only the color of the texture is applied and the actual texture is totally ignored. I am using again the "appearance" property with TEXREPLACE, but has no effect besides getting rid of the pre-exiting material. I include my attempt. It shouldn't be that hard, but it doesn't work as the multi-texture example in the documentation with the Worldviz logo. What am I missing here? Thanks. |
|
#2
|
|||
|
|||
|
For the first question, you could use a shader to multiply a blend value with the transparent texture and add that to the base texture. Here's an example:
Code:
import viz
viz.go()
viz.addChild('piazza.osgb')
quad = viz.addTexQuad(pos=[0,1.8,5])
texture = viz.addTexture('images/tile_grass.jpg')
texture2 = viz.addTexture('crosshair.png')
quad.texture(texture)
quad.texture(texture2,unit=1)
frag = """
uniform sampler2D map1;
uniform sampler2D map2;
uniform float blend;
void main()
{
vec4 clr1 = texture2D(map1,gl_TexCoord[0].st);
vec4 clr2 = texture2D(map2,gl_TexCoord[0].st);
gl_FragColor = clr1+clr2*blend;
}
"""
shader = viz.addShader(frag=frag)
shader.attach(viz.addUniformInt('map1',0))
shader.attach(viz.addUniformInt('map2',1))
blend = viz.addUniformFloat('blend',0.0)
shader.attach(blend)
quad.apply(shader)
slider = viz.addSlider(pos=(0.5,0.1,0))
slider.set(0)
import vizact
vizact.onslider(slider,blend.set)
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OSG Exporter - Texture seams somehow have alpha | JvdBosch | Vizard | 12 | 01-03-2013 04:02 PM |
| How to render a texture of the transparent object and then blur it | whj | Vizard | 1 | 09-25-2012 04:15 PM |
| Avatar texture swaping | sleiN13 | Vizard | 5 | 06-24-2011 01:48 AM |
| How to apply shader and render texture to an object | whj | Vizard | 0 | 04-23-2010 01:23 PM |
| Translating a texture and its Alpha | shivanangel | Vizard | 5 | 12-02-2008 05:52 PM |