[osg-users] Shadow Map

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Tue Sep 2 16:29:45 PDT 2008

Hello Cedric,

> With this solution an object that cast shadow will get it's own shadow 
> isn't it , i know in most of the case it's what
> you want but i would like to avoid when i can for performance reason.
> I would like something like a list a of caster and a list of receiver. 
> Maybe i could just write a shadowmap
> technic that allow that.

The osgShadow::ShadowMap technique has just not been designed to do 
that. You have the option of either:

1. Casts and receives : object is under ShadowedScene, and has the 
correct nodemasks

2. Does not cast but receives : object is under ShadowedScene, and has 
~CastsShadow nodemask

3. Does not cast, does not receive : object is not under ShadowedScene.

Doing anything more would require some changes. You can always subclass 
ShadowMap to do it, but as the class stands it's not very useful since 
you'll need to copy-paste most of it anyways because it was not really 
designed to be subclassed (all the work is done in the cull() method). I 
think the upcoming improvements by Wojtek will make this sort of thing 
much more doable.

But in any case, I don't really see why you don't want an object to 
self-shadow. In a shadow map technique, it does not involve any 
additional cost. If the object casts shadows on other objects, then it's 
already part of the ShadowMap RTT, and thus, where it casts its shadows 
has no effect on performance (at least as far as I know, perhaps I'll 
learn something new...).

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list