[osg-users] Shadows from multiple light sources

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Tue Sep 16 06:02:07 PDT 2008


Hello Chris,

> Does anyone know if any of the OSG supported shadow techniques can allow 
> casting shadows from multiple light sources?
> If not, is anyone working on it? Or perhaps got some tips or code that 
> might help implement it?
> ... or even a laymans explanation of the foolhardyness of my question? ;-)

Your question is perfectly valid. Unfortunately the current shadow 
techniques only allow one light source to cast shadows.

Casting shadows from multiple light sources would require doing what is 
done in the cull() method in src/osgShadow/ShadowMap.cpp (in the case of 
ShadowMap) once per light source, and to be able to handle multiple 
light sources and multiple shadow maps in the shader as well.

Unfortunately, extending the code to be completely general would be a 
pretty big task (finding out how many light sources are in the scene, 
adapting the code to cast shadows for all of them). And even then, in 
some cases a light source might give only a minor contribution to the 
scene and you wouldn't want the added cost of an extra RTT for it to 
cast shadows, so you really need to have control over which light 
source(s) cast shadows.

Anyways, sorry I can't help more. It's an ongoing topic.

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/



More information about the osg-users mailing list