0

I am using osgShadow::ShadowMap to create shadows:

shadowedScene = new osgShadow::ShadowedScene;

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

        sm = new osgShadow::ShadowMap;
        //sm->setLight();
        int mapres = 8192;
        sm->setTextureSize(osg::Vec2s(mapres,mapres));


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

I have aircrafts and an airport.

When I have aircrafts moving shadow is vibrating.

When i remove aircrafts there is no problem.

I have tried every possible shadowing tecniques but couldn't find any solution.

mucisk
  • 247
  • 5
  • 13

1 Answers1

0

I dont know the details of how shadow mapping is used in OSG, but from my experience with implementation of shadow maps in "plain" opengl i have an idea of what can be happening:

  • one of the steps in shadowmap technique is that the scene is rendered from POV of light sources. The view and projection matrices are configured so that this pass renders all perts of the scene that cast shadows.

  • if you have moving nodes in your scene, it could be the case. that the matrices need to be recalculated. as scene boundaries(from POV of the light source) have changed, which can lead in the next pass to "vibrating" shadows mentioned by you.

Tryto make it so that the parts of your scene that cast shadows don't change their combined volume boundaries in animation.

Pavel Beliy
  • 494
  • 1
  • 3
  • 14
  • I have moving nodes in my scene - aircrafts. When i remove them vibrating (flickering) stops. Is there any way to not to recalculate matrices of moving objects or recalculate it in 3. seconds or something like this? – mucisk Nov 18 '13 at 09:25