[osg-users] osg::Light Simple Question ?

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Fri Jul 18 17:13:09 PDT 2008

Hello Ümit,

> I am trying to effect the components of scene with green light. Although 
> green light could effected two of sphere,  couldn't get success on the 
> terrain model. What can I do to effect the terrain with green light?

Your terrain's texture is probably being applied in GL_REPLACE mode, 
instead of in GL_MODULATE mode. In GL_MODULATE, the texture color is 
multiplied by the shading value at a pixel to give the final surface 
color, and in GL_REPLACE mode the texture color is used directly 
(replacing the shading).

Your options:
* Check the terrain model file (you can try osgconv model.whatever 
model.osg if it isn't an .osg file, and then open it in a text editor to 
check for the texture application mode) and change it in the model.
* Write a NodeVisitor that you will run on your terrain model after 
having loaded it to change any osg::TexEnv object from REPLACE mode to 
MODULATE mode (or just remove the TexEnv, since the default is MODULATE).

I recommend option 1, your life will be much easier if your models are 
correct in the first place and you don't have to hard-code any changes 
in your program.

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list