Caffeine

Mesh LOD

Reference Namespace: `Caffeine::Render`, `Caffeine::Assets::MeshLOD` Last verified: Source: render/GpuSceneRenderer.cpp

How GpuSceneRenderer swaps a mesh for a clustered LOD as it moves away from the camera, and where terrain LOD is handled instead.

Meshes with at least 600 indices get two clustered LODs (Rossignac vertex clustering, Assets::MeshLOD::buildClusteredLod) in GpuSceneRenderer. The source mesh is never rewritten.

Distance (world units ÷ largest entity scale) LOD
< 120 original
120–350 cell = 3% of the AABB diagonal
> 350 cell = 8% of the AABB diagonal

The swap uses 12% hysteresis so it does not oscillate at the border. Terrain stays in TerrainLodSystem.

GPU instancing exists: CommandBuffer::drawIndexedInstanced and the forward Instancing feature (on by default, up to 256 draws per batch; see forward-render-features.md). Coarse occlusion culling is optional and off by default (Render::OcclusionMode); frustum culling is always on.