Pregenerated Cliffs And Canyons From Posterising
A posterised canyon.
Doing a proper physics simulation to generate cliffs is pretty full on.
Instead, I prime the scene using a posterising technique.
Posterising just means a texture has its colours reduced, creating distinctive borders.
A few rules determine weather the outcome is a canyon, or cliff faces.
Lets say we want to make a canyon. First we posterise the texture.
We flood fill from a point, and everything not flooded is set to high.
A perlin texture posterised by a single colour.
River pathing will happily follow the canyon.
A lost world plateau.
Saw tooth posterising
Some mountain ranges have exposed rock in one direction.
I achieve this by using a saw tooth algorithm.
First I posterise.
Then I interpolate in a direction, from high to low.
Finish with the smoothing algorithm to give a slope in front.
A saw tooth terrain.
You can make mountain ranges by converting the poster into a height map based on the colour threshold.
A mountain range.
If you have a shape but it hits the edge, you can create a margin around the poster.
Simply do a path find around the edge, based on the threshold colour.
You may want to smooth the edges of the poster for islands. Pretty obvious by the image how it works.
A raised bit of land, suitable for islandising.
For anyone into retro graphics, 2.5D caves or open topped caves you can use a similar process to making canyons.
I do a flood fill from the start with a tolerance for nearby colours.
Then my flood fill function remembers which neighbouring texel was closest to the colour range.
That texel is set and the flood fill is repeated.
Just iterate, or test until you reach a destination.
This algorithm can require a lot of flood operations, so you will need to spend some time optimising it.
Caves rendered as a canyon, like an old school dungeon crawler.
You can use the same strategy as above, directly from a 3D perlin function.
You need to give a bias to travelling horizontally so you don't get too many steep drops.
A voxelised 3D perlin function.
I don't have the time to work further on this, but I can't see any major obsticles beyond limitations of voxels and a 3D flood fill function.
I hope this has inspired some of you to put some perlin functions into your terrain generator.
Don't forget you can have multiple thresholds for tiered cliffs.
Email email@example.com for questions.
Please don't ask me for source code, but I may do pseudo code for sections if there's interest.