View Full Version : Normals
11-16-2005, 05:01 AM
I've just recently bought the red book, and now i'm at the lighting chapter and they say you need normals of "unit length". Well i'm dutch and i'm fairly good at math, but less good at english so i can't translate it.. I know what a normal is, but not what a unit length is. Could someone give me a few examples of normal of unit lengths? Like the normal vectors of an ordinary cube. Thanks in advance!
'Unit length' simply means a vector (a line in space) which has a length of 1.
Here's an image of a model with it's polygon normals drawn in blue:
For polygons, the normals always stick out at exactly 90 degrees to the angle of the face itself (as shown in the diagram above).
But for vertices it's slightly different. The angle of a vertex normal depends on the angle of all the faces adjoining it. The angle of the vertex normal is actually the 'average' of all these values.
So for a cube, each of the vertex normals would be pointing out at an angle of exactly 45 degrees from each corner.
Hope that helps.
11-16-2005, 06:09 AM
In mathematical terms: x^2 + y^2 + z^2 == 1
11-16-2005, 06:12 AM
Unit length means normalize the length of vector by;
x / sqrt(x*x + y*y + z*z),
y / sqrt(x*x + y*y + z*z),
z / sqrt(x*x + y*y + z*z)
The length of above vector will be 1.
It is important normailzing the normal vector because normals are transformed by GL_MODELVIEW matrix and used for lighting calculation during vertex operation.
11-16-2005, 06:22 AM
Thanks for all the replies! I think i understand it now. And by the way, great skull danny ;) .
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.