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

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Sat Jul 19 05:16:49 PDT 2008

Hello Ümit,

> I have tried "terrainScaleMAT->getOrCreateStateSet()->setMode( 
> GL_RESCALE_NORMAL, osg::StateAttribute::ON );" pattern but the result is 
> same. There is no light effect on the terrain. I don't understand why?

As Gordon said, check if your terrain has normals in the first place... 
Rescaling non-existing normals won't do anything :-)

In your .osg file, check for normalArray under your Geometry, and check 
that normalBinding is set to PER_VERTEX. If the model has no normals, 
you can generate them with a modeling tool or use the 
osgUtil::SmoothingVisitor to create smooth normals across the surface.

And BTW, yes you're right that the two suggestions I gave before were 
mutually exclusive, i.e. if you checked your model and changed the 
TexEnv in it you don't need a NodeVisitor to do the same thing...

Oh, just another little thing, are you sure you're reloading the .osg 
model and not the original one without your changes?

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

More information about the osg-users mailing list