Implementing computed meshes
In the Generating textures in Vulkan using compute shaders recipe, we learned how to write pixel data into textures from compute shaders. We are going to need that data in the next chapter to implement a BRDF precomputation tool for our physically-based rendering 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 the triangulated geometry of a 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 coprime integers, p and q. To find out more, check out the Wikipedia page: https://en.wikipedia.org/wiki/Torus_knot.
A compute shader generates vertex data, including positions, texture coordinates, and...