Hello all, I have a bit of a knotty problem and was hoping for some
advice.  I am using OSG 2.8.3.

I am using osgShadow::LightSpacePerspectiveShadowMapVB, which renders
the scene in two passes; the prerender stage renders the shadow map, the
main state renders the scene.  My understanding is that the behavior of
the two passes is controlled by setting different shader programs at the
scene root, which sets the default shader program for the whole scene.

However, I am also using shader programs at some of my leaf nodes.  I
would like it to accept shadows, so it needs to read the shadowTexture
uniform.  However, this uniform is only available on the main drawing
pass, not the prerender pass (since the purpose of the prerender pass is
to generate the shadow texture).  The problem I am encountering is the
fact that my shader program does not have a way to distinguish between
executing the prerender pass and the main pass, and attempts to read the
(non-existent) shadowTexture uniform in the prerender pass, which causes
a GL error and results in the node not showing up at all.

I know the solution is to use different shaders for different passes,
but I haven't figured out the right way to set up OSG to do this at the
leaf.  Can anyone point me in the right direction?

-- 
Peter Amstutz
Senior Software Engineer
Technology Solutions Experts
Natick, MA
02131

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to