Pregenerated Rain And Erosion
A random terrain before and after erosion.
A random perlinesque texture will give nonsensical geography, because there will be valleys and dams that go nowhere, pointy hills and no rivers.
We want to smooth hills, flatten valleys due to silt build up and create rivers that generally flow from mountains into the ocean.
For this, I use iterative rainfall, which erodes the ground away.
The rock created by the rock map will erode less than other earth, which I call silt in this section, exposing rocks and creating cliffs.
Rock maps are best if a smoothing pass is done on them, it depends on what sort of effect you want.
The rain map created is also used for texturising the terrain, generating rivers and bodies of water and determining what plants will grow where.
A few points:
.The images are VTF previews from my terrain generator, the vertices are around 10 - 100 meters apart real world for this erosive processing.
.In a second stage, the terrain is processed again at a higher detail.
.Although the terrain here is contstrained to height fields (ie no verticals or overhangs), that doesn't mean the final mesh doesn't have vertical cliffs etc.
.I use the word 'map' alot, it doesn't necessarily mean a texture, it could be a 2 dimensional array of a function specific object.
.Don't forget this is contrived realism, a real terrain would probably just be boring plains or rolling hills, besides I enjoy a stylised look in a terrain.
I create a rain map, which contains height information.
A texels height is composed of rock, silt and water.
Silt sits on rock, so if it is zero, rock is exposed.
To avoid anomalies during a scan of the map, runoff and mud temporary values are also used.
The rain is added each pass as a fraction of the smallest height increment for the height map.
If you try and dump too much water at once, you will have problems moving the water back and forth.
Each pass, a small amount of water is added to each texel.
Then a run off check is done.
For each neighbouring texel lower than the current, a portion of the water is moved to that texel.
In other words, the water flows down hill.
A heightmap which is already geologically sensible and rain maps while still raining and while drying up.
The water will gradually move downhill, filling dams or ending up in the ocean.
The rain map is converted to a 'lush map', which is basically a rain map chosen at a time during the process that can be used for texturising.
Where its wet, the landscape should have grass and lush plants, where it's dry the terrain should be dry, where its underwater it should be sand or rock.
The same terrain textured based on the lush map.
Of course you can vary rainfall to create rain forrests, deserts etc.
You could also use lattitude to alter rainfall and other properties.
I don't usually do world scale terrains though, so haven't worked on this.
To make a random texture work as a terrain, we need to erode it and create sensible valleys.
We do this by migrating some of the earth with the water.
The steeper the slope and the more water that's moved, the more earth that's moved.
If silt is reduced to 0 and rock is exposed, then rock is converted to silt, but only by a very small fraction.
Some sine hills. Uneroded on the left, eroded on the right. The insets are a siltmap and lushmap.
The silt flows like water, but it doesn't have to level quite so flat.
Flat valley bottoms are naturally formed as when water has drained, it will leave mud behind, and large bodies of water remain, leveling the silt flat.
Typical result of eroding a random terrain. Valley bottoms tend to level out into mud flats, while peaks tend to hang around.
I've toyed with various landslide type algorithms but they are difficult to balance.
The thing is; spectacular cliffs and other erratic geology defies average terrain behaviour.
To get lots of variety, you'd need lots of variety with the rock types and different earth types.
It's easier to go the impressionistic route and just watch for the most obvious flaws.
Witches hats are the most common abberation.
Noisy terrains tend to have lots of cones that just don't look natural.
Rain erosion doesn't smooth them without a lot of work because silt migrates down in all directions, maintaining the cone shape.
Just rounding the top helps speed up the process without having to obliterate the rest of the terrain.
To do this I do a witches hat pass, which is just a box smooth for high cones.
An alternative is to saturate the height of rocks, or have a cut off, forcing the tops flat, which then erode rounded.
You can't go overboard with this though, a lot of natural tors look like pointy cone hills.
The problem is there's too many of them in a noisy texture.
I prefer to just use a second rock height map so only where they coexist are rocks showing through.
You could do a bunch of things really, so don't be worried when you see your first results.
Lots of pointy cones are common in noisy random textures, in this case the peaks of rocks. There are many ways to handle this.
The proportion of run off and to which neighbouring texels it goes is important.
If a texel is on a ridge and the runoff flows evenly down to all sides (proportional to how steep they are) the ridge will round down and you will end up with rolling hills.
If you only run off down the steepest one or two texels on the same side of the ridge as each other, you will polarise ridges and end up with strong ridge marks.
In between, is ideal and the most awkward to manage.
I have a slider that lets me do a bit of each.
A very large scale texture would probably need more ridge definition, while a softer look may be more pleasant for smaller scales.
You'll notice most of my screen shots are rounded with pointy hills.
I choose this as an aesthetic, I think it gives the terrain a pleasant naeive feel.
You'll want to not erode rock with ridging, unless you're trying to do a sandstone like Uluru.
Extremes of rolling hills versus sharp ridges. This is determined by how you handle runoff.
I should point out here, I have done GPU based erosion for my infinite terrain system.
It is quite do-able, but unfortunately not the bottle neck of a good looking terrain.
The river generation is the real killer to real time terrain, I'll talk about that in my infinite terrain page.
The advantage of my system is you don't have to be fussy with textures to get a useable terrain.
Any old random noise will give you some interesting landmarks, just add a few cards to the deck and give them a shuffle.
Email firstname.lastname@example.org for questions.
Please don't ask me for source code, but I may do pseudo code for sections if there's interest.