[osg-users] osgShadow

Claudio Arduino hard1880 at gmail.com
Tue Jul 22 05:38:42 PDT 2008


hi,
i have created a shadowed scene in this mode:

...
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new
osgShadow::ShadowedScene;

shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask);

osg::ref_ptr<osgShadow::ShadowMap> sm = new osgShadow::ShadowMap;
sm->init();
sm->clearShaderList();
sm->cleanSceneGraph();
sm->setAmbientBias(osg::Vec2(0.8,0.8)); //default 0.5
//sm->setTextureSize(osg::Vec2s(1024,1024));


shadowedScene->setShadowTechnique(sm.get());

osg::ref_ptr<osg::Group> autoepista=new osg::Group();
autoepista->addChild(auto_cla.get());// car
autoepista->addChild(contorno.get());// bridge over the track


// setto le maschere di shadow attualmente se spengo l'ombra della pista
funziona quella della macchina e viceversa
auto_cla->setNodeMask(auto_cla->getNodeMask() & CastsShadowTraversalMask);//
set on cast for car
track->setNodeMask(ptratto[0]->getNodeMask() & ~CastsShadowTraversalMask);//
set off cast for track
contorno->setNodeMask(contorno->getNodeMask() & CastsShadowTraversalMask);//
set on cast for bridge

shadowedScene->addChild(autoepista.get());
shadowedScene->addChild(track.get());

shadowedScene->addChild(lightgroup);

root->addChild(shadowedScene.get());
...

i have scena_cla node that non cast shadow, receive only and auto_cla and
contorno nodes that cast shadow,now:
if i set castshadow for both auto_cla and contorno the shadow of contorno is
correct but the shadow of auto_cla appear wrong and poor
if i set ~castshadow for contorno and castshadow for auto_cla the shadow of
auto_cla is correct but contorno dont project shadow..
i dont understand why i dont work correctly...
can anyone help me?

ps i have tested other shadow tecnique but don't work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080722/9b2f05ae/attachment-0002.htm>


More information about the osg-users mailing list