An octree is a digital tree structure used to create three-dimensional (3D) and polygonal creations, mostly for the gaming industry. In the octree structure, each internal node has either no children or eight children — nothing in between — and each child node is able to hold color information for the red-blue-green (RGB) color profile. The entire structure starts as one cube, and empty internal cubes are used for collision information. This structure is very memory efficient, because there is a relatively small amount of data held in each child and the tree can be limited in size.
When a model is made for a video game, it needs to have texture and color information and must be able to collide with other models. One of the structures used in this industry is the octree. Sometimes called an oct tree, this name signifies the importance of the number eight in this tree structure. Like make tree structures, the octree has parent and child nodes. Unlike other trees, there is very little variety in how many child nodes can be made from the parent.
Each parent can include either eight nodes or none. Both cube types are important in creating a fully rendered model. The most intensive cubes are the ones with eight nodes. Each internal node includes color and texture information, so the model can have an intricate appearance. For example, if the model is a tree, each of the internal nodes must include a brown color for the trunk, and shading information to create a realistic texture.
While the cubes with eight nodes are important to an octree, the empty cubes are just as important. The entire structure starts out as one large empty cube, which other smaller cubes can inhabit. This cube, along with other empty cubes, is used primarily for collision information. For example, if one model bumps into this model, the empty cubes will tell the model that it cannot advance, because it creates a collision.
Creating a proper model with an octree is intensive, and a lot of information goes into it, but the structure itself uses memory very efficiently. One reason for this is that, while there is a lot of coding, the information is just color and texture information and, thus, rather small. Another reason is that the tree has different levels that hold unneeded data and, if pruned, the memory can be scaled down even more.