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.
In mathematical terms: x^2 + y^2 + z^2 == 1
Unit length means normalize the length of vector by;
x / sqrt(xx + yy + zz),
y / sqrt(xx + yy + zz),
z / sqrt(xx + yy + 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.
Thanks for all the replies! I think i understand it now. And by the way, great skull danny .