I'm trying to add shadows to my scene, but I have some issues! 

I have a fairly big textured terrain and 1 light. I have tried the various 
shadow methods and I get different results for each method.

With this

      osg::ref_ptr<osgShadow::ShadowedScene> pShadowedScene = new 
osgShadow::ShadowedScene;
      pShadowedScene->addChild(pTerrain);

      osg::ref_ptr<osgShadow::StandardShadowMap> st = new 
osgShadow::StandardShadowMap;
      pShadowedScene->setShadowTechnique(st.get());

My texture disappears on my terrain but I do have shadows. I also tried 
ShadowTexture but that only renders the terrain with a light and no shadows.

With this 
      osg::ref_ptr<osgShadow::ShadowedScene> pShadowedScene = new 
osgShadow::ShadowedScene;
      pShadowedScene->addChild(pTerrain);

      osg::ref_ptr<osgShadow::ViewDependentShadowMap> vdsm = new 
osgShadow::ViewDependentShadowMap;
      pShadowedScene->setShadowTechnique(vdsm.get());

I have shadows and my terrain is textured, woohoo :-) 

Why does my texture disappear with the StandardShadowMap and nothing works with 
ShadowTexture?

My next issue is that I have some custom shaders in glsl 4.1 that I need to use 
to render some special effects on my terrain. When I enable those the shadows 
disappears!

I use these to enable GL4 

    gc->getState()->setUseModelViewAndProjectionUniforms(true);
    gc->getState()->setUseVertexAttributeAliasing(true);

So my last question is how do I mix shadows generated in the osg::Shadow 
classes with my custom shaders for various effects? 

Oh also when I enable the GL4 shaders all text disappears and other strange 
rendering issues appears like the stats renders as gray boxes!

Cheers,

Michael

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





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

Reply via email to