Lighthouse3d.com

Please send me your comments
Terrain Tutorial

Index

Introduction

A TGA Library
A Simple TGA Library
TGA lib Source

Height Maps
Height Maps from Images

Lighting
Computing Normals
Simulating Lighting
Implementation Details
Screen Shots

Source Code

Artificial Terrain Generation
The Fault Algorithm
Implementation Details
Two Simple Variations
The Circles Algorithm

Mid Point Displacement
The MPD Algorithm

Particle Deposition

Smoothing
Smoothing
Matrix filters
API details

Source (Linux and Win32)

[Previous: Screen Shots] [Next: Implementation Details]

Terrain Tutorial


The Fault Algorithm


This algorithm is a very simple one, yet its results, although not the best, are pretty good. The technique is not limited to planar height fields, being also applicable to spheres to generate artificial planets. Paul Bourke and Hugo Elias have posted tutorials on the application of this algorithm to spheres.

To start with we'll have a planar height field, where all points have zero height. Then we select a random line which divides the terrain in two parts (in general these parts will be different in size). The points to one side of the line will have their height displaced upwards, whereas the points on the other side will have their heights displaced downwards. The following image illustrates the first iteration of the technique.

The red points will have their height decreased, whereas the blue points will have their height increased. So now we have a terrain with two distinct heights. If we keep dividing the terrain like this then we'll get something that has valleys, mountains and so on (or at least we can imagine them!).

The following images show how the terrain height map evolves as the number of iterations increases.

1 iteration 2 iterations 3 iterations 4 iterations
8 iterations 16 iterations 100 iterations 400 iterations

OK, now lets look at the terrain itself after the same number of iterations.

1 iteration 2 iterations
3 iterations 4 iterations
8 iterations 16 iterations
100 iterations 400 iterations

[Previous: Screen Shots] [Next: Implementation Details]