[osg-users] How to apply shadows to a scene with different shaders

Denis Nikolskiy nikolski at arsc.edu
Tue Jul 22 13:24:03 PDT 2008

Hi all,

Thanks to Jean-Sebastien for quick response about custom shaders with  
osg ShadowMap.

I’m trying to compute shadows in a scene and apply them to each  
object. Most of the objects have different shaders. I have to smuggle  
information about shadows into each object’s shader. The only way I  
can see how to do this is to compute shadows of the scene into  
texture and pass the texture to each shader. I thought that the  
easiest way would be to use osg ShadowMap. I tried modifying  
ShadowMap’s shaders. It worked but in that case one shader is applied  
to the whole scene. Is there a way to get Shadow texture from osg  
ShadowMap and pass it to another shader? Am I going in a right  
direction? Should I use osg ShadowMap to get shadow texture and pass  
it to different shaders or something else?

Thank you for your time,


More information about the osg-users mailing list