Hi Michael, Haven't you just skipped addition of gl_FrontLightProduct[0].ambient which should contain contribution of light 0 ambient * material ambient ? So final colorAmbientEmissive is gl_FrontLightModelProduct.sceneColor + gl_FrontLightProduct[0].ambient. This should produce similar colorAmbientEmissive term as old vertex shader version unless something else do not come into play. Perhaps you draw using BackFace materials ?. I also wonder if use of ColorMaterial mode may somehow result it different colorAmbientEmissive now....
Cheers, Wojtek 2011/11/30 Michael Guerrero <[email protected]> > 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 > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

