Sorry in advance for asking something that has probably been asked many times before.
I can’t seem to get the code right for generating normals from vertex info…
Please could somebody post a snippet of code for generating vertex normals.
Thanks
Matt
ok. let’s say a triangle is composed of vertices v0, v1 and v2 in a counter-clockwise order. make 2 vectors: vec1 = (v1 - v0) and vec2 = (v2 - v0). now take the cross product: vec1 X vec2. normalize the resultant vector (divide each component by the vector’s length) and you have your normal!
b
[This message has been edited by coredump (edited 09-11-2002).]