Procedural Terrain Generation

Github Link

Overview

This is a C++ programmed OpenGL application that generates a square shaped terrain of odd numbers (3×3, 9×9 etc.). The Diamond – Square algorithm was used to generate the terrain, incorporating a random value at each vertex, weighted by the values of it’s surrounding vertices. This gave the terrain a more natural feel. Every time this program is run, the terrain will be generated differently.

Skills Learned

  • Advanced implementation of OpenGL functionality beyond previous projects through the use of commands like glPolygonMode, glUniform4fv.
  • Vertex Array Object (VAO) and Vertex Buffer Object (VBO) creation methods
  • Diamond – Square Algorithm Implementation
  • Vertex and Fragment Shader Implementation
  • Camera Controls allowing for three dimensional movement as well as rotational control through radian based trigonometry functions

Future Features

  • Texturing to create realistic environments based on vertex height
  • Additional randomly generated items such as trees or rocks constrained by a set of criteria
  • Mouse camera control implementation

Screenshots

This slideshow requires JavaScript.

Code Snippets

Leave a comment