Hello, I can't give you a example code but a general concept. The most commonly used technique to create shadows nowadays is shadow mapping. The basic idea is to render in a depth buffer from the light source looking to the scene. The projection and model view matrix, that was used to generate this image, needs to be passed to the main render pass as-well. In the main render pass the vertex position is multiplied with the light projection and model view matrix to get the position of this vertex in the depth buffer. The only thing that needs to be done to create shadows is to compare the depth value stored in the depth buffer with the z-value of our vertex. If the stored value was bigger, there is no shadow, if the value was smaller, the fragment is shadowed.
To combine this technique with deferred shading is pretty simple. You can just create a post render pass with the position buffer from the deferred pipeline and the depth image as input. Instead of the vertex position you just need to use the position stored in the position buffer as input. Everything else stays the same. You can look in the osgShadow source code to see how you can set up the prerender camera and how the shader code should look like. Thank you! Cheers, Marcel ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56626#56626 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

