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: Circles Algorithm] [Next: The MPD Algorithm]

Terrain Tutorial


Mid Point Displacement


The Mid Point Displacement, MPD hereafter, aka the Plasma Algorithm, is a subdivision algorithm. The terrain is built iteratively, in each iteration the level of detail increases. From a computational point of view this algorithm is very inexpensive when compared to the previous algorithms, and its results are quite impressive.

This algorithm was conceived to generate square terrains with dimensions (2^n + 1) x (2^n + 1), where n stands for the number of iterations. This implies that with just 8 iterations a good looking terrain with 257x257 grid points is generated. With 10 iterations we get 1025x1025 grid points. Just be ware of the memory and performance implications, a terrain with 1025x1025 grid points takes a lot of memory, and unless there is some real time navigation algorithm implemented, performance will be lousy.

The most important parameter of this algorithm is the roughness constant. This value determines the look of the final terrain, from extremelly smooth, to very rough. The most common value for this parameter is 1.0. The images bellow show examples of MDP with various roughness constants.

r = 1.0
r = 2.0
r = 0.5

[Previous: Circles Algorithm] [Next: The MPD Algorithm]