Hello all,

I try to implement fog in my scene. It works fine and a was very happy, but 
after this I would like shadows in my scene and I include a standard shadow 
map. But my fog doesn't work now.

Here my

// Shadowed Scene
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new 
osgShadow::ShadowedScene;
shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);

shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask);
shadowedScene->addChild(node);
root = shadowedScene;

StandardShadowMap* ssm; // StandardShadowMap is my a wrapper
ssm = new StandardShadowMap(2048,2048);
shadowedScene->setShadowTechnique( ssm->getShadowTechnique() );

// StateSet (Fog)
osg::Fog* fog = new osg::Fog();
osg::StateSet* state = root->getOrCreateStateSet();
state->setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);
state->setMode(GL_FOG, osg::StateAttribute::ON);
fog->setColor( viewer->getCamera()->getClearColor() );
fog->setDensity(0.0);
fog->setMode(osg::Fog::LINEAR);
fog->setStart(50.0f);
fog->setEnd(60.0f);
fog->setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH);
state->setAttributeAndModes(fog,osg::StateAttribute::ON); 

Also the root is my osgShadow::ShadowedScene and for this node, I set up the 
fog.

What can I do to use fog and shadows?

Cheers

Martin
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to