From 0e2a62d3b704aab8af39d7b7210219b385e06b3b Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 12 Apr 2026 22:06:58 +1000 Subject: [PATCH] Enable reorient-shells in geometry iterator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IFC files routinely have IfcConnectedFaceSets whose faces point inconsistently within the same shell — the result under per-vertex normals is dark inside-out patches, and under GL_CULL_FACE it's swiss-cheese. reorient-shells fixes the face winding at geometry generation time, which is the only place it can be fixed correctly; no shader trick can recover from a mesh whose triangles disagree among themselves. Off by default in IfcOpenShell because it adds iterator time, but we cache the result in the sidecar so it's a one-shot cost per file. Co-Authored-By: Claude Opus 4.6 --- src/ifcviewer/GeometryStreamer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ifcviewer/GeometryStreamer.cpp b/src/ifcviewer/GeometryStreamer.cpp index 226fb0808c..d3edcce19f 100644 --- a/src/ifcviewer/GeometryStreamer.cpp +++ b/src/ifcviewer/GeometryStreamer.cpp @@ -270,6 +270,11 @@ void GeometryStreamer::run(const std::string& path, int num_threads) { settings.set("use-world-coords", false); settings.set("weld-vertices", false); settings.set("apply-default-materials", true); + // Off by default in IfcOpenShell — makes face winding consistent within + // each shell, which we need for GL_CULL_FACE and for per-vertex normals + // to shade a solid without dark inside-out patches. Costs some iterator + // time, but results are cached in the sidecar so it's a one-shot hit. + settings.set("reorient-shells", true); std::unique_ptr iterator; try {