Hi,

I reached some difficulties with handling of lights when I was considering some improvements to osgShadow, like multiple light sources:

1. single light source object can be placed two times to the scene. Because of multi-parenting, the light may have two different transformations. Although one object and one unique pointer, it identifies two light sources, thus it is not unique light identification. When current implementation of ShadowMap::setLight(light) sets the light for shadows, which one of the two should cast the shadows? Definitely, not both of them, at least not with the current light implementation.

Options:

- The most robust approach is to use "paths", identifying the node path down in the scene graph to the light. This would allow proper identity of multiple-parented objects and position of the light would be given by the transformations on the path.

- Another approach may use just the first or the last light occurence in the scene graph.

- cull-time approach may use first or last occurence of the light in the RenderStage::PositionalAttributeList.

- any other options?

The first "most robust" approach is used by Open Inventor and it works pretty good, although it may be considered overkill by some people.

My current preference is to use the first position of the light in the scene graph (retrieved from RenderStage::PositionalAttributeList, because it is used in cull-time), and to silently keep all the remaining light occurrences in the scene graph on the same position. When an user will need lights on different positions, he will just create copies of the same light.

2. LightSource question: I was always wondering why there are two light classes - osg::Light and osg::LightSource - and not just one. Is the only purpose for having both osg::Light and osg::LightSource the ability of LightSource to specify ReferenceFrame? Apparently, osg::Light as Attribute can not have reference frame. Any other reasons, or am I missing something?

Thanks,
John
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to