Texel A field guide to 3D techniques

Gray-Scott reaction-diffusion × Plant Ecosystem Distribution Simulation

Tiger-bush drylands. Semi-arid biomes with the banded, spotted and maze-like vegetation patterns real drylands show. A reaction-diffusion field with a downhill drift decides where plants can survive, and an ecosystem simulation fills those patches with individual species.

Open in StudioReproduced146× · 4.51 ms

Gray-Scott reaction-diffusionSimulation · Interactivein: textureout: texture, heightfieldtexturePlant Ecosystem Distribution SimulationProcedural · Offlinein: heightfield, textureout: point-cloud, layout

Verified proof

reproduced · 2026-12-01texel-lablicense MIT
Specimen render of Tiger-bush drylands (left: uncoupled noise scatter, right: slope-advected Turing bands + ecosystem shrubs)
Cross-proof specimen. Tiger-bush drylands (left: uncoupled noise scatter, right: slope-advected Turing bands + ecosystem shrubs). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing uncoupled random dryland vegetation scatter (left, ignoring terrain slope) against a slope-advected Gray-Scott / Klausmeier Turing biomass field transitioning from spots to contour-aligned tiger-bush bands on hillsides, driving competitive multi-species shrub crowns and grass fringes (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · aligns banded tiger-bush vegetation perpendicular to hillside contours while transitioning to spots/labyrinths on mesas and populating bands with shaded multi-species plant crowns

Show GLSL proof (188 lines)
const float P_ARIDITY = 0.52; // P Aridity (Spots-Labyrinth) [0.15, 0.85, 0.02]
const float P_SLOPE_ADVECT = 1.25; // P Downhill Runoff Advection [0.0, 2.5, 0.05]
const float P_BAND_FREQ = 5.40; // P Turing Band Scale [2.5, 10.0, 0.2]
const float P_SHRUB_DENSITY = 1.10; // P Ecosystem Competition [0.2, 2.0, 0.05]

vec2 hash22(vec2 p) {
  vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
  p3 += dot(p3, p3.yzx + 33.33);
  return fract((p3.xx + p3.yz) * p3.zy);
}

float vnoise(vec2 p) {
  vec2 i = floor(p);
  vec2 f = fract(p);
  vec2 u = f * f * (3.0 - 2.0 * f);
  return mix(
    mix(hash22(i).x, hash22(i + vec2(1.0, 0.0)).x, u.x),
    mix(hash22(i + vec2(0.0, 1.0)).x, hash22(i + vec2(1.0, 1.0)).x, u.x),
    u.y
  );
}

float fbm(vec2 p) {
  float s = 0.0;
  float a = 0.5;
  mat2 m = mat2(0.8, 0.6, -0.6, 0.8);
  for (int i = 0; i < 4; i++) {
    s += a * vnoise(p);
    p = m * p * 2.03 + vec2(4.7, 2.9);
    a *= 0.5;
  }
  return s;
}

// Semi-arid plateau + gently sloping pediment hillside heightfield
float terrainHeight(vec2 p) {
  // Broad sloping pediment from top-left mesa down to lower-right basin
  float ridge1 = exp(-dot(p - vec2(-0.55, 0.55), p - vec2(-0.55, 0.55)) * 0.42) * 1.15;
  float ridge2 = exp(-dot(p - vec2(0.65, -0.35), p - vec2(0.65, -0.35)) * 0.55) * 0.72;
  float macro = 0.38 * fbm(p * 0.85 + vec2(1.3, 2.4));
  return ridge1 + ridge2 + macro - 0.18 * p.y;
}

vec2 terrainGrad(vec2 p) {
  float e = 0.025;
  return vec2(
    terrainHeight(p + vec2(e, 0.0)) - terrainHeight(p - vec2(e, 0.0)),
    terrainHeight(p + vec2(0.0, e)) - terrainHeight(p - vec2(0.0, e))
  ) / (2.0 * e);
}

// Reaction-diffusion / Klausmeier-Gray-Scott steady-state manifold with downhill runoff advection
float evalTuringBiomass(vec2 p, float h, vec2 grad, float t) {
  float slopeMag = length(grad);
  // Uphill migration phase (real tiger-bush bands slowly colonize uphill where runoff arrives first)
  float uphillShift = t * 0.18;
  // Contour-aligned banded wave on sloped ground
  float warp = (fbm(p * 2.2 + vec2(3.1, 1.7)) - 0.5) * 0.42;
  float contourPhase = h * P_BAND_FREQ * 6.2831853 + warp * 5.2 - uphillShift;
  float bandWave = 0.5 + 0.5 * sin(contourPhase + 0.55 * sin(p.x * 3.1 - p.y * 2.7));

  // Isotropic labyrinth / spot Turing pattern on flatter mesas (hexagonal + multi-wave superposition)
  vec2 q = p * P_BAND_FREQ * 1.85 + vec2(warp * 1.8, -warp * 1.4);
  float w1 = cos(dot(q, vec2(1.0, 0.0)));
  float w2 = cos(dot(q, vec2(-0.5, 0.866025)));
  float w3 = cos(dot(q, vec2(-0.5, -0.866025)));
  float spots = (w1 + w2 + w3) / 3.0 * 0.5 + 0.5;
  float lab = 0.5 + 0.5 * sin(q.x * 0.9 + 1.8 * sin(q.y * 0.85 + warp * 4.0));
  float flatPattern = mix(lab, spots, clamp((P_ARIDITY - 0.25) / 0.55, 0.0, 1.0));

  // Slope-advection coupling transitions flat spots/labyrinths into contour-hugging tiger-bush arcs
  float advectMix = clamp(slopeMag * P_SLOPE_ADVECT * 1.45, 0.0, 1.0);
  float field = mix(flatPattern, bandWave, advectMix);

  // Reaction-diffusion autocatalytic threshold controlled by aridity
  float thresh = mix(0.28, 0.64, P_ARIDITY);
  return smoothstep(thresh - 0.14, thresh + 0.16, field);
}

// Ecosystem plant competition: Voronoi-spaced multi-species acacia shrubs & tussock grass within biomass suitability
void evalEcosystemPlants(vec2 p, float suitability, vec2 sunDir2, out float canopy, out float grass, out float species, out float selfShad) {
  vec2 sp = p * (14.5 * P_SHRUB_DENSITY);
  vec2 cell = floor(sp);
  vec2 frac = fract(sp);
  float minD = 9.0;
  float bestSize = 0.0;
  vec2 bestOffset = vec2(0.0);
  float bestRnd = 0.0;
  for (int y = -1; y <= 1; y++) {
    for (int x = -1; x <= 1; x++) {
      vec2 nb = vec2(float(x), float(y));
      vec2 rnd = hash22(cell + nb + 11.7);
      vec2 pos = nb + 0.16 + 0.68 * rnd;
      vec2 diff = frac - pos;
      float d = length(diff);
      if (d < minD) {
        minD = d;
        bestOffset = diff;
        bestRnd = rnd.x;
        // Larger pioneer shrubs dominate band cores where moisture is highest
        bestSize = mix(0.18, 0.44, suitability) * (0.68 + 0.52 * rnd.y);
      }
    }
  }
  float crownMask = smoothstep(bestSize, bestSize * 0.42, minD) * smoothstep(0.24, 0.55, suitability);
  // Slight bumpy foliage edge
  float crownNoise = fbm(p * 42.0) * 0.18;
  canopy = smoothstep(0.25, 0.65, crownMask + crownNoise * crownMask);
  // Directional shading across each dome-shaped shrub crown
  float crownLight = clamp(0.55 + dot(normalize(bestOffset + vec2(1e-4)), sunDir2) * 0.75, 0.15, 1.25);
  selfShad = crownLight;
  species = bestRnd;
  // Dry grass fringe thrives along band edges where shrub competition is lower
  grass = smoothstep(0.14, 0.52, suitability) * (1.0 - canopy * 0.75) * (0.55 + 0.45 * fbm(p * 32.0));
}

vec3 acesTone(vec3 x) {
  return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  bool useCoupled = uv.x > 0.0;
  vec2 suv = vec2(useCoupled ? (uv.x - 0.25) : (uv.x + 0.25), uv.y);

  // Oblique aerial orthographic/perspective camera over dryland hills
  vec3 ro = vec3(suv.x * 2.25, 2.35, suv.y * 2.65 + 1.15);
  vec3 rd = normalize(vec3(0.0, -0.84, -0.54));
  float t = 0.0;
  for (int i = 0; i < 36; i++) {
    vec3 q = ro + rd * t;
    float h = terrainHeight(q.xz);
    float d = q.y - h;
    if (d < 0.005) break;
    t += d * 0.62;
  }
  vec3 wp = ro + rd * t;
  float h = terrainHeight(wp.xz);
  vec2 grad = terrainGrad(wp.xz);
  vec3 N = normalize(vec3(-grad.x, 1.0, -grad.y));
  vec3 sunDir = normalize(vec3(0.76, 0.52, 0.38));
  float ndl = max(dot(N, sunDir), 0.0);

  // Base semi-arid laterite / red-ochre crusted soil + micro-erosion rills
  float soilTex = fbm(wp.xz * 12.0);
  float rills = fbm(wp.xz * 26.0 + grad * 3.0);
  vec3 bareSoil = mix(vec3(0.56, 0.34, 0.21), vec3(0.76, 0.54, 0.35), soilTex);
  bareSoil *= (0.86 + 0.24 * rills);
  // Subtle topographic contour lines on bare crust
  float contour = smoothstep(0.94, 0.99, abs(sin(h * 34.0)));
  bareSoil = mix(bareSoil, bareSoil * 0.88, contour * 0.32);

  vec3 col = bareSoil * (0.28 + 1.15 * ndl);

  if (!useCoupled) {
    // Left: uncoupled isotropic noise biomass scatter (ignores terrain gradient and ecosystem niche spacing)
    float naiveBio = smoothstep(0.46, 0.66, fbm(wp.xz * 3.6 + vec2(1.4, 2.1)));
    vec3 naiveGreen = mix(vec3(0.24, 0.31, 0.16), vec3(0.35, 0.42, 0.20), fbm(wp.xz * 18.0));
    col = mix(col, naiveGreen * (0.25 + 1.05 * ndl), naiveBio * 0.85);
  } else {
    // Right: slope-advected Turing biomass driving competitive shrubs, grass fringes, and litter
    float bio = evalTuringBiomass(wp.xz, h, grad, iTime);
    float canopy, grass, species, crownLight;
    evalEcosystemPlants(wp.xz, bio, normalize(sunDir.xz), canopy, grass, species, crownLight);
    // Cast short ground shadow downhill/away from sun next to shrub bands
    float bioSun = evalTuringBiomass(wp.xz + sunDir.xz * 0.045, terrainHeight(wp.xz + sunDir.xz * 0.045), grad, iTime);
    float bandShadow = 1.0 - 0.36 * clamp(bioSun - bio * 0.4, 0.0, 1.0);

    // Litter darkening beneath vegetation arcs
    vec3 litterSoil = mix(bareSoil, vec3(0.24, 0.18, 0.12), smoothstep(0.15, 0.72, bio) * 0.72);
    vec3 grassCol = vec3(0.46, 0.44, 0.20) * (0.28 + 1.05 * ndl);
    vec3 acaciaDark = vec3(0.11, 0.21, 0.09);
    vec3 sageOlive = vec3(0.22, 0.30, 0.14);
    vec3 shrubAlb = mix(acaciaDark, sageOlive, smoothstep(0.25, 0.82, species));
    vec3 shrubCol = shrubAlb * (0.22 + 1.28 * ndl * crownLight);

    col = litterSoil * (0.28 + 1.15 * ndl) * bandShadow;
    col = mix(col, grassCol * bandShadow, clamp(grass * 0.85, 0.0, 0.85));
    col = mix(col, shrubCol, canopy);
  }

  // Subtle warm dryland aerial haze toward upper horizon
  float haze = smoothstep(-0.35, 0.52, uv.y) * 0.24;
  col = mix(col, vec3(0.84, 0.72, 0.56), haze);
  col = acesTone(col * 1.12);
  if (abs(uv.x) < 0.003) col = vec3(0.96, 0.94, 0.88);
  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}

Why they connect

Gray-Scott reaction-diffusion runs on the terrain grid and outputs a texture of the B concentration, read here as vegetation biomass. An added advection term along the downhill gradient of the heightfield stretches spots into bands lying across the slope, the way pattern-forming vegetation models of this family behave on hillsides. Plant Ecosystem Distribution Simulation consumes the heightfield and that texture as a suitability map: seeding and survival follow the pattern, while competition picks species and sizes within each patch, and it outputs a point-cloud of plants and a layout.

How to build it

Python or a GPU shader. Run Gray-Scott on the heightfield grid with feed and kill rates mapped from an aridity parameter (spots in the driest areas, labyrinths in wetter ones), plus an upwind advection term scaled by slope. Calibrate the grid scale so band spacing matches the intended real-world spacing. Export the field as a 16-bit texture. Run the ecosystem simulation with the field as moisture and shrub and grass species tuned to it. Scatter instances in Houdini or the engine, and reuse the field to blend ground textures between bare soil and litter.

Field marks

  1. Plain Gray-Scott has no slope coupling; without the advection term, bands do not align with the terrain.
  2. The useful parameter window is narrow and many settings give a dead field.
  3. Pattern scale is tied to grid resolution.
  4. A pattern with hard edges makes the ecosystem simulation produce hard-edged patches.

Prior art

  1. Advection and autocatalysis as organizing principles for banded vegetation patterns. Uses A for B's subject in another field: an ecological model where advection plus an autocatalytic reaction produces banded vegetation, the basis for the slope-advection term rather than a graphics pipeline.
  2. oliturek/Model_Klausmeier-Gray-Scott. Uses A for B's subject in another field: numerical study of a Gray-Scott-type vegetation pattern model from theoretical ecology (per its description), with no plant placement for rendering.
Searches run (4)
  • arXiv: all:"vegetation patterns" AND all:"reaction-diffusion" → 17 results
  • GitHub repos: "vegetation patterns" reaction-diffusion → 2 results
  • arXiv: all:"procedural vegetation" AND all:"Turing pattern" → 0 results
  • GitHub repos: "procedural vegetation" "Turing pattern" → 0 results