8.8. How Octrees work   

An octree works in much the same way as a quadtree, with the main differences being the functionality. An octree is concerned with the objects in a 3-D space, not a colour in a 2-D image. The data in the leaf of an octree is the object in which that leaf is residing. Leaves are formed when a node either lies entirely inside or entirely outside an object. The root of the octree represents the defined universe, and all nodes that are not leaves have eight children octants.