Stream-Power Erosion (Fluvial Terrain Uplift)
Generates mountain ranges by evolving a heightfield under tectonic uplift and the stream-power law, in which erosion rate depends on drainage area and slope, producing coherent river networks and ridges at large scale.
Also known as stream power law, uplift-erosion, fluvial erosion terrain
In the family Procedural generation, terrain erosion
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | No built-in fluvial stream-power terrain erosion solver. |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
The terrain evolves as dh/dt = U - K A^m S^n: uplift U raises the surface while erosion removes material proportional to upstream drainage area A and slope S raised to empirical exponents. Each iteration computes flow direction (steepest descent on a graph), accumulates drainage area from high to low, and applies an implicit update that is unconditionally stable even for large timesteps. Because uplift is a user-paintable map, authors sketch where mountains rise and the erosion then carves a consistent valley network. Cordonnier and colleagues use this to go from a coarse uplift sketch to realistic ranges with only tens of iterations, and note it works naturally on regular grids, triangulations or quadtrees. Pits must be resolved so every cell drains to a sink.
When to choose it
Reach for it when
- fbm mountains lack believable river networks
- need continental-scale terrain with coherent drainage
- want artists to paint uplift to shape ranges
- droplet erosion doesn't scale to large maps
Choose it for continental or mountain-range scale terrain where drainage consistency matters, and when artists need to paint uplift rather than tune droplet counts. Prefer Interactive Hydraulic Erosion on Heightfields or GPU Pipe-Model Hydraulic Erosion for local gullies and deposition detail, and Terrain from Hydrology (River-First Terrain Synthesis) when you want to sketch the river network first.
Field marks
- Local minima/lakes produce terraces unless depressions are filled or breached before routing
- Single-direction (D8) flow gives blocky, grid-aligned river courses
- Pure detachment-limited law yields no sediment deposition, so there are no alluvial fans or flat valley floors
- Exponents m,n and K per rock type must be chosen together; bad values give sawtooth ridges or flat plateaus
- Resolution-dependent drainage threshold changes river density
Presets
Stream-power erosion — tectonic uplift & dendritic fluvial drainage carving
{
"P_UPLIFT": 1.15,
"P_INCISION": 0.95,
"P_SNOWLINE": 0.56,
"P_SUN_ELEV": 0.45
}Show GLSL (146 lines)
const float P_UPLIFT = 1.15; // P Tectonic Uplift [0.4, 2.0, 0.05]
const float P_INCISION = 0.95; // P Fluvial Incision [0.0, 1.8, 0.05]
const float P_SNOWLINE = 0.56; // P Snowline Elev [0.2, 1.0, 0.02]
const float P_SUN_ELEV = 0.45; // P Sun Elevation [0.1, 1.2, 0.02]
vec2 hash22(vec2 p) {
p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));
return fract(sin(p) * 43758.5453);
}
// Sharp Voronoi ridge distance (models dendritic drainage divides & carved river valleys)
float voronoiRidge(vec2 p) {
vec2 n = floor(p);
vec2 f = fract(p);
float d1 = 8.0, d2 = 8.0;
for (int j = -1; j <= 1; j++) {
for (int i = -1; i <= 1; i++) {
vec2 g = vec2(float(i), float(j));
vec2 o = 0.18 + 0.64 * hash22(n + g);
vec2 r = g + o - f;
float d = dot(r, r);
if (d < d1) { d2 = d1; d1 = d; }
else if (d < d2) { d2 = d; }
}
}
return sqrt(d2) - sqrt(d1);
}
// Stream-power law steady-state terrain: uplift minus multi-scale dendritic fluvial incision
vec2 evalTerrain(vec2 p, float uplift, float incise) {
// Macro tectonic dome
float base = 0.65 * exp(-dot(p, p) * 0.095) + 0.22 * sin(p.x * 0.55) * cos(p.y * 0.52);
// Hierarchical dendritic drainage network (3 octaves of warped V-valleys)
vec2 q = p * 0.62;
float r1 = voronoiRidge(q + 0.18 * vec2(sin(q.y * 1.9), cos(q.x * 1.7)));
float r2 = voronoiRidge(q * 2.15 + vec2(3.1, 1.7) + 0.22 * vec2(cos(q.y * 3.1), sin(q.x * 2.8)));
float r3 = voronoiRidge(q * 4.4 - vec2(2.4, 4.1));
// Concave stream-power profile: smooth steep ridges, sharp incised V-valleys (A^m * S^n)
float ridge1 = 1.0 - exp(-r1 * 2.6);
float ridge2 = 1.0 - exp(-r2 * 2.8);
float ridge3 = 1.0 - exp(-r3 * 3.0);
float carved = 0.56 * ridge1 + 0.28 * ridge2 * (0.35 + 0.65 * ridge1) + 0.14 * ridge3 * ridge2;
float h = uplift * mix(base + 0.35, (base + 0.22) * (0.28 + 1.05 * carved), clamp(incise, 0.0, 1.6));
// Drainage accumulation proxy (highest along primary/secondary valley floors)
float streamMask = exp(-r1 * 18.0) + 0.45 * exp(-r2 * 20.0) * smoothstep(0.35, 0.05, r1);
return vec2(h, streamMask);
}
vec3 terrainNormal(vec2 p, float uplift, float incise) {
float e = 0.025;
float hx = evalTerrain(p + vec2(e, 0.0), uplift, incise).x - evalTerrain(p - vec2(e, 0.0), uplift, incise).x;
float hz = evalTerrain(p + vec2(0.0, e), uplift, incise).x - evalTerrain(p - vec2(0.0, e), uplift, incise).x;
return normalize(vec3(-hx, 2.0 * e, -hz));
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float uplift = clamp(P_UPLIFT, 0.35, 2.2);
float incise = clamp(P_INCISION, 0.0, 1.8);
float snowH = clamp(P_SNOWLINE, 0.15, 1.2);
float sunEl = clamp(P_SUN_ELEV, 0.08, 1.3);
float camAng = iTime * 0.18 + 0.4;
vec3 ro = vec3(sin(camAng) * 3.55, 1.92, cos(camAng) * 3.55);
vec3 ta = vec3(0.0, 0.42, 0.0);
vec3 ww = normalize(ta - ro);
vec3 uu = normalize(cross(ww, vec3(0.0, 1.0, 0.0)));
vec3 vv = cross(uu, ww);
vec3 rd = normalize(uv.x * uu + uv.y * vv + 1.5 * ww);
vec3 sunDir = normalize(vec3(cos(0.7 + iTime * 0.15), sunEl, sin(0.7 + iTime * 0.15)));
// Crisp alpine sky
vec3 skyCol = mix(vec3(0.78, 0.84, 0.90), vec3(0.18, 0.40, 0.72), pow(max(rd.y, 0.0), 0.55));
skyCol += vec3(1.0, 0.86, 0.62) * pow(max(dot(rd, sunDir), 0.0), 40.0) * 0.9;
vec3 col = skyCol;
float t = 0.8;
bool hit = false;
vec2 th = vec2(0.0);
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
th = evalTerrain(p.xz, uplift, incise);
float d = p.y - th.x;
if (d < 0.008 * t) { hit = true; break; }
t += max(0.04, d * 0.48);
if (t > 14.0) break;
}
if (hit) {
vec3 p = ro + rd * t;
th = evalTerrain(p.xz, uplift, incise);
vec3 n = terrainNormal(p.xz, uplift, incise);
float slope = 1.0 - clamp(n.y, 0.0, 1.0);
// Terrain shadow march
float sh = 1.0;
float st = 0.08;
for (int s = 0; s < 16; s++) {
vec3 sp = p + sunDir * st;
float sd = sp.y - evalTerrain(sp.xz, uplift, incise).x;
sh = min(sh, clamp(4.0 * sd / st, 0.0, 1.0));
st += max(0.06, sd * 0.55);
if (st > 3.5 || sh < 0.05) break;
}
// Geomorphological biomes: alluvial green valleys -> granite scree -> alpine snow ridges
vec3 valleyCol = vec3(0.14, 0.28, 0.12);
vec3 rockCol = mix(vec3(0.28, 0.25, 0.22), vec3(0.46, 0.42, 0.38), smoothstep(0.15, 0.65, th.x));
vec3 snowCol = vec3(0.92, 0.95, 0.99);
float rockMask = smoothstep(0.12, 0.34, slope + th.x * 0.22);
vec3 alb = mix(valleyCol, rockCol, rockMask);
float snowMask = smoothstep(snowH - 0.08, snowH + 0.14, th.x - slope * 0.38);
alb = mix(alb, snowCol, snowMask);
// Fluvial streams carving glowing turquoise ribbons through valley drainage channels
float river = smoothstep(0.45, 0.95, th.y * incise) * smoothstep(snowH + 0.15, 0.25, th.x);
vec3 riverCol = vec3(0.08, 0.48, 0.62);
float ndl = max(dot(n, sunDir), 0.0);
vec3 lit = alb * (vec3(2.25, 1.88, 1.38) * ndl * (0.08 + 0.92 * sh) + vec3(0.14, 0.24, 0.42) * (0.25 + 0.75 * n.y));
// Water specular sparkle in incised channels
vec3 hVec = normalize(sunDir - rd);
float rSpec = pow(max(dot(vec3(0.0, 1.0, 0.0), hVec), 0.0), 48.0) * 1.8 * sh;
vec3 riverLit = riverCol * (0.35 + 0.9 * ndl * sh) + vec3(0.95, 0.98, 1.0) * rSpec;
lit = mix(lit, riverLit, clamp(river, 0.0, 0.92));
// Aerial perspective haze
float fog = 1.0 - exp(-0.045 * t * t * 0.25);
col = mix(lit, skyCol * 0.92, clamp(fog, 0.0, 0.85));
}
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| stream-power-erosion-live | Tesla T4 1920x1080 | 622× baseline (extreme) · 20.5 ms / 20.5 ms | opengl-timer-query · 20 frames · GPU Weight Atlas · Colab T4 sweep |
| stream-power-erosion-live | NVIDIA L4 1920x1080 | 514× baseline (extreme) · 8.17 ms / 8.25 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| stream-power-erosion-live | NVIDIA A100-SXM4-40GB 1920x1080 | 339× baseline (extreme) · 9.76 ms / 9.82 ms · 2.1× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Weathering simulation (weathered stone), Fractal Brownian Motion and Multifractals.
Crosses
- Planets with rivers across cube seams: Whole planets whose mountain ranges and river networks are drainage-consistent across all six cube faces. Stream-power erosion runs on one flow graph over the cube-sphere, so rivers cross face seams without breaking and basins span continents.
- Fractal Brownian Motion and Multifractals: A noise-perturbed initial surface avoids flat starts and seeds drainage randomly.
Sources
- primaryGuillaume Cordonnier, Jean Braun, Marie‐Paule Cani, Bedrich Benes, Éric Galin, Adrien Peytavie et al. (2016). Large Scale Terrain Generation from Tectonic Uplift and Fluvial Erosion. Computer Graphics Forum.Verified via crossref · 2026-11-29doi:10.1111/cgf.12820
- implementationH-Schott (2023). H-Schott/StreamPowerErosion. Large-Scale Stream Power ErosionGitHub API · license MIT · 2026-11-29