← All resources

Terrain hack: Fastest erosion algorithm ever

Blog Intermediate

Jan Mróz

Proposed by Jan Mróz

Visit resource ↗

Description

Jan Mróz documents Hatchling's Shadertoy erosion trick on Procedural Pixels as a fast heightmap filter rather than a rain or fluid simulation.

The write-up builds intuition with one-dimensional slab functions and Fourier-series analogies, then stacks hundreds of thresholds over a 2D search kernel to smooth bumps and create sandy slopes on R32 heightmaps rendered in Unity.

Intermediate shader and terrain authors comfortable with compute-style heightmap passes benefit most; it assumes GPU texturing basics but not physical hydrology.

The article includes kernel-size benchmarks near 100 to 300 ms for 1024 squared maps on an RTX 3060, Unity package downloads, and references to Hatchling's original Shadertoy shaders.

It is a practical gamedev recipe when believable erosion matters more than sediment transport outputs, with notes on quad-tree acceleration as a future speedup.