← Lessons

quiz vs the machine

Gold1540

Algorithms

Bounding Volume Hierarchy

Wrap objects in nested boxes so a query rejects whole groups with a single cheap test.

6 min read · core · beat Gold to climb

Boxes around objects

A bounding volume hierarchy, or BVH, is a tree where each node holds a simple bounding volume, often an axis aligned box, that fully encloses everything beneath it. Leaves contain the actual objects.

  • A parent box encloses all of its children.
  • The boxes are cheap to test against, unlike the detailed shapes.

Accelerating queries

For a query such as a ray in rendering or a moving body in collision detection, you test the query against a node's box first.

  • If the query misses the box, every object inside is skipped at once.
  • If it hits, you recurse into the children.

This lets a single cheap rejection prune large subtrees, which is why BVHs power ray tracing and physics engines.

Building a good tree

Construction quality matters. A common heuristic is the surface area heuristic, which splits objects to minimize the expected cost of traversal by balancing box surface area against the objects contained.

  • Tight, non overlapping boxes give the best pruning.
  • Overlap forces both branches to be visited.

Key idea

A bounding volume hierarchy nests objects inside enclosing boxes, so a query that misses a box discards the whole subtree at once, accelerating ray tracing and collision tests when boxes are tight and non overlapping.

Check yourself

Answer to earn rating on the learn ladder.

1. What happens when a query misses a node's bounding box?

2. What does the surface area heuristic aim to minimize?