Fix inverted-exterior duplicate triangles in Corset model#279
Open
bghgary wants to merge 1 commit into
Open
Conversation
The Corset mesh contained 3,490 triangles whose face normals pointed radially inward, coincident with properly outward-facing triangles at the same outer-surface position. Rasterizers hid these via backface culling, but path tracers (which don't cull during BVH traversal and fire shadow rays directly) produced phantom shadow patches and shading artifacts — e.g., the dark diamond on the upper-right chest reported in KhronosGroup#278. Removed the offending triangles from glTF/Corset.bin (indices accessor count and bufferView byteLength updated accordingly) and regenerated the glTF-Binary and glTF-Draco variants from the fixed glTF using gltf-pipeline. All three variants pass the Khronos glTF Validator. Closes KhronosGroup#278 [Created by Copilot on behalf of @bghgary] Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The Corset model contains a large number of "inverted-exterior duplicate" triangles — triangles whose vertex positions lie on the model's outer surface, but whose face normals point inward (toward the model's central axis), coincident with properly outward-facing triangles right next to them. Most rasterizing viewers hide these via backface culling and z-fight resolution, so they have been invisible in tools like the Babylon Sandbox, model-viewer, and the Khronos Sample Viewer's rasterizer mode.
Path tracers don't cull during BVH traversal, and they fire shadow rays directly through the BVH. The phantom interior surfaces win the BVH-traversal coin flip on some pixels (corrupting shading, since the surface gets classified as back-facing) and intercept shadow rays cast from properly-lit points (producing phantom shadows). Issue #278 reported one example of the latter: a hard dark patch on the upper-right chest in
vk_gltf_renderer's path tracer.Root cause
For a representative example, glTF triangles 7520 and 7521 form a single source-FBX quad (
Models/Corset/sourceModels/Corset.fbxpolygon#3798, vertices[3956, 3860, 3864, 3955]). Both triangles' positions sit on the proper outer surface, but their face normals point inward and their vertex normals were authored to match (so winding-only checks don't flag them). They duplicate the exterior surface tri-for-tri, just with the winding reversed.Surveying the whole mesh, 3,490 triangles match this pattern (face normal points radially inward, and a properly-oriented outward-facing triangle exists at the same radius within ≤2 mm). That's roughly 19% of the mesh's 18,324 triangles. The remaining inward-facing triangles (~30) sit at smaller radius than the outer shell and are legitimate inner-liner geometry; they were preserved.
Fix
Removed the 3,490 inverted-exterior duplicate triangles from the index buffer. The proper outward-facing triangles already cover the model surface, so removal does not leave holes. All three variants were regenerated:
Corset/glTF/Corset.binCorset/glTF/Corset.gltf54972 → 44502, bufferView byteLength109944 → 89004, buffer byteLength662184 → 641244Corset/glTF-Binary/Corset.glbgltf-pipelineCorset/glTF-Draco/Corset.bingltf-pipeline -d --separateThe
glTF-BinaryandglTF-Dracovariants were regenerated usinggltf-pipeline— the same tool the upstream Corset Draco file was originally encoded with (seeKhronosGroup/glTF-Sample-Models@7f3cd41). The Draco bitstream version (2.2) and encoder method (edgebreaker) are byte-identical between the upstream and regenerated files; only the compressed payload differs.Verification
Errors: 0, Warnings: 0).Source FBX
The same inverted-exterior duplicates exist in
glTF-Sample-Models/sourceModels/Corset/Corset.fbx. Updating the source FBX is outside the scope of this PR; this fix only touches the glTF-format derivatives.Closes #278
[Created by Copilot on behalf of @bghgary]