Culling is the process of removing parts of a scene that are not visible so the Mali GPU does not have to draw them. There are a number of methods of culling. These range from very coarse types of culling performed by the application to very fine culling of individual triangles and fragments performed by the Mali GPU.
It is best to cull entire objects and draw calls in the application and let the GPU cull individual triangles. In scenes with many triangles, triangle culling can be a highly intensive operation. If you use the application processor to do this it is likely to reduce the performance of your application.
- Enable back face culling
Back face culling is an OpenGL ES option. When it is enabled the GPU removes the back facing triangles in objects so they are not drawn.
- Enable depth testing
Depth testing is an OpenGL ES option that discards fragments that are behind previously drawn fragments. This reduces the amount of computation required by the GPU.
- Use bounding shapes and view frustum culling
You can reduce the number of runtime computations required for culling by using bounding boxes, spheres and other shapes to contain complex objects.
By using these shapes to calculate what objects are visible your application can remove invisible objects and only send information for the visible objects to the GPU.
For example, you can cull the following because they are not visible:
Any object outside the view frustum.
Any object that is behind the camera plane.
- Work out what parts of the world are visible
In applications such as mapping or games, only certain parts of the world are visible at any given time. You can reduce GPU work by working out what sections of the world are visible at different locations in the application before runtime. At runtime the application uses this information to determine what objects are visible and the Mali GPU only processes these.
Figure 11.1 shows a section of a world in a game. The Mali GPU must process all of this data if there is no culling.
Figure 11.2 shows the same section of the game world where the greyed sections are culled. Only the remaining colored section is processed. By culling the greyed sections, the amount of data the Mali GPU processes is reduced considerably.