---
id: "space-colonization-trees"
title: "Space Colonization Tree Modeling"
aliases: [space colonization algorithm, venation-inspired branching]
domain: "procgen"
stage: "procedural"
realtime: "interactive"
platforms: [cpu, webgl2, blender, houdini, unity, unreal, godot, python]
year_introduced: 2007
inputs: [point-cloud]
outputs: [graph, curves, mesh]
style: "both"
dynamic: "static"
cost: "cheap"
authority: "Runions et al., 2007"
url: "https://texelatlas.vercel.app/t/space-colonization-trees/"
sources_verified_at: "2026-11-29"
---
# Space Colonization Tree Modeling (Runions et al., 2007)

> Grow a branching skeleton by scattering attractor points in a crown volume. Each branch tip grows toward the average direction of the attractors that choose it, and attractors are deleted when reached.

## Reach for it when

- need trees whose crown fits a given silhouette
- procedural branches look rigid or repetitive
- grow roots, veins or lightning bolts procedurally
- want bushes shaped by a volume

## How it works

Start with a root node and a cloud of attractor points filling the intended crown volume or shape. In each iteration, every attractor finds its nearest branch node within an influence radius. Nodes that were chosen by at least one attractor grow a new child node in the normalised mean direction toward their attractors. Attractors closer than a kill distance to any node are removed. The loop ends when no attractors remain or no node grows. Competition for space emerges naturally: nodes near each other share attractors, giving self-pruning, gaps and natural-looking crowns. Branch thickness is computed afterwards from the leaf count or pipe model (radius from child radii), and the skeleton is skinned into a mesh. Shape control comes from where attractors are placed; the same algorithm models leaf venation.

## When to use it

Choose it for trees and bushes where the silhouette matters, shaping crowns to a volume, and for roots, veins or lightning. Prefer [L-Systems](https://texelatlas.vercel.app/t/l-systems.md) when you need developmental semantics or perfect repetition, and [Interactive Climbing Plant Modeling](https://texelatlas.vercel.app/t/climbing-plants-simulation.md) when growth should follow a surface.

## Cost

cheap — Nearest-neighbour search per attractor per iteration; thousands of attractors run interactively with a spatial hash.
Measured GPU Weight: 18.71× baseline (moderate) — 0.6155 ms median / 0.6487 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 15.47× baseline (moderate) — 0.2459 ms median (2.5× faster on L4).
Ampere A100 scaling: 11.99× baseline (moderate) — 0.3453 ms median (1.78× faster on A100).

## Failure modes

- Influence radius too small leaves attractors unreached and branches stall; too large causes straight, bundled branches
- Branches may pass through each other or the trunk because no collision test exists
- Raw skeleton is jagged; meshing needs smoothing and thickness estimation
- Crown shape is entirely determined by the attractor cloud, so poorly sampled volumes make gaps or clumps

## Dataflow

- Inputs: point-cloud
- Outputs: graph, curves, mesh
- Platforms: cpu, webgl2, blender, houdini, unity, unreal, godot, python

## Presets

### Space Colonization Trees — crown attraction points & skeleton (left) vs pipe-model tree & foliage (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_GROWTH_PROG": 0.9,
  "P_CROWN_SPREAD": 1,
  "P_BRANCH_THICK": 1,
  "P_SPLIT": 0.46
}
```

```glsl
const float P_GROWTH_PROG = 0.90; // P Colonization [0.25, 1.0, 0.02]
const float P_CROWN_SPREAD = 1.0; // P Crown Width [0.6, 1.4, 0.04]
const float P_BRANCH_THICK = 1.0; // P Pipe Thickness [0.5, 1.6, 0.05]
const float P_SPLIT = 0.46; // P Attractors / Tree [0.0, 1.0, 0.02]

float sdTaperSeg(vec2 p, vec2 a, vec2 b, float rA, float rB, out float h) {
  vec2 pa = p - a, ba = b - a;
  h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);
  return length(pa - ba * h) - mix(rA, rB, h);
}

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

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 screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool isAttractorVis = screenX < split;
  float prog = clamp(P_GROWTH_PROG, 0.2, 1.0);
  float spread = clamp(P_CROWN_SPREAD, 0.5, 1.5);
  float thick = clamp(P_BRANCH_THICK, 0.4, 1.8);

  // Twilight botanical backdrop
  vec3 col = mix(vec3(0.032, 0.044, 0.068), vec3(0.088, 0.125, 0.185), smoothstep(-0.48, 0.52, uv.y));
  // Subtle soil ground line
  if (uv.y < -0.38) {
    col = mix(vec3(0.09, 0.12, 0.08), vec3(0.04, 0.06, 0.05), smoothstep(-0.38, -0.50, uv.y));
  }

  // Crown envelope bounding ellipse (guides space colonization attraction cloud)
  vec2 crownCenter = vec2(0.0, 0.12);
  vec2 crownRad = vec2(0.42 * spread, 0.30);
  float dCrown = length((uv - crownCenter) / crownRad) - 1.0;
  if (isAttractorVis) {
    col += vec3(0.14, 0.56, 0.72) * exp(-abs(dCrown) * 32.0) * 0.35;
  }

  // Animated wind sway
  float wind = sin(iTime * 1.15) * 0.018;

  // Compute space-colonization branching tree skeleton (trunk -> 3 primary boughs -> 9 secondary -> 18 twigs)
  float minTreeD = 1e5;
  float branchAge = 0.0;
  float hTmp;

  vec2 pRoot = vec2(0.0, -0.40);
  vec2 pFork = vec2(wind * 0.4, -0.10);
  float dTrunk = sdTaperSeg(uv, pRoot, pFork, 0.036 * thick, 0.025 * thick, hTmp);
  if (dTrunk < minTreeD) { minTreeD = dTrunk; branchAge = 0.1; }

  // 3 main boughs growing into left, center, and right crown zones
  for (int i = 0; i < 3; i++) {
    float fi = float(i) - 1.0;
    vec2 b1 = pFork + vec2((fi * 0.24 * spread) + wind * 0.9, 0.19 + (1.0 - abs(fi)) * 0.07);
    vec2 b1Grow = mix(pFork, b1, clamp(prog * 1.6, 0.0, 1.0));
    float dB1 = sdTaperSeg(uv, pFork, b1Grow, 0.021 * thick, 0.013 * thick, hTmp);
    if (dB1 < minTreeD) { minTreeD = dB1; branchAge = 0.35; }

    // 3 secondary branches per main bough pulled toward crown attractor sectors
    if (prog > 0.38) {
      float p2 = clamp((prog - 0.38) / 0.35, 0.0, 1.0);
      for (int j = 0; j < 3; j++) {
        float fj = float(j) - 1.0;
        vec2 angOff = vec2((fi * 0.11 + fj * 0.13) * spread + wind * 1.5, 0.15 + (1.0 - abs(fj)) * 0.06);
        vec2 b2 = b1 + angOff;
        vec2 b2Grow = mix(b1, b2, p2);
        float dB2 = sdTaperSeg(uv, b1, b2Grow, 0.012 * thick, 0.0065 * thick, hTmp);
        if (dB2 < minTreeD) { minTreeD = dB2; branchAge = 0.65; }

        // 2 fine terminal twigs reaching remaining attractors
        if (prog > 0.66) {
          float p3 = clamp((prog - 0.66) / 0.34, 0.0, 1.0);
          for (int k = 0; k < 2; k++) {
            float fk = (float(k) - 0.5) * 2.0;
            vec2 b3 = b2 + vec2((fk * 0.075 + fj * 0.03) * spread + wind * 2.0, 0.085 + 0.02 * cos(fi + fj));
            vec2 b3Grow = mix(b2, b3, p3);
            float dB3 = sdTaperSeg(uv, b2, b3Grow, 0.0055 * thick, 0.0022 * thick, hTmp);
            if (dB3 < minTreeD) { minTreeD = dB3; branchAge = 0.92; }

            // Soft foliage cluster on right side around colonized twig tips!
            if (!isAttractorVis) {
              float dLeaf = length(uv - b3Grow);
              float leafMask = smoothstep(0.085 * p3, 0.018, dLeaf);
              vec3 leafCol = mix(vec3(0.14, 0.48, 0.22), vec3(0.56, 0.80, 0.24), 0.5 + 0.5 * sin(fi * 2.1 + fj * 3.7 + fk));
              // Sunlight gradient on canopy top
              leafCol *= (0.68 + 0.48 * smoothstep(-0.05, 0.38, uv.y));
              col = mix(col, leafCol, leafMask * 0.78);
            }
          }
        }
      }
    }
  }

  // Draw woody bark skeleton (left: glowing vector-growth skeleton; right: shaded bark)
  float barkMask = smoothstep(0.004, -0.002, minTreeD);
  vec3 barkCol = isAttractorVis
    ? mix(vec3(0.96, 0.72, 0.28), vec3(0.28, 0.95, 0.86), branchAge)
    : mix(vec3(0.32, 0.22, 0.15), vec3(0.48, 0.36, 0.24), branchAge);
  col = mix(col, barkCol, barkMask);

  // On left side, scatter 28 crown attraction points (glowing cyan dots that vanish once colonized!)
  if (isAttractorVis) {
    for (int a = 0; a < 28; a++) {
      vec2 r = hash21(float(a) * 13.7 + 4.1);
      float ang = r.x * 6.2831853;
      float rad = sqrt(r.y);
      vec2 pt = crownCenter + vec2(cos(ang) * crownRad.x, sin(ang) * crownRad.y) * rad * 0.95;
      float dPt = length(uv - pt);
      // Outer attractors remain active (bright cyan); inner ones show dim colonized rings
      float isActive = smoothstep(0.35 * prog, 0.92 * prog, rad);
      vec3 ptCol = mix(vec3(0.22, 0.36, 0.48), vec3(0.20, 0.95, 1.0), isActive);
      col += ptCol * exp(-dPt * 95.0) * (0.45 + 0.85 * isActive);
    }
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.97, 1.0), sep);

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index.

## Combines with

- [Poisson Disk Sampling (Bridson)](https://texelatlas.vercel.app/t/poisson-disk-sampling.md): Blue-noise attractor points give evenly spread attractors inside the crown volume.

## Combination ideas

- [Forests that grow into the gaps](https://texelatlas.vercel.app/ideas/eroded-biome-forests/)
- [Trees grown into a described shape](https://texelatlas.vercel.app/ideas/text-shaped-tree-crowns/)

## Sources

1. [primary] Adam Runions, Brendan Lane, Przemyslaw Prusinkiewicz (2007) Modeling Trees with a Space Colonization Algorithm. Eurographics Workshop on Natural Phenomena. https://doi.org/10.2312/nph/nph07/063-070 (verified via doi.org on 2026-11-29)
2. [primary] Adam Runions, Brendan Lane, Przemyslaw Prusinkiewicz Modeling Trees with a Space Colonization Algorithm. algorithmicbotany.org. https://algorithmicbotany.org/papers/colonization.egwnp2007.html (verified via http on 2026-11-29)
3. [implementation] dgreenheck (2024) dgreenheck/ez-tree. https://github.com/dgreenheck/ez-tree License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Space Colonization Tree Modeling." https://texelatlas.vercel.app/t/space-colonization-trees/ (accessed 2026-12-01).
