03-16-2001, 06:25 AM

I'm totally green so bare w/ me pls.

You can calculate the normal by using cross products.

p1, p2 and p3 is your three points in space.

v1 is a vector from p1 to p2

v2 is a vector from p1 to p3

n is the normal calculated by using cross product, v1 x v2.

v1.x = p2.x - p1.x

v1.y = p2.y - p1.y

v1.z = p2.z - p1.z

v2.x = p3.x - p1.x

v2.y = p3.y - p1.y

v2.z = p3.z - p1.z

n.x = (v1.y * v2.z) - (v2.y * v1.z)

n.y = (v1.z * v2.x) - (v2.z * v1.x)

n.z = (v1.x * v2.y) - (v2.x * v1.y)

The example above evaluates to the Face Normal, correct?

n is NOT Normalized yet, correct?

To Normalize the Face Nomal, you then sqrt(n.x^2 + n.y^2 + n.z^2), correct?

The Red Book says you need the "Vertex" Normals for lighting to work properly, via glNormal*(). I gather that in order to get the Vertex Normal of a particular Vertex you have to deal w/ all Face Normals that share said Vertex, correct?

This is where i get a little confused. I've read that you must average the "UnNormalized" Face Normals that share said Vertex first, THEN Normalize the averaged Face Normals to get the result glNormal*() needs to work correctly. Is this right?

TIA,

Lee

You can calculate the normal by using cross products.

p1, p2 and p3 is your three points in space.

v1 is a vector from p1 to p2

v2 is a vector from p1 to p3

n is the normal calculated by using cross product, v1 x v2.

v1.x = p2.x - p1.x

v1.y = p2.y - p1.y

v1.z = p2.z - p1.z

v2.x = p3.x - p1.x

v2.y = p3.y - p1.y

v2.z = p3.z - p1.z

n.x = (v1.y * v2.z) - (v2.y * v1.z)

n.y = (v1.z * v2.x) - (v2.z * v1.x)

n.z = (v1.x * v2.y) - (v2.x * v1.y)

The example above evaluates to the Face Normal, correct?

n is NOT Normalized yet, correct?

To Normalize the Face Nomal, you then sqrt(n.x^2 + n.y^2 + n.z^2), correct?

The Red Book says you need the "Vertex" Normals for lighting to work properly, via glNormal*(). I gather that in order to get the Vertex Normal of a particular Vertex you have to deal w/ all Face Normals that share said Vertex, correct?

This is where i get a little confused. I've read that you must average the "UnNormalized" Face Normals that share said Vertex first, THEN Normalize the averaged Face Normals to get the result glNormal*() needs to work correctly. Is this right?

TIA,

Lee