Vertice Normal

Hey,

I have the face normals for a series of triangles which compose a triangle mesh in a terrain program I have written.
Since I am passing the triangle’s face normal once for each of its three vertices the triangles stand out when light is placed upon it.

I tried this method of smoothing the lighting effect.
I found all the triangles sharing a particular vertex and calculated the average between the face normals and assigned that value to the vertex’s normal. I repeated that process for all the vertices. The result was that the lighting was too smooth and practically no detail can be seen.

I wanted to know if there is a better method of producing smoother lighting with out having individual triangles ‘standing out’ or having all details disappear.

A few suggestions…

Are you using OpenGL’s lighting? - you may be able to change the type of lighting equation used, but I’m not sure on that one.

Otherwise, you’ll need to use your own lighting, and control the brightness through the colour you’re passing in for each vertex - this may require that you change your texturing from, for examle, DECAL to MODULATE

Or, again in the context of DIY, you could use a fragment program. if your card supports them…

The lighting equation is not at issue.
He just needs to tweak the normals a bit to get something you like.

I’m assuming he is averaging face normal. Instead of simple averaging, you can use blending weights.

example :
vertex_normal = face_normal_1 *50% + face_normal_2 *25% + face_normal_3 *25%;

so 50%, 25%, 25% are the blending weights.

This is just an example when a vertex has 3 faces sharing it.

If you can use a cube map for the diffuse light, for example, you can turn this problem on its head. Instead of varying the normals, vary the light in the cube map to achieve different effects. Think of the cube map as a function of direction, f(normal), and there are all kind of possibilities.

I found it to be quite useful to take the area of each adjacent triangle into account, and gosh, thats only 3 crossproducts and vector lenghts and divides! Then take the bigger triangle’s normal more into account.