Erosion Algorithm

This rudimentary erosion algorithm is based on a simplified sandpile model. Starting from pure Perlin noise, or in fact any monochrome bitmap heightfield, it continuously updates the heightfield array by moving terrain into neighboring pixels in the "downhill" direction. The frame below shows an instance of the algorithm actively evolving; refresh this page to restart the simulation. Bitmaps such as these are easily converted to more realistic 3d terrain meshes, which can be used to create more compelling virtual environments for renderings, games, or interactive applications.

View P5js sketch