PDA

View Full Version : normal averaging



Julio
06-15-2003, 07:15 AM
hi,
for a water mesh, what is the proper way to average normals to make the surface look smooth? I have glShadeModel(GL_SMOOTH); enable, I'm using triangle strips, and I'm currently calculating the normal for each triangle. the term normal averaging has come up, but I'm not exactly sure what this entails.
thanks,
Joe

Julio
06-15-2003, 11:20 AM
nevermind, I think I got it working.

peter.vullings
06-15-2003, 03:16 PM
If you havent got it yet:

Only specifiying face normals doesnt give the smoothest effect. For the smoothest effect you should specifiy a vertex normal for each 'corner'.

A vertex normal is calculated by averaging all the face normals that share that vertex as one of their 'corners'.

To average a bunch of normals, simply add them together and then normalise the result. Adding vectors (a normal is a vector) goes as follows:

v1= x1,y1,z1
v2= x2,y1,z1

v3= x1+x2,y1+y2,z1+z2

Hope someone finds this useful (and I hope its correct!)

Julio
06-16-2003, 12:05 PM
thanks, I'll have to give it a try. so to clarify what you're saying; you take the average of the three face normals that are touching the vertex, and to do this for each vertex?