Repository navigation
generated_world: tree and rock LOD, each rung the same full tree coarser - #994
Merged
Merged
Conversation
The terrain lab drew its props as one merged mesh: 771,994 triangles of branch tubes for 403 trees plus 149,481 needle lines, the GPU's largest single cost on the deployed page (skipping it took 29 fps to 51). - cvc::lsys::tree_detail and grow_pine / grow_branchy overloads draw the same tree (maturity, skeleton, jitter, size) coarser: n-sided uncapped tubes, tubes under min_radius left out, and the leaves as solids (a pine leaf a 4-triangle cone of its needles' shape, a broadleaf fork's leaf twigs one blob narrowed to the twigs' side-on area). - generate_world lays the props down a 128 m cell at a time (prop_cells: each cell a contiguous run of every mesh) and adds props_r1 (the tree_detail rung: 36% of the triangles, no lines) and props_r2 (a trunk and a crown per tree, a box per rock: 1.1%). A broadleaf's crown takes the full tree's area-weighted colour and covers what its limbs do. prop_span_mesh cuts a cell's run out of a mesh. - The generated_world node draws each cell as a LodGraphicsNode ladder under <id>_props / _foliage / _needles and selects it every frame with cvc::lod (rung 1 from 260 m, rung 2 from 700 m, the roadmap's vegetation bands, scaled by the quality preset); a cell's leaves and needles follow its wood, and a rung change re-bakes the shadows. Tests: LsysForest.TreeDetailIsTheSameTreeCoarser, WorldGenerated.PropCellsAreTheFullTreesCoarsened, the stepped build compares the new meshes, and cvcgl_ariadne_realize checks the ladders and that a near camera draws rung 0 and a far one a coarser rung.
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 deployed terrain lab spends most of its GPU time on the trees. Hooking WebGL in the live page (Intel Arc, 1.2 km world) found one merged mesh,
world_props: 771,994 triangles of branch tubes for 403 trees, plus 149,481 needle lines. Skipping that one draw took the lab from 29 fps to 51.This adds LOD for the trees and rocks. Every rung is the same full-maturity tree: same skeleton, jitter, size and height. Only the tessellation gets coarser with distance.
What changes
cvc::lsys::tree_detail, withgrow_pine/grow_branchyoverloads that take it. It draws the same tree:ring-sided uncapped tubes;min_radiusleft out;generate_worldlays the props down one 128 m ground cell at a time (at most 12 cells a side).prop_cellsrecords each cell's contiguous run of every mesh.prop_span_meshcuts a run out of a mesh.props_r1is rung 1 (tree_detail: 3-sided tubes, none under 5 cm, leaves as solids).props_r2is rung 2: each tree's trunk plus a crown over its full canopy, and a box per rock.props,foliageandneedlesstay as they were (rung 0), sogeometry()and physics and nav are unchanged.generated_worldnode draws each cell as aLodGraphicsNodeladder under<id>_props,<id>_foliageand<id>_needles.cvc::lodscreen error. Rung 1 starts at 260 m and rung 2 at 700 m, the vegetation bands of LSYSTEM-LABORATORY-ROADMAP §8.4, authored against the reference view so the quality preset scales them. The wasm build uses the aggressive preset, like the room view.Measured
Mesh sizes for terrain_lab's default world (seed 5, 1.2 km, 500 trees):
The props sit in 96 cells; the largest has 21.5k rung-0 triangles.
Per tree,
tree_detail{ring 3, min_radius 0.05}cuts the triangle count to under half of the full tree's, with the same extent and height (TreeDetailIsTheSameTreeCoarser).A native
arigl snapshotof terrain_lab at its default view, compared before and after: the overview, where most cells are on rung 2, keeps the full trees' look. The crowns match the tree's colour mix and coverage.Not measured yet: the browser frame rate. That's the deploy after this merges.
Tests
LsysForest.TreeDetailIsTheSameTreeCoarser: pines of maturity 2–4 and a branchy tree. The coarse tree has the full tree's extent within 15% (height within 5%), less than half the triangles, no needle lines, and leaves in the leaf colour.WorldGenerated.PropCellsAreTheFullTreesCoarsened:SteppedBuildIsTheSameWorldalso comparesprops_r1,props_r2andprop_cells.cvcgl_ariadne_realize: the props are three-rung ladders; a close camera draws rung 0 and one 5 km off draws a coarser rung (153 checks pass).World|Lsys|Lod|lod|Ariadne|ariadne|Road|NavTerrain|Sites|world|road: 1,103 of 1,103 pass on Windows Release (some skipped).Still to do