Hello Werner,

Actually I'd like to be more flexible in the use of the ShaderTechnic and I
ask myself if it is possible to use the standard ShadowTechnics and attach my
Shaders to my user scene child somehow.

There is no problem with this, we do it ourselves.

The only thing to be aware of is that anytime you have a shader on a child node somewhere in your graph, if you want it to have shadows then you need to use the same shadow mapping code as the ShadowTechnique's shaders. So it may be easier to do as the ViewDependentShadow classes do: separate the main shader and the shadow shader (for both stages, vertex and fragment), and just have some function in your code that when creating a new osg::Program, will add the user's shaders plus the shadow shaders. The user's shaders would just have to call the function(s) defined in the shadow shaders at the appropriate time.

Otherwise you can of course copy-paste the shadow shader code into your own shaders instead, but that is error-prone and if you decide you want to change something (like filter the shadows, or whatever) you have to change it in many places.

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