Terrain Loader – Heightmap

This program is an older OpenGL based terrain loader. The program loads in a greyscale heightmap and generates the terrain based on height values stored in the image. This version uses the DevIL image library which allows it to load a wide variety of file formats. Several textures are loaded, these include the ground texture, the detail texture and the water texture. A simple method of creating a water plane is to create a plane at a certain level for example a y axis height of -10, then animate the UV coordinates of the plane so that the water appears to move.

The detail texture allows the ground to have far more “detail” than normal. Usually a detail texture is a perlin noise or similar that is blended with the ground texture. Below is the image of a loaded heightmap.

Post3terrainpic

I was going to post the source code to this example, but the code uses a triangle list method without any level of detail, so once I get the time to update this program and change the display method to a vertex buffer and add some other features I will post the code for other people to learn from.

Advertisements

2 thoughts on “Terrain Loader – Heightmap

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s