---
id: "stream-power-erosion"
title: "Stream-Power Erosion (Fluvial Terrain Uplift)"
aliases: [stream power law, uplift-erosion, fluvial erosion terrain]
domain: "procgen"
stage: "procedural"
realtime: "interactive"
platforms: [cpu, desktop-gpu, python, houdini, unity, unreal]
year_introduced: 2016
inputs: [heightfield, graph]
outputs: [heightfield]
style: "photoreal"
dynamic: "static"
cost: "offline"
authority: "Cordonnier et al., 2016"
url: "https://texelatlas.vercel.app/t/stream-power-erosion/"
sources_verified_at: "2026-11-29"
---
# Stream-Power Erosion (Fluvial Terrain Uplift) (Cordonnier et al., 2016)

> 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.

## 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

## 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 use it

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](https://texelatlas.vercel.app/t/hydraulic-erosion-stava.md) or [GPU Pipe-Model Hydraulic Erosion](https://texelatlas.vercel.app/t/gpu-pipe-model-erosion.md) for local gullies and deposition detail, and [Terrain from Hydrology (River-First Terrain Synthesis)](https://texelatlas.vercel.app/t/hydrology-terrain-synthesis.md) when you want to sketch the river network first.

## Cost

offline — Each iteration is a graph pass over all cells (flow routing plus an area accumulation); tens of iterations suffice, so seconds to minutes depending on resolution.
Measured GPU Weight: 621.98× baseline (extreme) — 20.463 ms median / 20.5022 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 514.06× baseline (extreme) — 8.1736 ms median (2.5× faster on L4).
Ampere A100 scaling: 338.72× baseline (extreme) — 9.7551 ms median (2.1× faster on A100).

## Failure modes

- 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

## Dataflow

- Inputs: heightfield, graph
- Outputs: heightfield
- Platforms: cpu, desktop-gpu, python, houdini, unity, unreal

## Presets

### Stream-power erosion — tectonic uplift & dendritic fluvial drainage carving (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_UPLIFT": 1.15,
  "P_INCISION": 0.95,
  "P_SNOWLINE": 0.56,
  "P_SUN_ELEV": 0.45
}
```

```glsl
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).

## Lineage

- extends [Terrain from Hydrology (River-First Terrain Synthesis)](https://texelatlas.vercel.app/t/hydrology-terrain-synthesis.md)

## Combines with

- [Fractal Brownian Motion and Multifractals](https://texelatlas.vercel.app/t/fractal-brownian-motion.md): A noise-perturbed initial surface avoids flat starts and seeds drainage randomly.

## Combination ideas

- [Planets with rivers across cube seams](https://texelatlas.vercel.app/ideas/drainage-consistent-planets/)

## Sources

1. [primary] Guillaume Cordonnier, Jean Braun, Marie‐Paule Cani, Bedrich Benes, Éric Galin, Adrien Peytavie, Éric Guérin (2016) Large Scale Terrain Generation from Tectonic Uplift and Fluvial Erosion. Computer Graphics Forum. https://doi.org/10.1111/cgf.12820 (verified via crossref on 2026-11-29)
2. [implementation] H-Schott (2023) H-Schott/StreamPowerErosion. https://github.com/H-Schott/StreamPowerErosion License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Stream-Power Erosion (Fluvial Terrain Uplift)." https://texelatlas.vercel.app/t/stream-power-erosion/ (accessed 2026-12-01).
