FAQ: When I turn on back face culling, why are the front faces culled?

When I create a cube and insert the vertices in a left-handed orientation like this:

cube

And I set polygon handedness to right using:

mySegmentKey.GetDrawingAttributeControl().SetPolygonHandedness(HPS::Drawing::Handedness::Right);

And then I set back face culling like this:

mySegmentKey.GetCullingControl().SetBackFace( true );"

I get this rendering:

The [documentation for SetPolygonHandedness](HPS::DrawingAttributeKit Class Reference) says this:

If you wrap the fingers of the chosen hand along the vertices of the polygon, with your wrist at the first vertex and your fingertips at the last, then extend your thumb perpendicular to your fingers, your thumb is extending out of the front face of the polygon.

Based on the way the vertices above were inserted and using the right-hand rule, I would expect the normals for the faces to point into the cube and the outside faces of the cube to be the back faces and thus culled. If I set polygon handedness to left:

mySegmentKey.GetDrawingAttributeControl().SetPolygonHandedness(HPS::Drawing::Handedness::Left);

I get this image (which is the opposite of what I would expect):

Answer

The issue is that the above image showing the order that the vertices were inserted is a right-hand oriented world coordinate system. By default, HOOPS Visualize assumes a left-hand oriented world coordinate system. If you insert using right-hand coordinates and do not change the World handedness, you will get the exact opposite results from what you are expecting. There are two options:

  1. Set the handedness to the opposite of what it actually is
  2. Change the world handedness