Of course, this simple idea doesn't work. My first attempt was to just apply the erosion algorithm independently to each terrain tile as it was generated, after the height values were assigned but before they were used for normals and object placement. I started working on erosion of large terrains as soon as I finished the previous blog post. This is fine for a single tile, but I want to be able to erode an infinite terrain consisting of an endless grid of tiles. It's not too interesting, though this is proof that the system works.Įrosion on a single 128x128 vertex mesh tile. Here is an example of what this looks like. It currently takes 36ms to apply 5000 erosion iterations to a 128x128 vertex/texel heightmap.
Material is removed from steep path segments and deposited when the path levels off, forming a series of peaks and valleys. A "sink" can be an ocean, a local minima in the mesh, or the edge of the map. The way this algorithm works is by placing one unit of water randomly on the map for each iteration, and computing the path that this water follows to a "sink". I'm using this erosion implementation from Ranmantaru Games which I've slightly modified to make it more efficient and configurable, and to make it work with a global water height value.
I already have erosion working for individual terrain chunks in ground/gameplay mode. 3DWorld's terrain generation looks pretty interesting with domain warp noise, but there's one thing that's missing: erosion.