Computer generated terrain usually begins with a base of random noise, or perhaps a fractal. These look nice in small sections, but are unconvincing for a continent: noise has none of the major features it should, like mountain ranges, and fractals are nothing but feature -- they're too regular. Here's a method for generating continent-level trerrain using distortion fields.

Making the Distortion Field

By a distortion field, I basically mean a vector field of uniform speeds. We can use such a field to warp a base layer of terrain to create both (1) the outline of the continent, and (2) its major features, like mountain ranges. Small and mid-level features can then be added later.

Arrows everywhere

We can begin by creating a random field, with arrows pointing every which-way (image above). This would produce no meaningful features, so we need to smooth it out first. Terrain smoothing can generally be done by averaging each cells with its orthagonal neighbors. (We have to be careful here not to use a simple mean, which would bias results toward 180°. Instead we must decompose the angles into x and y compontent, sum those, and calculate a new angle. This is the process used for calculating average wind speed, so that everything doesn't simply cancel out to zero.) Here is the same field after some smoothing:

Smoothed field

The above image illustrates the method, but real maps are usually larger and the arrow notation is cumbersome. Below is a color-coded distortion field (red being up) with hundreds of smoothing iterations (the amount should scale with the size of the map).

Large smoothed field

You can see that some large-scale feature emerge, even while some smaller-scale anomolies remain. It can be nice to add a second, less smoothed, field on top to create that roughening detail.

The Underlying Layer

Our distortion field must act on something, so we begin again with some random noise -- with values representing altitudes.

Noisy Terrain

Again, we smooth this out (but in a more straightforward manner), and we also exagerate the peaks so that a few mountains stand out against a more uniform background.


Applying the Distortion Field

How do we distort one layer with another? I wrote a function that basically calculates weighted averages over a grid (a 2D array), with weights for each neighbor. The distortion field is then used as the weighting mechanism, so that each cell is averaged in one direction -- but on a grid this becomes some combination of 1 to 2 neighbors' values. Here is the terrain, plus some padding, with 5 iterations of the distortion:

Distorted terrain

As we increase the number of iterations, the original (random) features are smeared out over larger distances, including outside the original bounds (hence the padding). Because the distortion works in one direction at a time, long features like mountain ranges can emerge from the initial high points.

Distorted terrain Distorted terrain Distorted terrain Distorted terrain

With some mid-level terrain added, and some erosion applied, we have a fairly reasonable sort of computer-generated continent:

3D Continent


The distortion field itself determines the outline of the continent and the internal similarities, but exactly where mountains exist is highly dependent on the starting terrain layer. We can swap out that layer while keeping the distortion field constant to play around with the big features.

Map variation Map variation Map variation

Many other elaborations are possible, with different layers of distortion applied to various degrees. (Swapping out different fields on the same map can, of course, also be done, but because the interaction between them is what counts for mountain position, there is little point.)

This approach is not difficult to implement and can create landforms that are not (readily) possible with simple noise or fractals; but of course it can be combined with those methods, and indeed rellies on noise at its base. Distortion fields can thus be one more powerful tool in the world-builder's kit.

Next Post Previous Post