Three.js Supply Chain Network Flow Visualization
A four-tier logistics network in Three.js (suppliers, factories, warehouses, stores) with flow-weighted 3D arcs, animated shipments, utilisation bars, and the ability to knock a node offline and watch flows re-route.
Key topics: supply chain visualization, logistics network, flow map, three.js network, shipment animation, capacity planning
Game Over
What this code does
- Demand Pull: store demand propagates upstream, each node splitting its need across open upstream nodes weighted by capacity and proximity.
- Flow Arcs: each lane is a TubeGeometry along a lifted quadratic Bézier, with radius proportional to volume.
- Shipments: parcels spawn at a rate ∝ flow and ride the curves with `getPointAt`, drawn as one InstancedMesh.
- Utilisation: bars beside facilities show load/capacity, amber above 80% and red when overloaded, with overloaded lanes in red.
- Disruption: taking a factory or warehouse offline re-solves the network, often pushing neighbours over capacity.
- Controls: disrupted node, demand multiplier, shipment speed and animation.
Related Demos
Continue Learning
JavaScript Implementation
// Flow arcs: a Bézier lifted between two sites, tube radius ∝ volume, parcels ride the curve
const a = from.position, b = to.position
const mid = a.clone().lerp(b, 0.5).setY(a.distanceTo(b) * 0.18)
const curve = new THREE.QuadraticBezierCurve3(a, mid, b)
scene.add(new THREE.Mesh(new THREE.TubeGeometry(curve, 24, 0.02 + volume / maxVolume * 0.14, 6), material))
parcels.forEach((p, i) => {
p.t += dt * 0.35
parcelMesh.setMatrixAt(i, new THREE.Matrix4().setPosition(curve.getPointAt(p.t)))
})