Doing frustum culling on the GPU with compute shaders
In the previous recipe, we explored how to cull invisible meshes on the CPU using the classic AABB-to-frustum method. However, this CPU-based approach has its limitations. Now, let’s learn how to use Vulkan compute shaders to implement a basic frustum culling pipeline on the GPU.
The goal of this recipe is to demonstrate what can be achieved on modern GPUs using compute pipelines and indirect rendering, rather than to create an efficient culling system. Once you are comfortable with the basics, we can explore the limitations and discuss potential directions for improvement.
Getting ready
Be sure to read the previous recipe, Doing frustum culling on the CPU, to familiarize yourself with the basics of frustum culling.
The source code for this recipe is available in Chapter11/02_CullingGPU
.
How to do it…
The concept behind this recipe is simple. We’ll take the C++ isAABBinFrustum()
helper...