[osg-users] Shadows : Creating multiple osgShadow::ShadowedScene
Robert Graf
muzzleburst at gmail.com
Mon May 18 22:43:52 PDT 2015
Howdy all,
What are some approaches for using the OSG to render a scene with 6 shadow-casting spot lights using the ShadowMap technique?
A couple of ideas that came to mind:
1) Use multiple ShadowedScene's with each one having a ShadowMap technique that sets a unique shadow texture unit for each shadow map. ShadowMap has a function setTextureUnit() for doing this. Could these shadowed scenes be rendered in a pre-pass, such as under a slave camera or RenderBins, and have the resulting shadow texture units be available for a main-pass fragment shader?
2) Make a local clone of ShadowMap, and modify it to support 6 lights with a dedicated shadow texture unit for each light. A fragment shader would be added using the ShadowMap.addShader() method, that does per-pixel lighting and does look-ups into all 6 shadow texture units.
3) Make a local clown of ShadowedScene, and modify it so that _shadowSettings and _shadowTechnique are dynamic arrays, effectively allowing multiple ShadowSettings/ShadowTechnique pairs to be inserted. Each inserted ShadowMap technique would be assigned a unique texture unit number. This has a number of questionable architecture issues.
Something similar to #1 above would be ideal, without modifying OSG much, but may not be possible. #2 seems like it should work, but would require some development. #3 sounds like it would be over-complicated or unfitting for the OSG framework.
Any thoughts or opinions?
Thanks guys!
-Robert Graf
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63762#63762
More information about the osg-users
mailing list