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

Ümit Uzun umituzun84 at gmail.com
Sat Jul 19 06:05:45 PDT 2008


Hi Jean,

Thanks for reply. You are right, my model hasn't normals :) So
"terrainScaleMAT->getOrCreateStateSet()->setMode( GL_RESCALE_NORMAL,
osg::StateAttribute::ON );" pattern doesn't work on terrain lightening. Like
your advice I can use osgUtil::SmoothingVisitor but I choose easier way
which is gathering model which has normals in it. So I use new model with
adding GL_RESCALE_NORMAL control and result is perfect like added
screenshot:)

I have a last question about why my model's lightening operation related
with normals rescaling process? I can't understand backgroud of this
command.

Thanks for helps Jean and Gordon :)
Best Regards.

Ümit UZUN

2008/7/19 Jean-Sébastien Guay <jean-sebastien.guay at cm-labs.com>:

> 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?
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080719/6edd2420/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TerrainLight.png
Type: image/png
Size: 167767 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080719/6edd2420/attachment-0003.png>


More information about the osg-users mailing list