Evidence at a Glance
Validated against an unevenly distributed 3D workload.
Measured with the Stanford Dragon model.
A 10-million-point Quadtree/Octree test versus naïve search.
Overview
Spatium is a collection of spatial-partitioning structures built for real-time applications and coursework: multiple Bounding Volume Hierarchies, a K-D Tree, Quadtree, and Octree. The project compares construction strategies rather than stopping at one textbook implementation.
The BVH work spans top-down SAH construction, a two-pass bottom-up merge using priority-driven candidate pairing, and incremental insertion with volume heuristics and self-balancing. The K-D Tree samples candidate split positions along each AABB axis and chooses the lowest-cost Surface Area Heuristic result.
Memory behavior is part of the design. Bit packing, locational codes, and compact node representations reduce per-node overhead and improve traversal locality for large point and triangle sets.
The Challenge
Spatial structures trade construction time, memory, update cost, and traversal performance against one another. A strategy that wins for a static mesh may be wrong for a changing scene or a large point query.
The implementation therefore needed repeatable workloads and enough instrumentation to compare not just whether each tree worked, but where it began to struggle.
Key Engineering Decisions
Implement Three BVH Construction Families
Top-down, bottom-up, and incremental approaches make construction and update trade-offs directly comparable in one codebase.
Use SAH Where Split Quality Matters
Candidate positions are evaluated against estimated traversal cost instead of selecting a midpoint blindly.
Keep Point Structures Compact
Bit packing and locational codes reduce node overhead for Quadtree and Octree workloads at multi-million-point scale.
Test Against Recognisable Dense Geometry
Stanford models and uneven 3D scenes provide workloads that are easier to inspect and reproduce than synthetic success cases alone.
What I Owned
Results
Gallery


Videos
Valuable Lessons
Construction strategy has to be evaluated alongside query cost; the cheapest tree to build is not always the cheapest structure to use.
A future benchmark pass should publish hardware, build time, query time, and memory on the same chart for every structure.
