Hi,

ShadowMap::cull invokes culls traversal for both main camera 
(ShadowReceiving) graph  & shadow camera (ShadowCasting) graphs. So if you 
block whole cull on ShadowMap level - it won't draw the scene as well. The 
trick is to block only the portion that culls ShadowCasting graph.

See the osgShadow::ShadowMap::cull method (src/ osgShadow / ShadowMap.cpp)

Line 330:  _shadowedScene->osg::Group::traverse(cv);
Thats the line where Scene traversal is invoked

&

Line 469 : _camera->accept(cv);
Thats the line which calls cull traversal on Shadow Map camera.


Cheers,
Wojtek Lewandowski


----- Original Message ----- 
From: "Jean-Sébastien Guay" <[EMAIL PROTECTED]>
To: "OpenSceneGraph Users" <osg-users@lists.openscenegraph.org>
Sent: Monday, February 11, 2008 4:20 PM
Subject: Re: [osg-users] osgShadow one shot shadow map


> Hello Sebastian,
>
>> I'm quite confused regarding the osgShadow implementation.
>> My scene and my light-positions are static. My idea was to capture the
>> shadow-map only once
>> and apply it consecutively in all frames. I'm a bit lost where to start.
>> Neither update nor cull seems to be the right place.
>> Any hints?
>
> As you have seen, it was not designed to do that. It's designed to
> recalculate the shadow map each frame. I guess you could add a boolean
> to it to say that it has been calculated, and then not redo it again...
> Maybe just something like:
>
> class myShadowMap : public osgShadow::ShadowMap
> {
>     public:
>         myShadowMap() : _done(false) {}
>
>         virtual void update(osg::NodeVisitor& nv)
>         {
>             if (!_done)
>                 osgShadow::ShadowMap::update(nv);
>         }
>
>         virtual void cull(osgUtil::CullVisitor& cv)
>         {
>             if (!_done)
>             {
>                 osgShadow::ShadowMap::cull(cv);
>                 _done = true;
>             }
>         }
>
>     private:
>         bool _done;
> };
>
> Note that I didn't try this, but it might give you something to start
> with? Let us know how it goes.
>
> Hope this helps,
>
> J-S
> -- 
> ______________________________________________________
> Jean-Sebastien Guay    [EMAIL PROTECTED]
>                                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
> 


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

Reply via email to