Particle
Colliding pair
Octree node bounds
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.
An octree recursively subdivides a cube of 3D space into eight octants wherever too many objects land in one region, turning collision detection from an O(n²) check-every-pair problem into something closer to O(n log n). This simulator builds a fresh loose octree every frame around a swarm of moving spheres, draws every node's bounding cube, and highlights real sphere-sphere collisions in red — with live counters comparing how many comparisons the octree actually performed against how many a naive all-pairs check would have needed. Tune the per-node object cap and the maximum subdivision depth to see the tree grow shallower or deeper, and how that trades node-traversal overhead against comparisons per leaf.