Hi Dario,

This screen looks correct to me. But it seems that all objects are fully
shadowed. You wrote: "all objects in the scene (a horizontal plane, a cube
and the Light". Does it mean that you draw some Light source model too ? If
so doesn't this model occlude everythning by any chance ?

Cheers,
WL


2012/7/24 Dario Minieri <para...@cheapnet.it>

> Hi
>
> Thanks Wojtek for your suggestions. First, using or not using the light in
> the code, the final result is the same: all objects in the scene (a
> horizontal plane, a cube and the Light) are all blacks.  I'm not really
> sure to understand correctly the debug draw result: I obtain something like
> the attached image. The visitor code is simple, loads the shaders one time
> and apply them to the objects (from the code above you can see that this is
> applied to the root of the scene):
>
>
> Code:
>
> class PrepareNodeForShading : public osg::NodeVisitor
> {
> public:
>     PrepareNodeForShading() :
> osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
>
>     void apply(osg::Node& node)
>     {
>        applyShading(node);
>        traverse(node);
>     }
> };
>
> osg::StateSet* applyShading(osg::Node& node)
> {
>     static bool l_load_skipper = true;
>     osg::Program* prg;
>     if(l_load_skipper) {
>       prg = new osg::Program;
>       //Shaders from StandardShadowMap.
>       osg::Shader * l_mv = new osg::Shader(osg::Shader::VERTEX);
>       osg::Shader * l_sv = new osg::Shader(osg::Shader::VERTEX);
>       osg::Shader * l_mf = new osg::Shader(osg::Shader::FRAGMENT);
>       osg::Shader * l_sf = new osg::Shader(osg::Shader::FRAGMENT);
>       l_sv->loadShaderSourceFromFile("Shader/main_shadow.vert")
>       l_mv->loadShaderSourceFromFile("Shader/main_vert.vert")
>       l_sf->loadShaderSourceFromFile("Shader/main_shadow.frag")
>       l_mf->loadShaderSourceFromFile("Shader/main_frag.frag");
>       prg->addShader(l_sv);
>       prg->addShader(l_mv);
>       prg->addShader(l_sf);
>       prg->addShader(l_mf);
>
>       l_load_skipper = false;
>     }
>
>     node.getOrCreateStateSet()->setAttributeAndModes(prg,
> osg::StateAttribute::ON);
> }
>
>
>
>
> Hummm...the objects have no OVERRIDE attribute.
>
> Many thanks!
>
> Bye
>
>
> [quote="Wojtek"]Hi Dario,
>
> Code looks ok to me. Have not tried to build it though. I would check your
> light source if its set and found by shadow technique. Shadow Technique may
> use default viewer light instead. Also do a test with setDebugDraw( true )
> and check if 'cyan on pink' depth texture is generated and changes with
> moving camera. Compare it with osgshadow example ran with lispsm switch. If
> depth texture is generated then it means light source is found and shadow
> map computed. Then the only cuplrit may be applying this shadow map to
> scene so I would check then if your visitor indeed does the right job and
> check if there are no GLSL compilation / linking errors. (osg_notify_level
> = debug).
>
> You may also test your light and program applying visitor in osg shadow.
> If it all works there then the models could be an issue ( do they have
> protected programs set in their statesets ? ).
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=49020#49020
>
>
>
>
> _______________________________________________
> 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