I have quite a few debug drawing methods in my engine that can generate geometry useful for debugging, like spheres and cubes.

At the moment I do not generate any normals for these shapes. Is there a general purpose method of generating face normals and per vertex normals for an arbitrary mesh? (I'd imagine you would need face normals to generate per vertex normals?)


To generate face normals, use the vector cross product of two edges each triangle and then normalise the result. Make sure you get the directions right, otherwise some normals will point in and some out.

Vertex normals would then be an interpolation of all the face normals the vertex is attached to.

  • \$\begingroup\$ You mean a normalized interpolation (or simply a normalized summation), presumably ;) \$\endgroup\$ – Andrew Russell Jul 30 '10 at 11:05
  • 3
    \$\begingroup\$ Always renormalize after summing! Even if you interpolated from normalized vectors, the result is NOT normalized! \$\endgroup\$ – Bob Somers Aug 1 '10 at 1:13

There are various ways of interpolating normals between faces. More details here: http://meshlabstuff.blogspot.com/2009/04/on-computation-of-vertex-normals.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.