Physarum agent transport networks
Multi-agent slime-mold model: agents deposit and follow a trail map, producing self-organising vein-like networks that join points of interest.
In the family Simulation & animation, pattern formation
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 Physarum agent transport-network simulation. |
| Unity | None found | |
| Unreal 5.7 | None found | No built-in Physarum agent transport-network simulation. |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Thousands of agents carry a position and heading. Each step an agent samples the trail map at three sensors (left, ahead, right) at a sensor distance, turns toward the strongest, moves forward a fixed step, and deposits chemoattractant at its position. The trail map is then diffused (blur) and decayed. This feedback concentrates flow into thin lines that merge and prune into transport-network graphs, and food sources or heightmaps bias agents toward targets. On the GPU the agents run in a compute pass and the trail map is a ping-pong texture. Parameters (sensor angle and distance, turn speed, decay, diffusion) change the look from filaments to webs to blobs.
When to choose it
Reach for it when
- want organic vein or root-like networks
- generate city-like path networks connecting points
- need slime-mould style generative art
- branching network textures from simple agents
Choose it for organic network, vein, root and city-like path structures, or generative art with an agent-driven look. Prefer Gray-Scott reaction-diffusion for spot/stripe/maze patterns, Boids flocking for flocks that do not need a persistent trail, and graph algorithms (MST, Steiner) when you need an exact optimal network.
Field marks
- Result is sensitive to parameters: collapses into dots or saturates into blobs
- Agents clump in corners and borders unless boundary rules are added
- Trail-map resolution limits how thin the lines can get
- Not a real graph: extracting a clean network needs thinning and cleanup
Presets
Physarum transport networks — emergent slime-mould branching veins & chemotaxis flux
{
"P_VEIN_SHARPNESS": 1.2,
"P_FLUX_SPEED": 1,
"P_BRANCH_SCALE": 5.5,
"P_NODE_GLOW": 1.1
}Show GLSL (107 lines)
const float P_VEIN_SHARPNESS = 1.2; // P Vein Sharpness [0.4, 2.5, 0.05]
const float P_FLUX_SPEED = 1.0; // P Flux Speed [0.0, 2.5, 0.05]
const float P_BRANCH_SCALE = 5.5; // P Network Scale [2.5, 10.0, 0.2]
const float P_NODE_GLOW = 1.1; // P Nutrient Glow [0.0, 2.2, 0.05]
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);
}
// Smooth Voronoi edge distance (F2 - F1) yielding organic anastomosing transport ridges
vec3 voronoiVein(vec2 p, float t) {
vec2 n = floor(p);
vec2 f = fract(p);
float d1 = 8.0, d2 = 8.0;
vec2 bestOff = vec2(0.0);
for (int j = -1; j <= 1; j++) {
for (int i = -1; i <= 1; i++) {
vec2 g = vec2(float(i), float(j));
vec2 o = hash22(n + g);
o = 0.5 + 0.38 * sin(t * 0.45 + 6.2831 * o);
vec2 r = g + o - f;
float d = dot(r, r);
if (d < d1) {
d2 = d1;
d1 = d;
bestOff = r;
} else if (d < d2) {
d2 = d;
}
}
}
float edge = sqrt(d2) - sqrt(d1);
return vec3(edge, sqrt(d1), atan(bestOff.y, bestOff.x));
}
// Organic domain warp to mimic adaptive chemotaxis meandering
vec2 warp(vec2 p, float t) {
float a = sin(p.x * 2.1 + t * 0.3) * cos(p.y * 2.3 - t * 0.25);
float b = cos(p.x * 1.9 - t * 0.22) * sin(p.y * 2.5 + t * 0.28);
return p + 0.14 * vec2(a, b);
}
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 t = iTime * max(P_FLUX_SPEED, 0.0);
float scale = clamp(P_BRANCH_SCALE, 2.0, 12.0);
float sharp = clamp(P_VEIN_SHARPNESS, 0.3, 3.0);
// Petri dish dark agar backdrop with subtle radial depth
vec3 bg = mix(vec3(0.015, 0.024, 0.032), vec3(0.035, 0.055, 0.068), smoothstep(0.65, 0.0, length(uv)));
// Three hierarchical Physarum transport vein scales (primary trunks, secondary vessels, fine capillaries)
vec2 wp = warp(uv, t * 0.6);
vec3 v1 = voronoiVein(wp * scale * 0.62, t * 0.4);
vec3 v2 = voronoiVein(wp * scale * 1.25 + vec2(3.7, 1.9), t * 0.65);
vec3 v3 = voronoiVein(wp * scale * 2.55 - vec2(1.4, 4.2), t * 0.85);
// Peristaltic shuttle-streaming pulse traveling along veins
float pulse1 = 0.65 + 0.35 * sin(v1.z * 3.0 - t * 3.4 + length(uv) * 8.0);
float pulse2 = 0.65 + 0.35 * sin(v2.z * 4.0 + t * 4.2 - length(uv) * 12.0);
// Nutrient food nodes anchoring high-flux primary highways
float nodeField = 0.0;
float nodeCore = 0.0;
for (int i = 0; i < 6; i++) {
float fi = float(i);
float ang = fi * 1.0472 + 0.25 * sin(t * 0.2 + fi);
float rad = 0.26 + 0.11 * sin(fi * 2.1 + 0.4);
vec2 np = vec2(cos(ang), sin(ang)) * rad;
float d = length(uv - np);
nodeField += exp(-d * 4.8);
nodeCore += exp(-d * 24.0);
}
float colonyMask = smoothstep(0.62, 0.14, length(uv) - 0.08 * nodeField);
// Adaptive vein thickness reinforced near nutrient sources
float trunk = exp(-v1.x * (12.0 * sharp / (0.75 + 0.65 * nodeField))) * pulse1;
float branch = exp(-v2.x * (17.0 * sharp)) * pulse2 * (0.45 + 0.55 * trunk + 0.35 * nodeField);
float capil = exp(-v3.x * (24.0 * sharp)) * (0.28 + 0.6 * branch);
float density = (trunk * 1.15 + branch * 0.72 + capil * 0.38) * colonyMask;
// Chemotaxis agent micro-sparks streaming through the veins
float agentWave = 0.5 + 0.5 * sin(v1.y * 42.0 - t * 6.0) * cos(v2.y * 36.0 + t * 5.0);
float agents = pow(agentWave, 4.0) * smoothstep(0.2, 0.85, trunk + branch * 0.6);
// Bioluminescent Physarum gold/amber core with cyan chemotaxis trail halo
vec3 trailHalo = vec3(0.08, 0.42, 0.52) * pow(clamp(density, 0.0, 1.0), 0.7) * 0.65;
vec3 veinGold = vec3(1.15, 0.78, 0.18) * pow(clamp(density, 0.0, 1.4), 1.35);
vec3 veinCore = vec3(1.45, 1.28, 0.72) * smoothstep(0.62, 1.35, density) * 0.85;
vec3 sparkCol = vec3(0.45, 1.0, 0.85) * agents * 0.85;
vec3 foodCol = vec3(0.28, 0.92, 1.15) * nodeCore * max(P_NODE_GLOW, 0.0) * 1.1;
vec3 col = bg + trailHalo + veinGold + veinCore + sparkCol + foodCol;
// Faint petri dish rim
float rim = smoothstep(0.012, 0.0, abs(length(uv) - 0.46));
col += vec3(0.14, 0.24, 0.32) * rim * 0.4;
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 |
|---|---|---|---|
| physarum-transport-networks-live | Tesla T4 1920x1080 | 23.1× baseline (heavy) · 0.759 ms / 0.836 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| physarum-transport-networks-live | NVIDIA L4 1920x1080 | 23.1× baseline (heavy) · 0.367 ms / 0.370 ms · 2.1× faster on L4 | opengl-timer-query · Cross-architecture validation |
| physarum-transport-networks-live | NVIDIA A100-SXM4-40GB 1920x1080 | 15.1× baseline (moderate) · 0.433 ms / 0.434 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Boids flocking.
Crosses
- Cities wired by slime mould: Road networks that emerge from transport demand between settlements instead of hand-tuned growth rules. A slime-mould agent simulation links points of interest with efficient, redundant trails, which steer a street generator whose lots become buildings.
Sources
- primaryJeff Jones (2010). Characteristics of Pattern Formation and Evolution in Approximations of <i>Physarum</i> Transport Networks. Artificial Life.Verified via crossref · 2026-11-29doi:10.1162/artl.2010.16.2.16202