Complex Procedural Voxel Terrain


Platform Windows
Genre Simulation
Technology C/C++, OpenGL, GLSL, Panda Engine 
Team Size Individual Project
Development Time 4 weeks


Auto generated complex voxel based terrain is a program that I made for my 3D game engine. I have made a basic voxel terrain like Minecraft before. This project is the big step from block-like terrain to something more sophisticated and realistic. This project is based on the article from Ryan Geiss, GPU Gems3, Generating Complex Procedural Terrains Using the GPU. He used HLSL, but I used GLSL for this project. Other than that I also used these several techniques.

  • Geometry Shader
  • Marching cubes algorithm
  • Tri-planar texture mapping
  • Phong Lighting and normal mapping
  • Ambient Occlusion

I started the project by creating a simple procedural terrain by using 3D Perlin noise. Then I smoothed the surface by using Geometry Shader and Marching cubes algorithm. Using Phong lighting and Tri-planar texture mapping made terrain’s texture blend together nicely and look more realistic. The last step, I used Ambient Occlusion for making realistic look to the terrain.

I faced a lot of problems during development. The first version of the terrain, for example, was very ugly. Normal vectors point to the wrong direction, so the surface was not smooth. Furthermore, there were holds here and there after applying a marching cubes algorithm. Everywhere can cause the problems. I needed to check every step closely, fixed little by little, and make sure every part of my project working fine. Working with shader is a real pain, because there was no good shader debugging tool. I could not simply put break points or print logs out. What I did is to use color as an indicator to identify where were the mistakes. Overall, it was a really fun project. The end result is stuning.