PDA

View Full Version : Vertex Normal



Asif Haroon Memon
10-30-2004, 09:57 PM
hi i have generated a fractal terrain using diamond square algorithm and i am specifying normals for each vertex as glNormal3f(0,1,0) it works somehow but it isn't that good can someone help me how to calculate normal for each vertex.

mikael_aronsson
11-01-2004, 03:54 AM
Hi !
use 0,1,0 for the normals can't look very good, the easiest thing is to calculate the surface normal and use the for each triangle, use the cross product (google will get loads of hits).

To get more fancy normals you would calculate the avarage of the vertices, this is a little more tricky but not a bug problem.

You can do it yourself or use some library to do it for you, Graphics Gems has a good example of how to do it including fuzzy normals and limit the "smoothing" to only vertices with angle < x.

Mikael