Project Overview
This project explores real-time procedural terrain generation capable of supporting caves,
overhangs, and variable level-of-detail (LOD), which is a combination not well supported by
common real-time terrain solutions. Most existing approaches rely on single-resolution grids,
making them unsuitable for large-scale environments such as planets.
The goal of this research was to investigate a GPU-driven approach that could scale terrain detail
dynamically based on distance from the camera, enabling large, seamless planetary terrain suitable
for real-time gameplay.
Problem Statement
Popular real-time terrain generation algorithms, like Marching Cubes, that support volumetric features
(such as caves and overhangs) typically operate on uniform-resolution grids, preventing detail from
falling off with distance. This severely limits scalability for large environments.
This project investigates an approach that supports variable LOD while maintaining real-time performance,
with the long-term goal of enabling procedural planet generation.
System Scope & Intent
- Research-focused prototype developed as an extended academic assignment
- Designed for real-time generation and editing, not offline baking
- Intended as a foundation for a future game project involving large procedural planets
- Emphasis on architectural feasibility and performance over content completeness
High-Level Architecture
The terrain generation pipeline is entirely GPU-driven after initial setup:
1. Hermite Data Generation
- Compute shader calculates Hermite data for the volumetric field
2. Octree Construction on the GPU
- A compute shader constructs an octree from the Hermite data
- Uses techniques inspired by parallel merge sort to avoid pure recursion
3. Mesh Generation
- A compute shader traverses the octree and Hermite data
- Generates triangle meshes using Cubical Marching Squares
- Resolves ambiguities and handles resolution transitions between LOD levels
4. Rendering & Physics
- Generated mesh is rendered directly in the scene
- Colliders are generated automatically from the output geometry
GPU-Specific Design Decisions
GPU-Based Octree Construction
The primary technical challenge was generating an octree on the GPU, as recursive data
structures are poorly suited to GPU architectures.
- Initial CPU-based octree construction was too slow for real-time use
- Refactored the process to run entirely on the GPU
- Emulated recursive behavior using parallel-friendly techniques inspired by merge sort
- Leveraged GPU execution groups and shared local memory to coordinate octree construction efficiently
This approach avoided pure recursion entirely while preserving the hierarchical structure needed for variable LOD.
Scale & Performance Characteristics
- Designed to support large-scale terrain, including planetary surfaces
- Variable LOD falloff reduces geometric density with distance from the camera
- Terrain intended to be chunked, with seamless connections between chunk boundaries
- System achieved real-time generation performance suitable for interactive exploration
Learnings & Future Work
- Successfully demonstrated real-time terrain generation with variable LOD
- Recursive data structures require non-intuitive approaches on GPU
- CMS offers significant advantages for LOD-compatible meshing
- Future work includes planet-scale terrain and streaming
- Exploration of advanced noise models and voxel-based fluid systems
Further Reading
A detailed breakdown of the algorithm design, implementation challenges,
and iteration process is available in the full article below.
Read the full technical article →