Getting closer to having this working like I think it should, but I have
noticed something.

When I have one or two objects, say the size of a car, or truck, only.  The
shadow map looks correct. But when I add my terrain which is approximately x
= 5100 by y = 5100, I no longer see the car/truck shadows on the shadow map.

Similarly, if I increase the length and width of the bottom box in the
osgShadow example, I no longer see the other objects in the shadow map.

I assume I am running into some shadow map texture resolution limit or
something.  What is going on?

Tnanks,
W


-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
Jean-Sébastien Guay
Sent: Tuesday, November 10, 2009 3:08 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] ShadowMap problem...

Hi Wyatt,

> Just have to ask, if you try with only one object and a ground plane 
> (a really simple scene) do you get the same results?

I just tested, and your code seems to work. I've attached a source file
which is the osgshadow example, with the main() commented out and your code
in its place. Have a look, the only changes were to put the ModelThree scene
as child of your m_World group and to make sure I had a manipulator, and
make everything compile...

You seem to be using a skydome (based on a variable called SKYDOME_RANGE in
the code). You did set your skydome's node mask to ~cast right? 
Otherwise what you're seeing is probably your skydome's shadow being cast
over everything... That's one thing about using osgShadow, you need to make
sure things that you don't want to cast shadows don't have the cast shadow
bit in their node mask. Also HUDs should be set that way. 
Keep an iron grip on your node masks or you'll have unpleasant surprises...
:-)

The receive shadow node mask is not used for ShadowMap classes, but you can
implement a node that doesn't receive shadows by adding a case in your
shader (a test on a boolean uniform that skips the shadow test) and set that
uniform to true at your scene's root and false for each node that you don't
want to receive shadows.

And btw, osgShadow::ShadowMap is not really designed for positional lights,
because they're omnidirectional and would need 6 full-scene RTT passes (like
a cube map) to be totally accurate. I think (IIRC) osgShadow::ShadowMap and
the ViewDependentShadow classes try to approximate a directional in that
case, but the approximation breaks down if the light source is positioned
inside the bounding box of the scene... You're better off either
approximating the sun with a directional, or using a spot light for an
interior scene.

Hope this helps,

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

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to