so i have a list of vertex points which i want to render
i have applied light and would like to apply it to each vertex point to get a smooth rendering
but what i want is the relationship between the normalize vector and the glvertex points.
a formula.
e.g
glvertex3f(x,y,z);
if x<0
xnorm=x+0.5
else
xnorm=x-0.5
end
If I'm not mistaken, a vertices's normal is the normalized sum of the surrounding triangles and A triangle's normal is the cross product of two of its edges.
Ex.
1 2 3 4 5 6 7 8 9 10
Triangle T1, T2, T3;
vec3 Edge1 = T1.vertex2 - T1.vertex1;
vec3 Edge2 = T1.vertex3 - T1.vertex1;
T1.normal = normalize( cross( Edge1, Edge2 ) );
// Repeat for other triangles
Vertex V1; //A common vertex between t1, t2, and t3
V1.normal = normalize( T1.normal + T2.normal + T3.normal );
The normal is a vector that is perpendicular to a surface. Niven's example shows you how to do it.
Normalize is an operation that converts a vector to a length of 1. It doesn't have much to so with the normal, except that you are supposed to normalize the normal.
I have always found the term "Normalise" very confusing. I would call a Normalised vector a "Unit Vector", at least that is what it was called when I studied it at University bleems ago.
Normalise has another meaning too: If you have a bunch of points around the Coords (7000000, 3000000) , then you can subtract this from all the points yielding much smaller values, which may even allow you to use a float instead of double, if that is required because you have billions of them to process, and resources are at a premium.