[osg-users] Issue with shadow

Pete Black pete at marchingcubes.com
Wed Sep 21 23:16:20 PDT 2016


When you set up the technique on your ShadowedScene, you can use any of the various techniques from osgShadow.

on this page: 

http://trac.openscenegraph.org/projects/osg//wiki/Support/ProgrammingGuide/osgShadow

There is example code for setting up shadows, and, as an example, to use soft shadow map shadows instead of standard shadow map shadows, you would change the example as below:

 osg::ref_ptr<osgShadow::SoftShadowMap> sm = new osgShadow::SoftShadowMap;
 shadowedScene->setShadowTechnique(sm.get());

Note you may have to include the relevant osgShadow classes, and you may need to pass additional parameters as the defaults may not suit your scene e.g for soft shadows, you have parameters like:

setSoftnessWidth();
setBias();
setJitteringScale();

which will adjust the appearance of the shadows. The other more advanced shadowing techniques like PSSM, LISPSM and VDSM will have different params so you may need to consult the docs and/or source for details. 

Note that there doesnt seem to be a great one-size-fits-all solution for high-quality shadows in OpenSceneGraph, and I have read a number of posts where people are struggling to acheive good results, or have artifacts depending on the scene setup.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68691#68691








More information about the osg-users mailing list