Hello,
Following on from getting my simplistic software 3D renderer up and running, I would like to implement backface culling to limit what polygons have to be rendered.
I understand that essentially you calculate the surface normal (dot product) of each polygon and discard if it is pointing away from the camera/eye. However, I can also see that there are two possible surface normals for each planar polygon. These are opposites, so that one will be pointing towards the camera and the other away.
Most culling algorithms establish a convention whereby depending on the order in which the vertices are specified (clockwise or anti-clockwise), the surface normal is selected. This works fine in the majority of cases, especially where you have control over the input polygons.
As the input for my program is a text file, and the person writing it may not be aware of the convention to be used for the correct surface normal to be selected, is there another way of determining this?
I think that in the case of a closed 3D shape, you should be able to determine the interior and exterior surfaces. This would be computationally expensive but would resolve the ambiguity without fuss.
In the case of something specified as a volumeless mesh (not closed)... I'm not sure. I don't think you can apply culling if you can't guarantee a convention?
My head hurts.