Hi,

I am drawing some quads on a virtual plane to simulate raindrops on a 
windshield. The drops are basically just alpha blended quads. The effect is 
placed in front of the camera. It works really well, but unfortunately all my 
rain drops are sometimes disappearing when I look into certain directions.

I use a really simple fragment shader:

Code:
gl_FragColor = v_color * texture2D(dropTexture, v_texCoord);


and I have discovered something interesting. If I just return the color (or a 
fixed hardcoded color) the drops are ALWAYS visible. The drops are also ALYWAYS 
visible when I use a hardcoded texcoord of vec2(0.5, 0.5). When I use a 
hardcoded texcoord of vec2(1,1) the drops are always INVISIBLE, because the 
alphavalue is 0 at the border of the texture.

This leads to the conclusion that something manipulates the texture coordinates 
of my quads.
I tried to turn off any possibly set texture coordinate matrix with these lines:

Code:
texMatrix = new osg::TexMat();
osg::Matrix m;
m.makeIdentity();
texMatrix->setMatrix( m );
ss->setTextureAttributeAndModes(0, texMatrix, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::OFF );
ss->setTextureAttributeAndModes(1, texMatrix, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::OFF );
ss->setTextureAttributeAndModes(2, texMatrix, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::OFF );
ss->setTextureAttributeAndModes(3, texMatrix, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::OFF );
ss->setTextureAttributeAndModes(4, texMatrix, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::OFF );
ss->setTextureAttributeAndModes(5, texMatrix, osg::StateAttribute::PROTECTED | 
osg::StateAttribute::OFF );


But unfortunately it did not change anything - my quads are still disappearing 
depending on the camera position and orientation.

Since I am very new to OSG I might have overseen something. Is there anything 
else that could transform my texture coordinates? If yes, how can I disable it?

Thank you!
Cheers,
flo[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35743#35743





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to