In order to determine if a face is a “back” face:

  • get the normal of the face
  • get the direction of the camera
  • get the dot product of the above 2 vectors
  • if the dot product is positive, it means the two vectors (camera and normal) are facing the same direction, thus the face is a “back” face

In order to define the “back” faces of a model, you must first define relative to what they “back” to. When rendering, this “relative to what” is the camera direction. A face of the model is considered to be a “back” face if it faces the same direction as the camera. If a face faces the opposite direction of the camera, it is considered to be a “front” face.

When rendering, you often want to find out if a face is a “back” face, and if so, you want to not draw it. This is called “backface culling”.

In order to determine if a face is a “back” face:

  • get the normal of the face (just the cross product of any 2 edges of the face)
  • get the direction of the camera
  • get the dot product of the above 2 vectors
  • if the dot product is negative, the two vectors are facing away, else they are facing in the same direction. If the dot product is 0, they are perpendicular
  • thus if the dot product is positive, both the camera vector and the normal of the face are facing the same direction, thus the face is a “back” face

One thing you have to watch out for is when your model is created/defined, the vertices of each face must be defined in a consistent matter. Either they should all be defined in a clockwise winding order or a counter-clockwise winding order. In either case, the normals of the faces should be facing outwards from the model.