Yes here's the code, I had this problem myself recently
[code]
// The following is taken from the osg::StateSet documentation re:
GL_NORMALIZE
/********************************************************************
* If the transformation matrix scales the subgraph then the normals
* of the underlying geometry will need to be renormalized to be
unit
* vectors once more. This can be done transparently through
OpenGL's
* use of either GL_NORMALIZE and GL_RESCALE_NORMAL modes.
*
* To enable it in the OSG, you simply need to attach a local
osg::StateSet
* to the osg::Transform, and set the appropriate mode to
* ON via stateSet->setMode(GL_NORMALIZE,
osg::StateAttribute::ON);
********************************************************************/
// Create a scene stateset
osg::ref_ptr<osg::StateSet> sceneState =
sceneRoot->getOrCreateStateSet();
// Set the SceneRoot to normalise normals when scaling is applied to
objects.
sceneState->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
[/code]
On Fri, Aug 14, 2009 at 3:11 PM, Jean-Sébastien Guay <
[email protected]> wrote:
> Hi David,
>
> I scale the PositionAttitudeTransform by (5,5,5) for example, because my
>> model is too small, but then the lighting isnt sufficient. Is there a way to
>> scale the lighting as well ? Or how can I keep the light constant with
>> scaling the model ?
>>
>
> This is an FAQ. Set GL_RESCALE_NORMAL or GL_NORMALIZE on your node, because
> the transform is scaling the normals used for lighting too.
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay [email protected]
> http://www.cm-labs.com/
> http://whitestar02.webhop.org/
> _______________________________________________
> 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