Generating Volumetric Terrain Procedurally Using the GPU
Based on Ryan's Geiss chapter in GPU Gems 3: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html
Use to scroll around. If you toggle first-person mode, use the WASD keys to move forward/backwards left/right and Q/E to move up/down.
Build
$ cd procedural-terrain-488
procedural-terrain-488$ premake4 gmake
procedural-terrain-488$ make
procedural-terrain-488$ cd src
procedural-terrain-488/src$ premake4 gmake
procedural-terrain-488/src$ make
Tested to work on gl30.student.cs.uwaterloo.ca and any machine that has a GTX 980.
Objectives
- UI: Create a first-person camera and appropriate controls to navigate the scene, including moving in all 3 axes, adjusting the movement speed and rotating the camera.
- Modelling: Add geometry to represent water to the scene.
- Implement 3D Perlin Noise to generate a terrain density function.
- Implement the Marching Cubes algorithm to generate triangles out of the density function.
- Implement ambient occlusion by casting out shadow rays for each vertex.
- Map textures onto the generated mesh by using triplanar texturing.
- Implement bump mapping by mapping a bump map texture onto the generated mesh to perturb normal vectors.
- Optimize terrain generation code by splitting terrain generation work into smaller units with multiple shader passes to eliminate redundant work (e.g. shared vertices) as described in the book chapter.
- Implement level-of detail rendering and alpha blending to improve the transition between blocks of terrain of different resolutions from level-of-detail rendering, which will require rendering the blocks furthest away first.
- Implement reflection for water by rendering the water twice, once as a stencil, and reflected scene within the stencil, then the water on top of the reflection with transparency.
Dependencies
- OpenGL 3.2+
- GLFW
- Lua
- Premake4
- GLM
- AntTweakBar