Repository navigation
cvc/geometry: native (VTK-free) QEM mesh simplifier (cvc::simplify) - #483
Merged
Merged
Conversation
The mesh-decimation foundation for the LOD pyramid. cvc::lod::select ships the selection math but "nothing here streams, caches, evicts, decimates or draws"; the only triangle reducer in the tree is vtkQuadricDecimation inlined in the nav demos, which lives above the "no VTK" line and so is unavailable to pycvc, headless bake tools, and wasm. This adds a hermetic Quadric Error Metrics decimator: rung 0 is the full mesh, coarser rungs are simplify()'d copies whose MEASURED world-space error feeds cvc::lod's world_error_m ladder directly. Half-edge collapse (snap the higher-error endpoint onto the lower-error one), so surviving vertices never move and keep their exact position/uv/color — robust (no optimal-placement solve or singular fallbacks), attribute-safe across uv seams, and a good fit for the feature-aligned architectural meshes it first targets (Austin buildings, Humvee). Per-vertex Garland-Heckbert quadrics; boundary edges add a perpendicular constraint plane so open borders hold; fold-overs are rejected by a per-face normal-flip test. Stops on a triangle target or an error budget, whichever binds. The embarrassingly-parallel setup (per-face plane quadrics + per-vertex quadric gather) fans over the app compute pool (mesh.ctx().computePool()); the greedy collapse loop is serial. The scatter is refactored into two data-parallel gathers via the vertex->face adjacency, so the pooled result is BIT-IDENTICAL to serial (asserted by the test). Gate cvc_geometry_simplify_test: flat sheet -> ~zero error + hard decimation; curved sheet reduces without NaNs/degenerate faces/count growth; bounding box + boundary preserved; pooled == serial bit-for-bit; error-budget early stop; empty and over-target no-ops. First of the LOD-pyramid series (next: cvc::lod::pyramid_builder for mesh/volume/ image rungs, the scene.cvch5 HDF5 store, and the scene-renderer LodGraphicsNode).
This was referenced Sep 30, 2026
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.
Why
The mesh-decimation foundation for auto LOD pyramids.
cvc::lod::selectships the selection math but is explicit that "nothing here streams, caches, evicts, decimates or draws." The only triangle reducer in the tree isvtkQuadricDecimationinlined intonav_city_drive/nav_city_swarm, which sits above the "no VTK" line — so it's unavailable to pycvc, headless bake tools, and wasm. This adds the hermetic decimator those need.What
cvc::simplify(mesh, params, &result, pool)— Quadric Error Metrics half-edge collapse:target_tris/target_ratio) or an error budget (max_error), whichever binds, and reports a measured world-space error per rung — which feedscvc::lod::world_error_for_switch_radiusdirectly.Parallelism
The embarrassingly-parallel setup — per-face plane quadrics and the per-vertex quadric gather — fans over the app compute pool (
mesh.ctx().computePool()); the greedy collapse loop is inherently serial. The natural scatter is refactored into two data-parallel gathers via the vertex→face adjacency, so the pooled result is bit-identical to serial (asserted).Test —
cvc_geometry_simplify_test(7 cases, all green)Flat sheet → ~zero error + hard decimation; curved sheet reduces with no NaNs / degenerate faces / count growth; bounding box + boundary preserved; pooled == serial bit-for-bit; error-budget early stop; empty + over-target no-ops.
Series
First of the LOD-pyramid work. Next:
cvc::lod::pyramid_builder(mesh via this, volume viavol_downsample/voxels::resize, image via a new quality downsampler), the per-bundlescene.cvch5HDF5 store (defining the reserved/cvc/geometryschema + alod_index), and the scene-rendererLodGraphicsNode+ per-frame rung selection. Design summary in the linked discussion.