I have a problem that a lot of the free 3d meshes I am using for demonstrations are generated with mixed winding order on the triangles.
So when I render them half the triangles disappear.
I have tried writing some code that calculates a face normal for each triangle and compares it to the vertex normals, if the angle between the face normal and the vertex normals is greater than 90 degrees, I flip the winding order.
This seems to work for objects that are supplied with vertex normals, but some of the objects I want to use don't have vertex normals.
I am struggling to come up with an alternative technique for this case.
The best I can come up with at the moment is to calculate the centre of the object, throw a ray through each vertex and compare the direction of this ray with the face normal, but that only works for some objects.
Out of ideas, anyone got anything?