Erosion Simulation 

This simulation takes a heightmap and erodes it to simulate the natural process evident everywhere around us. Adapted for TouchDesigner, the basis of this algorithm was a WebGL implementation by Lan Lou. I chose a grid-based simulation as it is most simple to implement on the GPU.

The simulation is conceptually simple and uses several texture maps to be updated each iteration: 
  • A terrain map, containing heightmap data 
  • A water map containing the “water” (this could be any erosive substrate, I use water colloquially) that erodes the terrain 
  • A sediment map tracking the movement of eroded terrain, now sediment 
  • A velocity map relfecting the directional motion of the water 

As in the real world, a given unit of water may only hold up to a certain amount of sediment. As it runs over a terrain, it accumulates sediment. After it is saturated the water can no longer accumulate (or erode) any more, and must deposit some sediment. The entire simulation simply tracks this accumulation and deposition process. 

The every point on the terrain map grid is updated each time step: 
  • If there is water on the point and it has excess capacity, the water erodes some sediment 
  • If there is water at that pont but is holding more sediment than it has capacity for, some sediment is deposited  (the amount of erosion and deposition are functions of the sediment levels over or under capacity, defined parametrically)
  • Sediment is advected each step using a multi-pass MacCormack advection algorithm
  • A slippage constant is used to promote erosion in areas where the terrain is steeply sloped, simulating thermal erosion (when steep banks of rivers crumble)