#### Archived

This topic is now archived and is closed to further replies.

# Normals : Pain in the ass

This topic is 6933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Does anyone know of an easy way to calculate normal vectors for vertices? If it helps i am using OpenGL. Is there some kind of simple (or not so simple) formula out there that anyone has come up with? I have been flipping thru a linear algebra book of mine, but it's all french to me (shoulda paid more attention in the lectures i guess ). Anyways, if anyone can give me any help, it would be greatly appreciated... <(o)> Edited by - aDasTRa on 5/1/00 10:31:41 PM

##### Share on other sites
Well, first off a normal has to be found to a plane, not a vertex. If you want a polygon to be flat shaded you can just use the normal to the polygon for each vertex. Otherwise you can take the vector average of the normals of all polygons which use a particular vertex.
To find the normal to a plane, you need two vectors which lay on the plane. Then you take the cross product:
(a1, b1, c1) X (a2, b2, c2) = (b1*c2 - b2*c1, a2*c1 - a1*c2, a1*b2 - a2*b1)

(I hope that's right, I'm doing it off the top of my head. You might want to look it up for a better explanation.)

By the way, make sure the cross product formula you use is correct for the system you are working in. For a right-hand system like OpenGl, with counter-clockwise winding, the above will work.
Good Luck!

Wraith

Edited by - wraith on 5/1/00 10:56:47 PM

##### Share on other sites
I''m just confirming that Wraith''s crossproduct is correct,

and stating that the formula is the same for left-handed systems as well. However the direction of the crossproduct is the opposite for a left-handed system. (Same values, different direction)

- WitchLord

##### Share on other sites
If you don''t exactly know what normals are and what they can do for you, I suggest you read Nate Miller''s tutorial on Normals. At nate.scuzzy.net

----------
Drago

##### Share on other sites

I do know what normals are, I just didn''t know how to calculate them for my polygons. I did find that article after i posted the original message and I think i have got it figured out.

<(o)>

• 15
• 13
• 35
• 39