LOD system (automatic mesh LOD + LODGroup component)
Motivation
LOD is a fundamental performance tool for any scene with more than a handful of unique meshes. Without it, large environments are off the table for AAA-scale projects.
Goal
An automatic LOD generation pipeline and a runtime LODGroup component that switches mesh detail based on camera distance — matching Godot's GeometryInstance3D LOD or Unity's LODGroup component.
Tasks
Asset pipeline
-
LODGroupimport setting on mesh assets: auto-generate N LOD levels at import (simplify via meshoptimizer or similar) - Manual LOD assignment: drag different mesh assets per LOD level in the Inspector
- LOD metadata stored in
.metaand cached in theAssetCache
Runtime component
-
LODGroupComponent: list of (mesh, distance-threshold) pairs; activates the closest matching LOD mesh each frame - Distance computed from main camera transform; supports per-component LOD bias
- Integration with
MeshRendererComponent(swap mesh, not spawn/destroy GameObjects) - Screen-size-based LOD selection as an alternative mode
Editor
- LODGroup Inspector: preview each LOD level + distance slider
- Viewport overlay: colour-code objects by current LOD level
Culling
- Zero-polygon LOD level = culled (no draw call) — integrate with the frustum culling path
Acceptance Criteria
- A mesh with 4 LOD levels switches visibly as the camera moves away.
- Auto-generated LODs reduce polygon count by ≥50% per level.
- LOD culling level produces zero draw calls.
- No per-frame allocation from LOD switching.
Related
- #8 (closed) (glTF import pipeline), #3 (closed) (gizmos show LOD distances), profiler #35 (closed) (draw-call counter reflects LOD savings).
Edited by Bruno Massa