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

Here is a picture of a lovely polygon:

Box of awesome

Circled is a vertex, and numbered are its adjacent faces. I have calculated the normals of those faces as such (not yet normalized, 0-indexed):

Vertex 1 normal 0:   0.000000   0.000000    -0.250000
Vertex 1 normal 1:   0.000000   0.000000    -0.250000
Vertex 1 normal 2:  -0.250000   0.000000     0.000000
Vertex 1 normal 3:  -0.250000   0.000000     0.000000
Vertex 1 normal 4:   0.250000   0.000000     0.000000

What I'm wondering is, how can I determine, taken as given that I want this vertex to represent a hard edge, whether its normal should be the normal of 1/2 or 3/4? My plan after I glanced at the sketch I used to put this together was "Ha! I'll just use whichever two faces have the same normal!" and now I see that there are two sets of two faces for which this is true.

Is there a rule I can apply based on the face winding, angle of the adjacent edges, moon phase, coin flip, to consistently choose a normal direction for this box?

For the record, all of the other polygons I plan to use will have their normals dictated in Maya, but after encountering this problem, it made me really curious.

share|improve this question
up vote 9 down vote accepted

You'll need to duplicate the normal for the corner N times (where N is the number of "sides" it is shared amongst). If you try to use one value for all "sides," you'll end up averaging it, and your lighting will not appear to have that hard edge that you're looking for.

share|improve this answer
So presuming I was using OpenGL indexed vertices, because I am, you're saying I couldn't use this vertex for all five of these triangles, I'd have to duplicate it for 1/2, 3/4, and 5? – user14497 Mar 23 '12 at 3:11
You can use the same vertex for all 5 triangles it touches; you'll just use the same index to point to it where appropriate. Since the 5 triangles in question need 3 different normals, you'll have to have 3 different normals and use the correct indices for them. However, the vertices involved with triangles 1 and 2 all share the same normal. In fact, for your rectangular prism, you'll only need 6 different normals. – stephelton Mar 23 '12 at 3:15
Woah! I don't know why, but having multiple normals per vertex hadn't even occurred to me. Thanks! – user14497 Mar 23 '12 at 3:24
Glad to help! Hint: you probably need 8 vertices and 6 normals. And probably 4, 8, or 24 tex coords... – stephelton Mar 23 '12 at 3:27

Your Answer


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