Doing frustum culling on the GPU with compute shaders
In the previous recipe, we learned how to cull invisible meshes on the CPU in a classic and somewhat old-fashioned way. As GPUs grew more and more performant, this CPU-based approach became very inefficient. Let's learn how to utilize compute shaders to implement a frustum culling pipeline on a GPU using OpenGL.
The goal of this recipe is to teach you what you can do on modern GPUs with compute pipelines rather than implementing a very performant culling system. Once we are comfortable with the basics, we will discuss the limitations, as well as further directions for improvements.
Getting ready
Make sure you have read the previous recipe, Doing frustum culling on the CPU, so that you're familiar with the frustum culling basics.
The source code for this recipe can be found at Chapter10/GL02_CullingGPU
.
How to do it…
Let's take a look at how we can port the C++ culling code from the previous...