Skip to content

[Batch 4] Expand render distance presets + LOD tuning #385

@MichaelFisher1997

Description

@MichaelFisher1997

Summary

Add "Ultra" (256 chunks) and "Extreme" (512 chunks) render distance presets and tune LOD transition distances, fog curves, and mesh quality per LOD level for each preset.

Depends on: #381 (QEM LOD meshes — need good LOD quality before pushing further)

Current Presets

The settings system (settings/data.zig) has a render distance slider. LOD levels are defined in lod_chunk.zig with configurable radii. Current LOD extends to ~100 chunks max.

Target Presets

Preset LOD0 LOD1 LOD2 LOD3 Total Distance Target FPS
Low 8 16 16 chunks 120+
Medium 16 32 48 64 64 chunks 120+
High 16 32 64 100 100 chunks 60+
Ultra 16 32 64 256 256 chunks 60+
Extreme 16 32 128 512 512 chunks 30+

Per-Preset LOD Tuning

LOD0 (full detail):

  • Unchanged: full greedy mesh, all block types, AO, biome colors

LOD1 (2× simplified):

  • Target: 25% triangle count via QEM
  • Fog start: 50% of LOD1 radius
  • No cutout/transparent blocks (vegetation → solid green)

LOD2 (4× simplified):

  • Target: 12% triangle count via QEM
  • Fog start: 40% of LOD2 radius
  • No fluids, no cutout — everything rendered as solid
  • Reduced AO precision

LOD3 (8× simplified):

  • Target: 3% triangle count (~200 triangles per region)
  • Fog start: 30% of LOD3 radius
  • Heightmap-quality: single top-face color per column
  • No lighting — flat biome colors

Fog Curves

  • Exponential fog starting at configurable % of LOD radius
  • Fog color lerps from atmospheric scattering color to sky horizon color
  • LOD3 should fade smoothly into sky (no hard cutoff)
  • "Extreme" preset: LOD3 uses aggressive fog to mask low detail

Implementation Plan

Step 1: New preset definitions

  • Add "Ultra" and "Extreme" to settings choice list
  • Define LOD radii, fog parameters, and quality targets per preset
  • Store in render_settings.zig as typed config structs

Step 2: Expose LOD config in settings

  • Add LOD-related settings to settings/data.zig:
    • lod_cell_size: f32 (default per preset)
    • lod_propagation_distance: f32
    • fog_start_percent: f32 per LOD level
  • These appear in the graphics settings screen

Step 3: LOD distance tuning

  • LODConfig in lod_chunk.zig gets radii from current preset
  • LODManager reads config on preset change and recalculates
  • Ensure smooth transitions when render distance changes

Step 4: LOD quality degradation

  • LOD2: skip cutout/fluid passes, render vegetation as solid with biome color
  • LOD3: skip all lighting, use flat biome colors from BiomeColorProvider
  • These are mesh-time decisions in LODMesh build path

Step 5: Warning for Extreme preset

  • Show "WARNING: Extreme render distance may cause instability on GPUs with <8GB VRAM"
  • Detect VRAM via Vulkan device properties
  • Allow override via settings

Files to Modify

  • src/game/settings/data.zig — new presets, LOD settings fields
  • src/engine/graphics/render_settings.zig — preset definitions
  • src/world/lod_chunk.zigLODConfig updated with new radii
  • src/world/lod_manager.zig — read config, recalculate
  • src/world/lod_mesh.zig — quality degradation per LOD level
  • src/game/screens/graphics.zig — show new presets, LOD settings

Testing

  • Each preset loads and renders without crashes
  • LOD transitions are smooth (no popping visible from camera)
  • Fog hides LOD transitions naturally
  • VRAM usage stays within bounds for each preset
  • "Ultra" runs at 60+ FPS on RTX 3060 at 256 chunks
  • Extreme preset shows warning on low-VRAM devices

Roadmap: docs/PERFORMANCE_ROADMAP.md — Batch 4, Issue 3C

Metadata

Metadata

Assignees

No one assigned

    Labels

    batch-4Batch 4: Advanced GPUbugSomething isn't workingdocumentationImprovements or additions to documentationengineenhancementNew feature or requestgamehotfixquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions