Hi Martin, Unfortunately there isn't any support for handling more than one shadow at a time with osgShadow right now.
Robert. On 13 February 2013 14:13, Martin Záleta <[email protected]> wrote: > Hi, > > I'm trying to set up an interior scene by using the model of Sibenik > Cathedral, then filling it with 8 lights and shadows, but my efforts fall > rather short so far. Without shadows the scene looks pretty much like > everything is set up alright, but when I enable ShadowMap technique, not only > do the walls turn all black, but the actual visible shadows look rather off > too. Could anyone please take a look at my code and come up with any kind of > suggestion regarding what I might be doing wrong? Any help greatly > appreciated. > > My IndoorScene class derived from ShadowedScene: > > Code: > IndoorScene::IndoorScene() > { > Group* sceneGroup = NULL; > Node* sibenikNode = NULL; > MatrixTransform* sibenikScaleXform = NULL; > Geode* lightMarkerGeode = NULL; > Group* lightGroup = NULL; > StateSet* lightStateSet = NULL; > LightSource* lightSources[8] = {NULL}; > ShadowMap* shadowMap = NULL; > > sceneGroup = new Group; > > sibenikNode = readNodeFile("sibenik.osg"); > > Matrix sibenikScaleMatrix; > sibenikScaleMatrix.makeScale(5.0f, 5.0f, 5.0f); > sibenikScaleXform = new MatrixTransform; > sibenikScaleXform->setMatrix(sibenikScaleMatrix); > > lightMarkerGeode = new Geode; > lightMarkerGeode->addDrawable(new ShapeDrawable(new Sphere(Vec3f( > 9.0f, 1.5f, 2.0f), 0.2f))); > ... lightMarkerGeode->getOrCreateStateSet()->setMode(GL_LIGHTING, > StateAttribute::OFF); > > lightStateSet = sceneGroup->getOrCreateStateSet(); > > Light* light1 = new Light; > light1->setLightNum(0); > light1->setPosition(Vec4f(9.0f, 1.5f, 1.75f, 1.0f)); > light1->setAmbient(Vec4f(0.5f, 0.5f, 0.5f, 1.0f)); > light1->setDiffuse(Vec4f(0.9f, 0.9f, 0.9f, 1.0f)); > light1->setConstantAttenuation(1.0f); > lightSources[0] = new LightSource; > lightSources[0]->setLight(light1); > lightSources[0]->setLocalStateSetModes(StateAttribute::ON); > lightSources[0]->setStateSetModes(*lightStateSet, StateAttribute::ON); > > ... (likewise for other lights) ... > > lightGroup = new Group; > for (int i = 0; i < 8; i++) > { // zoskupenie svetiel > lightGroup->addChild(lightSources[i]); > } > > shadowMap = new ShadowMap; > setShadowTechnique(shadowMap); > > addChild(sceneGroup); > sceneGroup->addChild(sibenikScaleXform); > sibenikScaleXform->addChild(sibenikNode); > sibenikScaleXform->addChild(lightMarkerGeode); > sibenikScaleXform->addChild(lightGroup); > > Optimizer optimizer; > optimizer.optimize(this); > } > > > > Some screens for additional information - before shadows: > > i . imgur . com / OMarm71.png > > ... and after Shadows: > > i . imgur . com / dpKuxmW.png > > Thank you! > > Cheers, > Martin > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=52634#52634 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

