Hi Michael,

So I have been reworking to support the shadows. Does the tex gen coords get 
stored in the texture matrix? Am I wrong to assume I can still use the 
fixed-function tex gen coords with a shader?

Texture coordinate generation is done by the Vertex stage, so as soon as you start using a vertex shader you need to do tex coord generation for your shadow texture unit too. Check the vertex shaders in src/osgShadow/StandardShadowMap.cpp for guidance.

I noticed you said you replaced the OSG shader with your own. Do you happen to 
know what happens when you stop using an uber-shader to render everything in 
your scene. My scene has many shaders in the graph. To me it seems like some 
data might be getting overridden down the traversal of the scene.

If you use different shaders on different nodes, you need to do shadow texgen computation (vertex shader) and shadow application (fragment shader) in all of them. You can easily factor out those functions into small shader files that you will include everywhere you use your own shaders. That's what the shaders in StandardShadowMap.cpp do - the main shader declares a DynamicShadow() function and calls it, and the shadow shader defines that function. You can do the same, just write your own main shader, declaring the DynamicShadow() function and calling it, and include the same shadow shader (with the code of DynamicShadow()) in all of them.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to