Fractal Landscapes and River Courses

Generating a fractal landscape using the Diamond Square method (shown in Generating Random Fractal Terrain ) generates a useful “alpine” style landscape with deep (but not linear) valleys and nice sharp peaks.

A side effect of this algorithm is that it creates primordial glacial style landscapes with no weathering. If this is what you want, then great Smile

If you want to drive a river through your generated landscape using a path finding algorithm like A-Star, modifying the distance measurements between points to take into account changes in elevation, the fractal method becomes impossible to work with.

As illustrated in the landform described in the above link the outcome is almost always a series of “pits” surrounded by “peaks”.

 

This is a typical problem for route finding algorithms because there is never a logical, measureable, course between a point on the map and the edge of the map (the “sea”) as the course must traverse many “pits” out of which there is no escape.

I found the best combination to use to generate useful landforms was a Perlin noise based heightmap, with three levels of frequency, followed by selective regions where I would apply a fractal overlay to it. I chose a set of rectangles of random size, clamped the edges to zero (so they would blend into the existing heightmap) and generated a 2D array of height overlays based on the diamond square. I then applied this over the top of the existing Perlin based heightmap to create a composite region of Fractal overlaying Perlin.

Because the Perlin base layer provides a “boring” landscape of connected valleys (very similar to a heavily glaciated, “rounded” landform) any route finding algorithm for river courses would always find a route to the sea, and the overlay of some randomly sized fractal portions provided the “interesting” areas.

One side effect of using Perlin is that it is self-similar and that all sense of scale is lost; its very smooth but lacks any features; by applying a few sets of fractal landscape areas over the top the basic landform stays the same but the new areas of more detail provide a sense of scale.

Perlin based landscape. All rounded and glaciated.

image

Same Perlin based landscape with Fractal patches overlaid

image

References

Instead of using Perlin, I had good results using Simplex Noise and the implementation at Heikki Törmälä’s Code.Google.com archive

My A-Star path finding implementation from Eric Lippert’s Blog "Path Finding Using A* in C# "

Advertisements

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