Terrain Generation Using Marching Cubes
Karm Koduvere, Jan Markus Rokka, Alexis Alliksaar
Video
Repository: Link
Demo (OpenGL): Link
Demo (DX11): Link
Project description
The project idea is to implement marching cubes algorithm to procedurally generate interesting 3D terrain with caves and cliffs. For the procedural part, the plan is to experiment with different noise functions to create various types of landscapes.
Initial progress
Final release
The goal of this project was to implement the marching cubes algorithm to procedurally generate visually appealing 3D terrains with caves and cliffs. The entire implementation was carried out using Unity, utilizing a compute shader for efficient processing.
Marching Cubes Algorithm:
The marching cubes algorithm was implemented to convert the generated voxel data into a smooth 3D mesh. This algorithm efficiently handles the reconstruction of surfaces based on the density values of voxels, resulting in a visually appealing terrain with overhangs and caves.
Level of Detail (LOD) Implementation:
To optimize runtime performance, the project incorporated Unity’s Level of Detail (LOD) system. LODs dynamically adjusted the level of detail in the terrain based on the viewer's distance, ensuring smoother performance without compromising visual quality.
Compute Shader:
A compute shaders were used to perform the heavy lifting of both noise generation and marching cubes algorithm and for an interesting challenge to undertake. Compute shaders enable parallel processing on the GPU, resulting in faster and more efficient terrain generation.
Noise Functions:
Various noise functions, such as Perlin noise and Simplex noise, were experimented with different parameters to generate different patterns for the terrain.
Trees:
Tree model was made in Blender. Trees are generated above ground and then lowered onto ground level by sending a ray down and then setting the tree down to the where the ray hit. Random terrain generation has to be enabled for trees to be placed correctly.
Sources:
Coding Adventure: Marching Cubes
Coding Adventure: Terraforming
Generating Complex Procedural Terrains Using the GPU
Marching Cubes Lookup Tables
3D Cube World Level Generation
Making maps with noise functions
Noise
Compute Shaders
Unity Runtime Inspector & Hierarchy