Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?)

share|improve this question
up vote 10 down vote accepted

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.

share|improve this answer
You mean a normalized interpolation (or simply a normalized summation), presumably ;) – Andrew Russell Jul 30 '10 at 11:05
Always renormalize after summing! Even if you interpolated from normalized vectors, the result is NOT normalized! – Bob Somers Aug 1 '10 at 1:13
Thanks for that, sounds simple enough. – Cubed2D Aug 2 '10 at 10:18

There are various ways of interpolating normals between faces. More details here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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