Enabling and using Vulkan’s MSAA
MSAA is an anti-aliasing technique that is used to reduce the jagged edges that can appear on curved lines and diagonal edges. Here’s an overview of how it works:
- Multiple samples: Instead of sampling a pixel once (like in regular rendering), MSAA takes multiple samples within each pixel. For example, 4 x MSAA needs 4 samples while 8 x MSAA needs 8 samples. The fragment shader runs for each one of the samples, and their output is stored for processing in step 3.
- Edge detection: MSAA only multi-samples pixels that are at the edges of geometry. This makes it more performance-efficient compared to techniques such as super-sampling, which samples the entire image at a higher resolution.
- Combining samples: Once the samples are taken, they are averaged (or resolved) into a single-color value for the pixel. If some of the samples are within an object and some are outside it, the final pixel color will be a blend, creating a smoother...