0

I'm not completely solid on how triangle strips work with normals. I want to make a flat shaded cube so I wrote vertices for a triangle strip that make a cube. That works. I made a cube using a triangle strip. The thing is that I set the normals of each vertex as the opposite direction of the center of the cube. So the shading is all weird. I want each side to be a flat color. Any idea how I can set the normals to achieve this?

Jehanlos
  • 77
  • 1
  • 8

1 Answers1

1

So, you have normals pointing out from the center of the cube, in a circular fashion?

 \_/
-|_|-
 / \

Is this how it looks?

Is the goal something like this?

  L
-| |-
  T

If that is the case, you could just check which normals your normals are closes too, then change them into the closest normal.

distance = sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z2)^2)
Alexander
  • 9,737
  • 4
  • 53
  • 59
  • Thanks! I'm not sure I want to do sqrt so many times; but that seems like it would work. I think the difficulty was that since it was triangle strip, the faces of the cube had to share vertices; so I had to make the normals for the vertices outward like that. – Jehanlos Dec 07 '12 at 15:30
  • If you don't want to use sqrt, you can just do the distance calculations without it. It won't be the actual distance, but it will be good enough for comparing which vectors are closest to each other. – Alexander Dec 09 '12 at 21:53