I have a terrain (heightmap) and the standard OGL lighting in place. It works fine, but now I want to switch away from using face normals and start to use vertex normals (I believe that's how the "better" ones are called, right?). I am talking about the normals, that will actually give a blurred look, and not this flat, blocky look:

I do use this function to calculate my face normals:

void get_face_normal ( float *norm, float pointa[3], float pointb[3], float pointc[3] ) // gets the normal of a face { float vect[2][3]; int a,b; float point[3][3]; for ( a = 0; a < 3; ++a ) // copies points into point[][] { point[0][a]=pointa[a]; point[1][a]=pointb[a]; point[2][a]=pointc[a]; } for ( a = 0; a < 2; ++a ) // calculates vectors from point[0] to point[1] { for ( b = 0; b < 3; ++b ) // and point[0] to point[2] { vect[a][b] = point[2-a][b] - point[0][b]; } } // calculates vector at 90° to 2 vectors cross_product ( norm, vect[0], vect[1] ); // makes the vector length 1 normalize ( norm ); }

Now how would I best move on to using those vertex normals? I know that I'll have three normals for one polygon then and that I somehow need to average something, but nothing more. Heck, I don't even know if "vertex normals" is the correct word...

Any help/links to articles would be great!

[Edited by - d h k on November 6, 2005 10:49:00 AM]