Writing tessellation control shaders
Tessellation is a process that divides geometry into much smaller parts. In graphics programming, it allows us to improve the number of details of rendered objects or to dynamically change their parameters, such as smoothness or shape, in much more flexible way.
Tessellation in Vulkan is optional. If enabled, it is performed after the vertex shader. It has three steps, of which two are programmable. The first programmable tessellation stage is used to set up parameters that control how the tessellation is performed. We do this by writing tessellation control shaders that specify values of tessellation factors.
How to do it...
- Create a text file. Select a name for the file, but use a
tesc
extension for it (for example,shader.tesc
). - Insert
#version 450
in the first line of the file. - Define the number of vertices that will form an output patch:
layout( vertices = <count> ) out;
- Define a set of input variables (attributes) that are provided from (written...