You can see in the archicad 3D view that there's some sort of shading discontinuity in the corners of the tub. And when I export these sections, the polygons are in the wrong winding order, which makes the viewer cull the polygons that I should see, and draws the polygons that should be hidden.
These objects are GDL objects, and procedurally defined (eg: sections made of panels, cylinders, etc) and to say that the GDL language is opaque would be an understatement.
Anyway, I really, really want to avoid making all objects in the scene double-sided geometry (eg: disable backface culling) as this would really kill performance.
If I could somehow detect which polygons are in the wrong winding order, I could simply reverse the vertex order and everything would be fine.
So far, I've detected this issue with the clock (digits and arrows), toilets (the base), the bathtub (corners), and a couple of others objects. Seems like every other object has such a problem -- don't have to search far to find such polygon ordering issues.
Any ideas how I can either detect and/or fix this at export time?
The classical way of detecting this is to check if shared edges (sharing two vertices) are in the same order (eg: poly #1 has an edge from vertex A-B, and the neighbor polygon should have an edge from B-A, but if both have a shared edge from A-B, then one of the two polys is in the wrong order. However, I still can't know which polygon has the incorrect order.
I don't think that there is a way to detect incorrect winding order. Generally if the model is solid than the winding order is set properly. I think that the best you can do is to use double-sided polygons for surface bodies. You can detect it by the IsSurfaceBody call on the MeshBody.
Well, that worked, but not only did I have to duplicate all triangles, but also vertices, since I've had to invert the normals as well. Talk about yuck and doubling the weight of the geometry in the 3D engine...