PDA

View Full Version : glScale and normals



Clutch
06-28-2000, 01:34 AM
Hi all,

I have a question concerning the normals of an object.

In a modeller app, I generate the wireframe of an object, including normals at creation time of an object.
I then allow the user to manipulate the transformations of the object. When a non-uniform scaling is used the normals are incorrect. Since I have stored the normals in a data structure when the object was created, I'd prefer not to have to regenerate them. Can I do a transformation on the calculated normals before passing them to OpenGL to correct for this?

- Lutz

kev
06-28-2000, 06:23 AM
whenever you do non-uniform scaling just enable GL_NORMALIZE - this sorts it all out for you.

Clutch
06-28-2000, 06:30 AM
Ahhh, thanks. At first I thought this is a global flag, but I see that I can enable it on a per-object basis, so I can check for scaling and then enable it if present.

Thanks for the hint.

- Lutz

Bob
06-28-2000, 09:32 AM
When you do non-uniform scaling, your normals will be incorrect (point in the wrong direction) even if you normalize them. This will mess up lightning. There is no function to make the normals correct, other than to recalculate them.

Just a note.

Clutch
06-28-2000, 03:09 PM
Hmmm. It looked pretty good http://www.opengl.org/discussion_boards/ubb/smile.gif

I was wondering whether I could maybe use an inverse scale transformations for the pre-calculated normals before sending them to glNormal3(). Then OpenGL will transform them to the correct orientation when it uses them.

While the lighting is not crucial (it's a preview only), I would like to get it right.
But recalculating the pre-calculated normals is not something I want to do at this point.

- Lutz