I am also experiencing the same thing upgrading from 2.8.5 to 3.0.1.  For a 
while I thought it was completely opaque until I looked closely at my lcd 
monitor where I found it to be just really really dark instead.

Here is the relevant frag shader code from 3.0.1:

Code:
void main(void)
{
  vec4 colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor;
  
  // Add ambient from Light of index = 0
  colorAmbientEmissive += gl_FrontLightProduct[0].ambient;
  vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy );
  color *= mix( colorAmbientEmissive, gl_Color, DynamicShadow() );


According to the opengl Orange book (shading language), 
gl_FrontLightModelProduct.sceneColor = gl_FrontMaterial.emission + 
gl_FrontMaterial.ambient * gl_LightModel.ambient.
Using GDebugger I was able to inspect these values as my shadowed geometry was 
drawn and saw:

gl_FrontMaterial.emission = {0,0,0,1}
gl_FrontMaterial.ambient = {0.588,0.588,0.588,1}
gl_LightModel.ambient = {0.1,0.1,0.1,1}

Given these values, gl_FrontLightModelProduct.sceneColor = colorAmbientEmissive 
= {0.0588,0.0588,0.588,1} which explains the extreme darkness of the shadows.

In OSG 2.8.5 colorAmbientEmissive was calculated like this:

Code:
colorAmbientEmissive = gl_FrontLightModelProduct.sceneColor + amb * 
gl_FrontMaterial.ambient;



For me this version results in much brighert/less dark shadows.

I see 2 choices to restore the previous look:  
1) Use custom shaders in order to use our own colorAmbientEmissive calculation 
or
2) Make sure the LightModel's ambient is much higher than 0.1.

If there's something easier that I'm missing, please let me know,

Thanks,
Michael

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44149#44149





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

Reply via email to