Discussion:
osgShadow question
Serge Lages
2009-06-24 16:31:36 UTC
Permalink
Hi all,

I am currently using osgShadow with the MinimalShadowMap technique. It works
great but I have a question :

- In my ShadowedScene, I set the children's nodemasks accordingly with the
CastsShadowTraversalMask and ReceivesShadowTraversalMask properties, but it
seems to not work, everything cast shadows on everything. Anyone knows if
there is a way to force an object to not receive the shadows ? Even with a
"dirty" method (reseting it's tex coords on the drawable or something like
that).

Thanks !
Best regards,
--
Serge Lages
http://www.tharsis-software.com
Wojciech Lewandowski
2009-06-24 20:36:17 UTC
Permalink
Serge,

I have no access to the code now. All techniques derived from osgShadow::ShadowMap share this limitation. If my memory serves me right they all ignore ReceivesShadowTraversalMask.
But many tricks or graph rearangments were discussed earlier. For example look at this thread: http://www.mail-archive.com/osg-users-***@public.gmane.org/msg16581.html If you look carefully you should be able to find more such posts. Unfortunately I cannot offer more help at this time.

Cheers,
Wojtek Lewandowski


From: Serge Lages
Sent: Wednesday, June 24, 2009 6:31 PM
To: OpenSceneGraph Users
Subject: [osg-users] osgShadow question


Hi all,

I am currently using osgShadow with the MinimalShadowMap technique. It works great but I have a question :

- In my ShadowedScene, I set the children's nodemasks accordingly with the CastsShadowTraversalMask and ReceivesShadowTraversalMask properties, but it seems to not work, everything cast shadows on everything. Anyone knows if there is a way to force an object to not receive the shadows ? Even with a "dirty" method (reseting it's tex coords on the drawable or something like that).

Thanks !
Best regards,
--
Serge Lages
http://www.tharsis-software.com



--------------------------------------------------------------------------------
Jean-Sébastien Guay
2009-06-25 02:28:45 UTC
Permalink
Hi Serge,
Post by Serge Lages
Anyone
knows if there is a way to force an object to not receive the shadows ?
Even with a "dirty" method (reseting it's tex coords on the drawable or
something like that).
Wojtek is right (of course, having implemented some of the ShadowMap
techniques in OSG, he would know), ReceivesShadowTraversalMask is
typically not used in ShadowMap techniques, as it would be a bit hard to
implement generally.

What we do is we have a uniform ShadowEnabled which if disabled skips
the shadow map lookup in the shadow map shader. For this to work you
have to replace your shadow technique's shader with one that will use
whatever uniform you set, and you need to set a uniform to false (and
make it default to true in your root ShadowedScene) instead of using the
ReceivesShadowTraversalMask.

So it's a bit inconvenient, you have two different ways of doing things
- CastsShadowTraversal mask to make something not cast shadows, and a
uniform to make it not receive shadows. Though it's kind of appropriate
if you think about it, the former is "do I use this object for shadows",
and the latter is "do I use the shadows on this object", so intuitively
the former is a node mask and the latter is a shader parameter for the
output.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay jean-sebastien.guay-***@public.gmane.org
http://www.cm-labs.com/
http://whitestar02.webhop.org/
Serge Lages
2009-06-25 08:51:48 UTC
Permalink
Thanks for your advices ! I've tested the uniform one by changing the shadow
technique shader and it works great.

Cheers,

On Thu, Jun 25, 2009 at 4:28 AM, Jean-Sébastien Guay <
Post by Jean-Sébastien Guay
Hi Serge,
Anyone knows if there is a way to force an object to not receive the
Post by Wojciech Lewandowski
shadows ? Even with a "dirty" method (reseting it's tex coords on the
drawable or something like that).
Wojtek is right (of course, having implemented some of the ShadowMap
techniques in OSG, he would know), ReceivesShadowTraversalMask is typically
not used in ShadowMap techniques, as it would be a bit hard to implement
generally.
What we do is we have a uniform ShadowEnabled which if disabled skips the
shadow map lookup in the shadow map shader. For this to work you have to
replace your shadow technique's shader with one that will use whatever
uniform you set, and you need to set a uniform to false (and make it default
to true in your root ShadowedScene) instead of using the
ReceivesShadowTraversalMask.
So it's a bit inconvenient, you have two different ways of doing things -
CastsShadowTraversal mask to make something not cast shadows, and a uniform
to make it not receive shadows. Though it's kind of appropriate if you think
about it, the former is "do I use this object for shadows", and the latter
is "do I use the shadows on this object", so intuitively the former is a
node mask and the latter is a shader parameter for the output.
Hope this helps,
J-S
--
______________________________________________________
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
Serge Lages
http://www.tharsis-software.com
Loading...