 # Normals

Does anyone know of a fast routine to make
all the normals of a model point the same
way. i.e. all point outward or all inward

What exactly are you trying to do ?

Just loop through all your polygons, and calculate the crossproduct of the two vectors building the polygon.

Like this.

p = p2 - p1
q = p3 - p2

n.x = p.y * q.z - p.z * q.y;
n.y = p.z * q.x - p.x * q.z;
n.z = p.x * q.y - p.y * q.x;

p1 is first point in your triangle, p2 is second and p3 is third

And what do you mean by fast? Planing to recalculate the normal each frame?

For proper vertex lighting you’ll also want to scale down the resulting vector (the vector n in Bob’s equation above) so that it’s of unit length.

A couple of thoughts:

After I wrote that I realized that I was being a little silly with #2 up there. If you’re using a winged-edge or quad-edge(half-edge, whatever) then consistent orientation is guaranteed as long as you built the data structure right in the first place. Guess I should think more before I speak .