3D Terrain Generation via Marching Cubes
Project information
This is a cross-platform tool, written in C++ and Vulkan, that procedurally generates 3D terrain. The terrain is generated on the GPU in geometry shaders, using the marching cubes algorithm. It's based on a chapter in the GPU Gems 3 book. This was my final project for the Spring 2024 Realtime Rendering class at Carnegie Mellon.
The terrain is generated via a density function over 3D space. Positive values indicate points inside the terrain, while negative values indicate open space. Therefore, the generated geometry will be where the desnity is zero. The 3D world is divided into many small cubic cells, and each cell may contain up to 5 triangles. For each cell, the density function is evaluated at each of its eight corners, and triangles are generated only if there are both positive and negative values at the eight corners.