Dynamic Terrain Generation

Doug Jimenez

CSC 471 Spring 2013


Overview

For my project, I decided to create a program that generated terrain as the camera moved through it. The heights generated from navigating through the world are generated from the perlin noise algorithm for a smooth, rolling hills effect. Originally, I had planned to texturize the world, but I had made a design mistake when creating my grid. There was only one copy of each vertex in my grid, and I needed to bind multiple textures to multiple inner vertices.

Design

In order to produce my world, I had to create a way to make heights and store them in vertices right away. From the Geometry Creator application, I adapted a new mesh creation method that dynamically assigned heights generated from the perlin noise algorithm. I also generated the normals and sent them to the shader. For generation of this terrain, I was stuck with a decision between performance and quality because more triangles in my mesh meant more time to generate, so I decided on a decent balance between the two. I made the land so that there was always a mesh surrounding the use so that they would never run out of terrain as well.

To Navigate the world

'w' - Move forward.
'a' - Move left.
's' - Move backwards.
'd' - Move right.
'q' - Quit.

Sample Images

Implementation

User controlled Movement

In this world, I purposely set the movement to be able to soar above the terrain. When high above the square of terrain, it is easier to observe the changing that the terrain goes through. Originally, I set the camera to always be at ground level + 1, but that hides the the viewer from seeing how the terrain changes during movement.

Dynamic Generation

To keep the terrain generating more hills, I actually allowed the camera to move in the space. The terrain mesh is created around a point I give it, and every time the camera moves, I pass it the camera's x and z position to simulate traveling across the terrain. To generate the terrain, I started with a grid. I would compare lengths of the diagonals in each square and use the shorter one as the edge for the two triangles I made. I knew there were other ways to implement terrain using triangle strips, but I wanted to try a new method.

Resources

Source for Perlin Noise information