-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

3D Graphics Rendering Cookbook
By :

In the Initializing compute shaders in Vulkan recipe, we learned how to initialize the compute pipeline in Vulkan. We are going to need it in this chapter to implement a BRDF precomputation tool for our PBR pipeline. But before that, let's learn a few simple and interesting ways to use compute shaders in Vulkan and combine this feature with mesh geometry generation on the GPU.
We are going to run a compute shader to create triangulated geometry of a three-dimensional (3D) torus knot shape with different P
and Q
parameters.
Important note
A torus knot is a special kind of knot that lies on the surface of an unknotted torus in 3D space. Each torus knot is specified by a pair of p
and q
coprime integers. You can read more on this at https://en.wikipedia.org/wiki/Torus_knot.
The data produced by the compute shader is stored in a shader storage buffer and used in a vertex shader in a typical programmable-vertex-fetch way. To make the...