1. Normals to triangles

I wish to construct normals to a surface from triangles. I have the triangulation and can calculate the normals based on the cross product of the edges. However there is an issue with direction. I wish all the normals to point say in the case of a sphere outwards. How do programmers in reality ensure that these normals are in the same direction....

2. Just be consistent with the direction you go around the triangle (clock-wise or counter clock-wise).

3. To be more specific: the cross product always give a right-handed system: if your thumb (on the right hand, of course!) goes along the first vector, and your index finger goes along the second, then the normal you get will be the direction the rest of your fingers point. This means that if you want to point outwards, you should go clockwise and to point inwards go counterclockwise.

4. Sure you say there there is clockwise and counter-clockwise. But given a face, and its verticies the decision over the edges is arbritary? There is no rule governing this per se?? since I just have face information??

5. Each graphics API has set conventions. In openGL for example, you can set which side is the face by using glFrontFace(). I think the default is counter clockwise (GL_CCW)

6. Most APIs default to CCW. Direct3D defaults to D3DCULL_CCW. All of my meshes use CCW. As long as you don't mix the winding order across meshes you will be ok. If you mix winding orders then your renderer is going to be a jumbled mess.

In essence the normals of sphere vertices are their normalized model coordinates. Since spheres are extensions of a simple unit sphere around 0,0,0 then you have vectors going from 0,0,0 to the vertex in question. Since a vertex is also a vector you could just normalize the vector created by the translation from 0,0,0 to the vertex position and use that as the normal. Since any value minus 0 is itself then it follows that the sphere vertex positions are just extensions of their normals. To further smooth the normals you can do normal averaging across the sphere. But for a sphere there is no need to create 2 edge vectors, cross them, and then normalize for each triangle in the sphere.