Octree culling
Now that we have a frustum and we can check said frustum for intersection against primitives, we can finally implement scene level culling. We will provide the Scene
class with a Frustum
object, the Scene
class will return a list of Model
objects. The OBB of each model within this list intersects the frustum. This way, we only need to consider objects for rendering, which the camera might see.
If a scene is spatially divided with an Octree, this method of culling should increase render time by eliminating non visible objects from being rendered. However, if a scene is not accelerated, and we just linearly test every object against the frustum we might actually make performance worse.
Getting Ready
We are going to add a new method named Cull
to the existing Scene
class. This new method will take a Frustum
as an argument and will return a list of Model
objects that intersect the frustum.
How to do it…
Follow these steps to cull the Octree of a Scene
using a Frustum:
- In
Scene...