Fragments (or pixels) are parts of the image that can be potentially displayed on screen. They are created from geometry (drawn primitives) in a process called rasterization. They have specific screen space coordinates (x, y, and depth) but don't have any other data. We need to write a fragment shader to specify the color that needs to be displayed on screen. In the fragment shader, we can also select an attachment into which a given color should be written.
Writing fragment shaders
How to do it...
- Create a text file. Select a name for the file, but use a frag extension for it (for example, shader.frag).
- Insert #version 450 in the first line of the file.
- Define a set of input variables (attributes) that are provided from the earlier pipeline stages. For each...