Hi John,

Actually LightSource doesn't illuminate by itself, it just provides
the settings for glLight and position it correctly and uniquely in
space.  In OpenGL you don't actually get illumination even when you
set glLight, you only get illumination once you enable GL_LIGHTING and
GL_LIGHTi.  In the OSG case the subgraphs that will illuminated are
the parts that you've enabled GL_LIGHTING and the appropriate
GL_LIGHTi for, osg::Light and osg::LightSource don't have any effect
apart from the actual values used by the lighting model.

As for limitation osg::Light/LightSource/OpenGL lighting all work with
the same limitations - that is there is only ever guaranteed to be 8
fixed function pipeline light supported.  If you want to use more than
8 then you'll need to use shaders, or localize the lights to
difference subgraphs have different lights assigned for them.  The
fact you need to position lights as well means that one has to apply
the appropriate modelview matrix for each of these lights before
application, which complicated the implementation.  The only way to
tackle this right now with the OSG is to break the scene up into
separate subgraphs that each target their own RenderStage.  This is
possible, but awkward at present.

The same issues apply to all positional state - eye linear texgen,
clip planes and lights.

Robert.

On Wed, Mar 24, 2010 at 12:13 PM, PCJohn <pec...@fit.vutbr.cz> wrote:
> 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
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to