Mike Wittman wrote:
Should a scale in a transform affect the specular highlights on an
object?
I'm seeing a case where if I scale a transform node above a geometry
node the specular highlights change (scale > 1 -> highlights get
smaller, scale < 1 -> highlights get bigger, scale == 1 -> looks
normal).

Yes, a scale will change your normals to non-unit length which adversely
affects the lighting calculation.  You can ask OpenGL to rescale your
normals to unit length automatically.  From the osgTransform
documentation at
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/
classosg_1_1Transform.html#_details:

Note: 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. For further
background reading see the glNormalize documentation in the OpenGL
Reference Guide (the blue book). 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);

Thanks.  This is what I needed to do, and it works like a charm.

James
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to