My shadow map is looking mostly correct now after making changes to light
type, position etc.  However shadows are not appearing in the final
rendering.  The app I am trying to add shadow mapping to uses textures bound
to tex units 0-3.  I noticed in the ShadowMap class there were methods for
setting the texture unit and wondered if this possibly   why I am not seeing
the shadows.  That is, is my use of tex units 0-3 conflicting with
ShadowMaps use of texture units and should I reassign one or the others
texture units?

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