After some more digging I kind of have a feeling for what is happening but 
again I have too little knowledge of the OSG internals to really understand 
what is going on...

When looking at the culling phase I see that there is the root render stage, 
then 2 levels of pre render bins (excluding root level). First the root render 
stage has the correct light attribute in its _renderStageLighting and a null 
_inheritedPositionalStateContainer, then the 1st level _preRenderList render 
bin's _inheritedPositionalStateContainer is from the parent render stage 
_renderStageLighting. Its _renderStageLighting however is not inherited and 
contains no light attributes. Therefore on the 2rd level pre render bin the 
_inheritedPositionalStateContainer
is from the 1st level _renderStageLighting, but this has an empty _attrList...

Basically it seems that when having a hierarchy of pre render stages / bins the 
light attribute does not trickle down the hierarchy and is not applied before 
my geometry is drawn...

Not sure if that makes sense... Any idea ?


cheers,


guillaume

________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Poirier, 
Guillaume
Sent: September-19-11 5:16 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Lighting problem when using help or stats handler

Hi Paul and al.,

Yes the geometries do have color and normal arrays. From what I understand the 
problem is that the scene light is applied only after the geometry is drawn,
therefore using last frame light settings when drawing the geometry. Since the 
help / stats handlers apply their default light at the end of the frame, it 
will be
used for the next frame scene render.

 This render order issue seems to be directly related to the implementation of 
the EffectNode and its overriding of the traverse() and cull() functions.


cheers,


guillaume

________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Paul Martz
Sent: September-19-11 4:56 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Lighting problem when using help or stats handler

On 9/19/2011 2:43 PM, Poirier, Guillaume wrote:
Hello OSG users,

My problem is simple to describe: When in our application we press 's' or 'h' 
to display either the stats or help, the
lighting changes when it should not.

Check to make sure that all Geometry objects in your scene specify a color 
array and a normal array. OSG does not provide a default if these are missing, 
so they inherit the value last set in the OpenGL state machine. Both affect 
lighting (color affects lighting because OSG's default is to enable 
GL_COLOR_MATERIAL if no Material StateAttributes are present).
   -Paul

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

Reply via email to