{
 "id": "space-colonization-trees",
 "title": "Space Colonization Tree Modeling",
 "aliases": [
  "space colonization algorithm",
  "venation-inspired branching"
 ],
 "domain": "procgen",
 "subdomain": "plants and vegetation",
 "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",
 "summary": "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.",
 "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": "Choose it for trees and bushes where the silhouette matters, shaping crowns to a volume, and for roots, veins or lightning. Prefer `l-systems` when you need developmental semantics or perfect repetition, and `climbing-plants-simulation` when growth should follow a surface.",
 "cost": {
  "class": "cheap",
  "notes": "Nearest-neighbour search per attractor per iteration; thousands of attractors run interactively with a spatial hash."
 },
 "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.2312/nph/nph07/063-070",
   "type": "paper",
   "title": "Modeling Trees with a Space Colonization Algorithm",
   "authors": [
    "Adam Runions",
    "Brendan Lane",
    "Przemyslaw Prusinkiewicz"
   ],
   "year": 2007,
   "venue": "Eurographics Workshop on Natural Phenomena",
   "url": "https://doi.org/10.2312/nph/nph07/063-070",
   "ids": {
    "doi": "10.2312/nph/nph07/063-070"
   },
   "license": null,
   "extra": {
    "csl_type": "article"
   },
   "provenance": {
    "title": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/nph/nph07/063-070 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/nph/nph07/063-070 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/nph/nph07/063-070 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/nph/nph07/063-070 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.2312/nph/nph07/063-070 (CSL-JSON)",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "runions2007modeling"
  },
  {
   "role": "primary",
   "key": "url:https://algorithmicbotany.org/papers/colonization.egwnp2007.html",
   "type": "web",
   "title": "Modeling Trees with a Space Colonization Algorithm",
   "authors": [
    "Adam Runions",
    "Brendan Lane",
    "Przemyslaw Prusinkiewicz"
   ],
   "year": null,
   "venue": "algorithmicbotany.org",
   "url": "https://algorithmicbotany.org/papers/colonization.egwnp2007.html",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260610093813/https://www.algorithmicbotany.org/papers/colonization.egwnp2007.html",
     "timestamp": "20260610093813"
    },
    "page_title": "Modeling Trees with a Space Colonization Algorithm",
    "host": "algorithmicbotany.org",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://algorithmicbotany.org/papers/colonization.egwnp2007.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://algorithmicbotany.org/papers/colonization.egwnp2007.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://algorithmicbotany.org/papers/colonization.egwnp2007.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "runionsmodeling"
  },
  {
   "role": "implementation",
   "key": "gh:dgreenheck/ez-tree",
   "type": "code",
   "title": "dgreenheck/ez-tree",
   "description": "Procedural tree generator written with JavaScript and Three.js",
   "authors": [
    "dgreenheck"
   ],
   "year": 2024,
   "venue": "GitHub",
   "url": "https://github.com/dgreenheck/ez-tree",
   "ids": {
    "repo": "dgreenheck/ez-tree"
   },
   "license": "MIT",
   "extra": {
    "stars": 1797,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-07-16T19:53:01Z",
    "language": "JavaScript",
    "homepage": "https://www.eztree.dev",
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/dgreenheck/ez-tree",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/dgreenheck/ez-tree",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/dgreenheck/ez-tree",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/dgreenheck/ez-tree",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/dgreenheck/ez-tree",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/dgreenheck/ez-tree",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "dgreenheck2024dgreenheck"
  }
 ],
 "presets": [
  {
   "id": "space-colonization-trees-live",
   "title": "Space Colonization Trees — crown attraction points & skeleton (left) vs pipe-model tree & foliage (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_GROWTH_PROG": 0.9,
    "P_CROWN_SPREAD": 1,
    "P_BRANCH_THICK": 1,
    "P_SPLIT": 0.46
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_GROWTH_PROG = 0.90; // P Colonization [0.25, 1.0, 0.02]\nconst float P_CROWN_SPREAD = 1.0; // P Crown Width [0.6, 1.4, 0.04]\nconst float P_BRANCH_THICK = 1.0; // P Pipe Thickness [0.5, 1.6, 0.05]\nconst float P_SPLIT = 0.46; // P Attractors / Tree [0.0, 1.0, 0.02]\n\nfloat sdTaperSeg(vec2 p, vec2 a, vec2 b, float rA, float rB, out float h) {\n  vec2 pa = p - a, ba = b - a;\n  h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);\n  return length(pa - ba * h) - mix(rA, rB, h);\n}\n\nvec2 hash21(float x) {\n  vec3 p = fract(vec3(x) * vec3(0.1031, 0.1030, 0.0973));\n  p += dot(p, p.yzx + 33.33);\n  return fract((p.xx + p.yz) * p.zy);\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool isAttractorVis = screenX < split;\n  float prog = clamp(P_GROWTH_PROG, 0.2, 1.0);\n  float spread = clamp(P_CROWN_SPREAD, 0.5, 1.5);\n  float thick = clamp(P_BRANCH_THICK, 0.4, 1.8);\n\n  // Twilight botanical backdrop\n  vec3 col = mix(vec3(0.032, 0.044, 0.068), vec3(0.088, 0.125, 0.185), smoothstep(-0.48, 0.52, uv.y));\n  // Subtle soil ground line\n  if (uv.y < -0.38) {\n    col = mix(vec3(0.09, 0.12, 0.08), vec3(0.04, 0.06, 0.05), smoothstep(-0.38, -0.50, uv.y));\n  }\n\n  // Crown envelope bounding ellipse (guides space colonization attraction cloud)\n  vec2 crownCenter = vec2(0.0, 0.12);\n  vec2 crownRad = vec2(0.42 * spread, 0.30);\n  float dCrown = length((uv - crownCenter) / crownRad) - 1.0;\n  if (isAttractorVis) {\n    col += vec3(0.14, 0.56, 0.72) * exp(-abs(dCrown) * 32.0) * 0.35;\n  }\n\n  // Animated wind sway\n  float wind = sin(iTime * 1.15) * 0.018;\n\n  // Compute space-colonization branching tree skeleton (trunk -> 3 primary boughs -> 9 secondary -> 18 twigs)\n  float minTreeD = 1e5;\n  float branchAge = 0.0;\n  float hTmp;\n\n  vec2 pRoot = vec2(0.0, -0.40);\n  vec2 pFork = vec2(wind * 0.4, -0.10);\n  float dTrunk = sdTaperSeg(uv, pRoot, pFork, 0.036 * thick, 0.025 * thick, hTmp);\n  if (dTrunk < minTreeD) { minTreeD = dTrunk; branchAge = 0.1; }\n\n  // 3 main boughs growing into left, center, and right crown zones\n  for (int i = 0; i < 3; i++) {\n    float fi = float(i) - 1.0;\n    vec2 b1 = pFork + vec2((fi * 0.24 * spread) + wind * 0.9, 0.19 + (1.0 - abs(fi)) * 0.07);\n    vec2 b1Grow = mix(pFork, b1, clamp(prog * 1.6, 0.0, 1.0));\n    float dB1 = sdTaperSeg(uv, pFork, b1Grow, 0.021 * thick, 0.013 * thick, hTmp);\n    if (dB1 < minTreeD) { minTreeD = dB1; branchAge = 0.35; }\n\n    // 3 secondary branches per main bough pulled toward crown attractor sectors\n    if (prog > 0.38) {\n      float p2 = clamp((prog - 0.38) / 0.35, 0.0, 1.0);\n      for (int j = 0; j < 3; j++) {\n        float fj = float(j) - 1.0;\n        vec2 angOff = vec2((fi * 0.11 + fj * 0.13) * spread + wind * 1.5, 0.15 + (1.0 - abs(fj)) * 0.06);\n        vec2 b2 = b1 + angOff;\n        vec2 b2Grow = mix(b1, b2, p2);\n        float dB2 = sdTaperSeg(uv, b1, b2Grow, 0.012 * thick, 0.0065 * thick, hTmp);\n        if (dB2 < minTreeD) { minTreeD = dB2; branchAge = 0.65; }\n\n        // 2 fine terminal twigs reaching remaining attractors\n        if (prog > 0.66) {\n          float p3 = clamp((prog - 0.66) / 0.34, 0.0, 1.0);\n          for (int k = 0; k < 2; k++) {\n            float fk = (float(k) - 0.5) * 2.0;\n            vec2 b3 = b2 + vec2((fk * 0.075 + fj * 0.03) * spread + wind * 2.0, 0.085 + 0.02 * cos(fi + fj));\n            vec2 b3Grow = mix(b2, b3, p3);\n            float dB3 = sdTaperSeg(uv, b2, b3Grow, 0.0055 * thick, 0.0022 * thick, hTmp);\n            if (dB3 < minTreeD) { minTreeD = dB3; branchAge = 0.92; }\n\n            // Soft foliage cluster on right side around colonized twig tips!\n            if (!isAttractorVis) {\n              float dLeaf = length(uv - b3Grow);\n              float leafMask = smoothstep(0.085 * p3, 0.018, dLeaf);\n              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));\n              // Sunlight gradient on canopy top\n              leafCol *= (0.68 + 0.48 * smoothstep(-0.05, 0.38, uv.y));\n              col = mix(col, leafCol, leafMask * 0.78);\n            }\n          }\n        }\n      }\n    }\n  }\n\n  // Draw woody bark skeleton (left: glowing vector-growth skeleton; right: shaded bark)\n  float barkMask = smoothstep(0.004, -0.002, minTreeD);\n  vec3 barkCol = isAttractorVis\n    ? mix(vec3(0.96, 0.72, 0.28), vec3(0.28, 0.95, 0.86), branchAge)\n    : mix(vec3(0.32, 0.22, 0.15), vec3(0.48, 0.36, 0.24), branchAge);\n  col = mix(col, barkCol, barkMask);\n\n  // On left side, scatter 28 crown attraction points (glowing cyan dots that vanish once colonized!)\n  if (isAttractorVis) {\n    for (int a = 0; a < 28; a++) {\n      vec2 r = hash21(float(a) * 13.7 + 4.1);\n      float ang = r.x * 6.2831853;\n      float rad = sqrt(r.y);\n      vec2 pt = crownCenter + vec2(cos(ang) * crownRad.x, sin(ang) * crownRad.y) * rad * 0.95;\n      float dPt = length(uv - pt);\n      // Outer attractors remain active (bright cyan); inner ones show dim colonized rings\n      float isActive = smoothstep(0.35 * prog, 0.92 * prog, rad);\n      vec3 ptCol = mix(vec3(0.22, 0.36, 0.48), vec3(0.20, 0.95, 1.0), isActive);\n      col += ptCol * exp(-dPt * 95.0) * (0.45 + 0.85 * isActive);\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "space-colonization-trees",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T20:35:56.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4172,
      "std": 0.1649,
      "min": 0.2234,
      "max": 0.9236
     },
     "image": "/specimens/space-colonization-trees-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "l-systems",
  "climbing-plants-simulation",
  "ecosystem-plant-distribution",
  "poisson-disk-sampling"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "poisson-disk-sampling",
   "why": "Blue-noise attractor points give evenly spread attractors inside the crown volume."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/procgen/space-colonization-trees.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Runions et al., 2007",
 "url": "https://texelatlas.vercel.app/t/space-colonization-trees/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 18.71,
  "tier": "moderate",
  "p50_ms": 0.6155,
  "p95_ms": 0.6487,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "space-colonization-trees-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 15.47,
   "tier": "moderate",
   "p50_ms": 0.2459,
   "p95_ms": 0.2509,
   "speedup_x": 2.5,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 11.99,
   "tier": "moderate",
   "p50_ms": 0.3453,
   "p95_ms": 0.3461,
   "speedup_x": 1.78,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}