Procedural terrain generation with OpenGL

>Check it out on github<

I completed this project with two colleagues, Julien Harbulot and Isaac Leimgruber, for the “Introduction to computer graphics” course.  The course focused on rendering techniques and their theoretical basis while leaving to the students the task to learn how to actually implement those techniques in OpenGL. The initial goal was to generate a landscape using procedural techniques and add some basic lighting effects to it.

We implemented several features in addition to the basic requirements:

  • Infinite terrain generation
  • Dynamic shadows
  • Adaptive level of details through the use of tessellation
  • Instantiated patches of grass
  • 3D model loading
  • Dynamic sky which mimics the natural colour changes throughout the day

See the screenshots of completed project below:

Patches of grass appear when appropriate terrain conditions are met.
Enjoying a virtual sunset. Note how the mountains cast their shadows onto the water surface.
Reflections on the water surface vary over time depending on the waves and ripples.
The terrain regenerates indefinitely when the user traverse the landscape. Mountains far away are faded to hide the regeneration process while at the same time giving the illusion of distance.

Tessellation allows adjusting the level of detail of the terrain based on the distance to the observer and the importance of a given zone. Note how little geometry is used for the underwater part.