Seasons : visibility test (frustum culling)

Hi everybody!

Last week I tried to make rendering code optimisation in order to speed up the frametime.

>> Context

Until now, I didn’t bother too much about optimising stuff; some optimisation techniques were implemented but were very somewhat buggy.
The main reason for such bugged code is that we switched from pure 2D/orthographic to 3D/perspective way of thinking the rendering and the game.

>> Frustum

The main thing to do when optimizing rendering is trying to render only what will be visible on screen. It seems logical but it’s not automatically done by a graphic card… you have to do it by yourself on CPU side and only send minimum stuff to the drawing. The process is called culling.

To achieve such an optimisation, you can rely on the frustum. Frustum is a truncated pyramid shape which defines what the camera will actually project on screen. Objects partially or entirely contained in the frustum will be potentially visible on screen (potentially because some other objects may occlude other ones).

Camera frustum

Continue Reading