Hi Robert,
I'm having problems even allowing for a static light, so I don't need to
grab the updated position.
How do I add the PRE_RENDER [ to RTT ] Camera ? Adding a Group as the
SceneData, then adding ShadowedScene and Camera does not work :
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new
osgShadow::ShadowedScene;
#if 0
osg::ref_ptr<osgShadow::ShadowVolume> shadowVolume = new
osgShadow::ShadowVolume;
shadowedScene->setShadowTechnique(shadowVolume.get());
shadowVolume->setDynamicShadowVolumes(updateLightPosition);
#else
osg::ref_ptr<osgShadow::ShadowMap> shadowMap = new osgShadow::ShadowMap;
shadowedScene->setShadowTechnique(shadowMap.get());
//shadowedScene->addChild(shadowMap->getCamera());
#endif
osg::ref_ptr<osg::LightSource> ls = new osg::LightSource;
ls->getLight()->setPosition(lightpos);
shadowedScene->addChild(model.get());
shadowedScene->addChild(ls.get());
osg::ref_ptr<osg::Group> grp = new osg::Group;
grp->addChild(shadowedScene.get());
grp->addChild(shadowMap->getCamera());
viewer.setSceneData(grp.get());
Any help appreciated
Mihai
On Tue, 2007-02-13 at 22:11 +0000, Robert Osfield wrote:
> Hu Mihai,
>
> To get the position of the light source you do what the
> osgShadow::ShadowVolume technique does and let the traversal happen
> for the scene then get the PositionalStateContainer from the
> RenderStage that the cull traversal has populated, then build the view
> and projection matrix according to this position.
>
> Robert.
>
> On 2/13/07, Mihai Radu <[EMAIL PROTECTED]> wrote:
> > Hello Robert,
> >
> > I've been trying to implement osgShadow::ShadowMap, using the old
> > osgdepthshadow as a starting point.
> >
> > I am attaching ShadowMap[.cpp] and testShadow.cpp[ based on osgshadow
> > example ].
> >
> > I hit a bit of a wall, and here are some of the points I'm not very
> > clear on:
> >
> > 1. there is a Camera[PRE_RENDER] to RTT the depthMap, it's viewFrustum
> > needs to be updated according to the light, but where is the appropriate
> > call-back for it in the Update or in the Cull traversals ??
> > 2. same for TexGenNode for applying the said depthMap
> > 3. how do I add the Camera to the rendering ? (if I add it to
> > ShadowedScene, there is a loop, since the sceneData of the Camera is
> > ShadowedScene)
> > 4. where is appropriate to add the TexGenNode (ShadowedScene seems like
> > the candidate) ?
> >
> > Right now I've turned off the depth comparing on the depthMap to see
> > what is happening, and all I get is a black rectangle.
> >
> > I've looked through the code for ShadowVolume, and I see you do some
> > magic with the renderBins in Cull traversal, but I can't quite figure if
> > I need to do something similar (I guess because I don't quite get what
> > is happening there :)
> >
> > I would really like to have this going, then I could use the nodeKit
> > with the application we are working on ( I'll have to back-port it to
> > osg 1.2, but that's not a big deal if I exclude ShadowVolume technique).
> >
> > Regards
> > Mihai Radu
> > ------------
> > cm-labs.com
> >
--
Mihai Radu <[EMAIL PROTECTED]>
Critical Mass Labs
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/