Repository navigation
generated_world: terrain LOD, chunks of the ground's own samples with skirts - #1001
Merged
Merged
Conversation
… skirts The ground was one mesh drawn whole (8.4 M triangles on an 11.2 km world). cvc::world::terrain_lod cuts it into chunks of 64 cells (doubled to at most 16 across), each a ladder of strides 1, 2, 4, ... whose vertices are the terrain's own samples (rung 0 is its mesh exactly), with each rung's measured height error and skirts on the edges a neighbour shares. world_builder builds them in a new "lod" stage. The generated_world node draws them as LodGraphicsNode children of the terrain node, which keeps the one texture they share (GeometryNode::shareTexture) and draws nothing itself; each frame a chunk chooses its rung by screen error and is held within one rung of its neighbours. apply_mesh_keys gives the rungs the node's casts_shadow, shader and material keys.
transfix
force-pushed
the
perf/terrain-lod
branch
from
November 3, 2026 15:08
894ee8f to
074ed33
Compare
transfix
enabled auto-merge (squash)
November 3, 2026 15:08
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.
The terrain lab's ground was one mesh drawn whole: 8.4 M triangles on an 11.2 km world (2049^2 samples), 2.2 M on a 5.3 km one, whatever the camera saw. This draws it with chunked LOD and skirts, section 8.4 of the L-system laboratory roadmap.
Follows #994 (tree LOD, merged); rebased onto master after it.
cvc::world::terrain_lod(new,inc/cvc/world/terrain_lod.h)plan_terrain_chunks: chunks of 64 cells a side, doubled until at most 16 span the world. Rungs are strides 1, 2, 4, ... down to 4 cells a side, so a 64-cell chunk has 5 rungs and a 128-cell chunk has 6.make_terrain_chunk:error_m[k]is rung k's largest vertical distance from the samples it skips, measured with the mesh's own diagonal split.constrain_terrain_rungsrefines chunks until none is more than a rung off a neighbour, which is what the skirts are deep enough for.generated_worldterrain_layoutandterrain_chunks.world_buildergains alodstage that builds whole chunks per step. Natively they build in parallel; on wasm the stage is sliced like the others.The
generated_worldnodeLodGraphicsNodeper chunk.error_m(cvc::lod::select_rung, with hysteresis), then the picks are constrained.GeometryNode::shareTexturegives every rung the node's onevtkTexture, so the GPU holds one copy. A repaint shares the new one.apply_mesh_keys(public inscene_realize.h, now used by the realize tail too) gives each rung the node'scasts_shadow,shader:andmaterial:. Soterrain_bumpandopaque: truestill apply to the ground.ground:still read the fullheight_field.Measured natively, terrain only, balanced preset, 720 px view (
terraincostharness):Tests
world_generated_test:error_m.cvcgl_ariadne_realize:casts_shadow: false, and an empty terrain node.Not done here: a browser measurement (after the deploy), and morphing between rungs (CDLOD, deferred by the roadmap). Cards past 1.6 km are still to do on the tree side.