> -----
> From: Alejandro Segovia
> Sent: Wednesday, May 21, 2008 5:50 AM
> 
> Hey Ben,
>
> On Tue, May 20, 2008 at 6:20 AM, Ben Discoe <[EMAIL PROTECTED]> wrote:
>> I noticed that using osgShadow::ShadowMap in my scene makes everything
>> very dark, even nodes not part of the shadowed scene.  Studying the OSG
>> code, i found this in ShadowMap.cpp, in ShadowMap::cull:
> 
>> const_cast<osg::Light*>(selectLight)-> 
>> setAmbient(osg::Vec4(0.0f,0.0f,0.0f,1.0f);
> 
> I can't seem to find this in OSG 2.2. It must have been added recently.
> Maybe the old code can be "forward ported"? :P

I dug into SVN, and found the change, revision 7690, December 15, 2007.  
Comment is "Tweaked the ambient lighting contribution so that the OpenGL vertex 
lighting has the ambient light source switched off, and use the fragment shader 
to add this contribution back in."

That added the code:

  // set to ambient on light to black so that the ambient bias uniform can take 
it's affect
  
const_cast<osg::Light*>(selectLight)->setAmbient(osg::Vec4(0.0f,0.0f,0.0f,1.0f));

Unfortunately that breaks ambient light for the entire rest of the scene, 
because that light is the same light used to illuminate everything, even 
outside the shadowed sub-graph.  Setting ambient to black has no effect if your 
materials already have no ambient.  But if they have ambient, then osgshadow is 
wiping it out, resulting in very dark objects.

So yes, the code can be 'forward ported' - we can remove that black ambient, or 
some other solution such as using a separate light.  Robert, should i submit 
the fix to osg-submissions?

-Ben


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to