[osg-submissions] ShadowMap update

Mihai Radu radu at cm-labs.com
Mon Oct 1 13:09:07 PDT 2007


Hi Robert,

I hope it's not to late to have some additions to ShadowMap included in
the 2.2 release.
CM-Labs will be using this as the basis for shadows in the osg 2.2 based
simulator, and it would help a lot to have some of these additions into
the main osg.
If the there is no quick fix for using spot-lights I can chop-out that
part of the code and re-post the files asap.

Most of the additions are small utility methods:
- set the resolution of the shadow map; it calls dirty() to
re-initialize at next update
- keep a list of Shader objects to use instead of the default ones, if
the list is empty, the default shaders are used
- explicitly create the Uniform variables, so that subsequent additions
that require more Uniforms can put them in a central place
- set a Light or LightSource to use explicitly for shadow casting,
allows multiple lights in the scene, with one casting shadows

There are two additions that do not ( yet ) function correctly, but in
the present usage they do not interfere with the regular usage of the
techique:
- support for using spotlights, it's using Light.spotCutoff to determine
if it's a spot-light and not point-light,
    there is an error in the setup of either the shadow camera or the
texgen, most likely due to the direction of the spotlight, since the
position is being used just like in point or directional lights.
- creation of a debugHUD
    the hud is created properly, ( the example included shows it ), but
it displays only white, there has been some discussion of displaying the
shadow map, but I could not find it, the addition of a simple fragment
shader with the appropriate color transform should get this going.

Thank you for your patience
Mihai Radu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ShadowMap.zip
Type: application/octet-stream
Size: 13256 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20071001/4ecf71b3/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 542 bytes
Desc: OpenPGP digital signature
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20071001/4ecf71b3/attachment.pgp 


More information about the osg-submissions mailing list