View Full Version : Normals

Feite

11-16-2005, 04: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:

http://highculture.8m.com/images/surface_normals.jpg

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.

Overmind

11-16-2005, 05:09 AM

In mathematical terms: x^2 + y^2 + z^2 == 1

songho

11-16-2005, 05:12 AM

Feite,

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.

==song==

Feite

11-16-2005, 05: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 © 2015 vBulletin Solutions, Inc. All rights reserved.