Hi,

   I'm using osgShadow::ShadowedScene to render shadows using shadowmap. The 
shadows are rendered correctly. As my scene graph gets complex i want to add 
the ShadowedScene as a child to another node as shown below 


Code:

ref_ptr<Group> scene (new Group);

//Main light source 
        Vec3 lightPosition(0,0,3); 
        LightSource* ls = new LightSource;
        ls->getLight()->setPosition(Vec4(lightPosition,1));
        ls->getLight()->setAmbient(Vec4(0.2,0.2,0.2,1.0));
    ls->getLight()->setDiffuse(Vec4(0.6,0.6,0.6,1.0));

        //Shadow stuff!!!       
        ref_ptr<osgShadow::ShadowedScene> shadowedScene = new 
osgShadow::ShadowedScene;
        ref_ptr<osgShadow::ShadowMap> sm = new osgShadow::ShadowMap;
    shadowedScene->setShadowTechnique(sm.get());
        sm->setTextureSize(osg::Vec2s(2048, 2048));
        sm->setTextureUnit(1);
        sm->setLight(ls);

// Shadowed scene added as a child to scene
scene->addChild(shadowedScene.get());

// Set scene data
viewer.setSceneData(scene.get());





As shown above if i add the shadowedScene to scene and set the scene data to 
scene, the shadows are not getting rendered. If i set the sceneData to 
shadowedScene the shadows are rendered correctly. But the scene graph has some 
other elements such as ODE physics, shaders applied to some nodes etc., are 
getting disabled if i set sceneData to shadowedScene.

   Please provide some suggestions on how to get the shadow effect by by adding 
the shadowedScene as a child


Thank you!

Cheers,
Saravanan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31885#31885





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

Reply via email to