# Optimizing Octree Rendering

Say I have an octree and at a certain level I store VBOs in that octree. I know the dimensions of of the nodes that own the vbo so I can do basic frustum culling. That works nicely because everything outside of the screen is never rendered.

However my world is quite big and I currently also draw things behind already drawn octrees. What would I use to not draw nodes that are occluded by other nodes and how would I go about that?

I saw some mentions of occlusion culling in the OpenGL superbible but I fail to see how I can utilize that when I don't have a clear distinction between occluders and occludees.

• If the contents of a node don't necessarily completely fill a node then I can't see how you could use your octree for occlusion – CiscoIPPhone Nov 16 '10 at 1:21
• You can use the octree contents as occluders, and the octree nodes as occludees. The aggregate pixel coverage of several partially filled nodes (i.e., partial in that it doesn't map to the full pixel footprint of the octree node cube) can easily form a large occluder, and this can block octree nodes that are further away from the camera. – Crowley9 Nov 16 '10 at 8:03

OpenGL natively does not support occlusion queries but you can use extensions such as ARB_occlusion_query. The link has a project and a nice PDF that explains how to use it. Be careful though, sometimes the occlusion queries end up to be more costly than simply drawing the geometry. This is especially true if you geometry is not very complex.