Thanks Robert,
to close the thread, I am putting more info based what you have written
and my experiments:
- LightSource with Light attached - can be far down in the scene graph
while it shines on whole scene.
It uses PositionalStateContainer of RenderState to store light position.
Advantages:
- huge benefit is that the light shines on whole scene. That is how
we expect the
things happens in reality.
This implies LightSource limitations:
- only 8 lights per scene
- OpenGL IDs can not be shared
- multiple references / multi-parenting (with different transformations)
can not work (by design)
- Light (just StateSet attribute) - shines just on objects down in the
scene graph
It does not use PositionalStateContainer of RenderState.
Advantages:
- OpenGL IDs can be shared, provided that up to 8 lights with unique ID
shines at any moment
- multiple references / multi-parenting (with different transformations)
works correctly and lights are instanced correctly on multiple
positions
Limitations:
- To make the light shine on the whole scene or specified part of
the scene
is little bit troublesome in some cases. Especially, if the light
position is expected to be
animated by some transformation down in the scene graph.
- there are still some issues in OSG implementation on multiple
light references,
but it can be (hopefully) easily fixed, if needed
To express my opinion after the understanding of lights: Lights are very
well designed.
(Considering to contribute OSG light documentation, if it happens I will
have a time.)
To handle more advanced scene setups and for the purpose of shadows, I am
considering some extensions. However, it depends how important the
extensions turn out to be.
John
Robert Osfield wrote:
Hi John,
Have a look into discussion on osg-users about positional state.
LightSource is what positions Light in the scene. You can't have one
GL light in more than one place at a time, and the light has to be
positioned by a specific modelview matrix, not one artificially
inherited, so LightSource's role is to place the light.
Robert.
On Mon, Mar 22, 2010 at 11:52 AM, PCJohn <pec...@fit.vutbr.cz> wrote:
Gurus,
What is the reason for keeping LightSource in OSG?
I successfully removed all osg::LightSources from my scene graph and used
just osg::Light - it is well placed and follows the transformation of the
parent node (f.ex. locomotive) as it moves. Except absolute reference frame,
is there any reason for LightSource existence in OSG? I think yes, but
missing arguments.
Thx for explanation,
John
Thrall, Bryan wrote:
You place the LightSource in the scene graph where you want the light to
be positioned. I don't think it is necessary for directional lights (they
are infinitely far away, so don't have a position), but say you want a
spotlight attached to a train locomotive. You could update osg::Light's
position every time the locomotive moves, or you could attach a LightSource
to the locomotive's scene graph and have the light placed correctly
automatically.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org