Add distance-based terrain LOD system#78
Merged
brendancol merged 4 commits intomasterfrom Mar 6, 2026
Merged
Conversation
Implement terrain level-of-detail with per-tile resolution control: - TerrainLODManager divides terrain into tiles, assigns LOD levels based on camera distance, and builds separate GAS per tile - LOD levels: 0 (full res), 1 (2x subsample), 2 (4x), 3 (8x) - Tile edge skirts hide T-junction cracks between different LOD levels - Toggle with Shift+A keybinding in interactive viewer - Integrates with existing R/Shift+R resolution and Z/Shift+Z VE controls - Core LOD utilities (compute_lod_level, simplify_mesh, build_lod_chain) in rtxpy/lod.py for terrain and instanced geometry LOD
28 tests covering: - compute_lod_level distance-to-LOD mapping (boundary, edge cases) - compute_lod_distances threshold generation - simplify_mesh quadric decimation - build_lod_chain progressive simplification - TerrainLODManager tile creation, LOD assignment, VE, cache invalidation - Tile helper functions and skirt geometry
- Add LOD utilities section to api-reference.md - Add Shift+A keybinding to user-guide.md keyboard controls - Add terrain LOD tip to performance section
Script generates synthetic terrain and launches the viewer with instructions to toggle LOD via Shift+A. Supports xarray-spatial Perlin noise or falls back to sine-based terrain.
This was referenced Mar 6, 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.
Closes #74 (terrain LOD portion)
Summary
Terrain LOD from the roadmap (#74). Splits terrain into tiles, picks resolution per tile based on camera distance. Nearby tiles stay full-res, distant tiles get subsampled.
What's included
rtxpy/lod.py— LOD utilities:compute_lod_level(),compute_lod_distances(),simplify_mesh()(quadric decimation),build_lod_chain()(progressive simplification)rtxpy/viewer/terrain_lod.py—TerrainLODManager: tiles the terrain, assigns LOD per tile (0=full, 1=2x, 2=4x, 3=8x subsample), builds a separate GAS per tile, adds edge skirts to cover T-junction cracksNot included (future work per #74)
Test plan
pytest rtxpy/tests/test_lod.py)examples/terrain_lod_demo.py, press Shift+A, check tiles render at varying resolution