Dietrich Epp

BSP Trees, Part 3: The Big Benefit

One of the major challenges in a 3D engine — especially real-time ones such as Quake and Doom — is figuring out what order to draw the polygons in. But Quake uses a Z Buffer, you say? Yes, but only for the entities, the extra bits that move around.

Figure 3

Here is the example from part one, with a player added (the player is the red dot). The engine starts with the root node, A, then traverses the tree, visiting every node. The decision is now extremely easy. If you want to draw the polygons that are closer first (which is often the case), then draw the side of A that the player is on first. Computers are good at figuring that out very quickly.

In other words, you draw C first, then you draw A, then B. C is everything on the right side of the line, A is everything on the line, and B is everything on the other side of the line.

Drawing C is just like drawing A — both of them are BSP trees.