Multisample Anti-Aliasing (MSAA) is an anti-aliasing technique that is a more efficient variation of supersampling. Supersampling renders the image at a higher internal resolution before downscaling to the display resolution by performing fragment shading for every pixel at that higher resolution.
MSAA performs the vertex shading normally but then each pixel is divided into subsamples which are tested using a subsample bitwise coverage mask. If any subsamples pass this coverage test, fragment shading is then performed, and the result of the fragment shader is stored in each subsample which passed the coverage test.
By only executing the fragment shader once per pixel, MSAA is substantially more efficient than supersampling although it only mitigates geometric aliasing at the intersection of two triangles.
For VR applications the quality benefits from 4x MSAA far outweigh the cost and it should be used whenever possible. In particular, 4x MSAA reduces the "jaggies" caused by additional fragments that are generated along the edges of triangles.
Mali GPUs are designed for full fragment throughput when using 4x MSAA so it can be used with only a minor effect on performance.
Implementing Multisample Anti-Aliasing in Unity
In Unity, Multisample Anti-Aliasing is set up in the Universal Render Pipeline (URP) settings if you are using URP. Otherwise, it is set up in the Project Quality Settings panel.
To enable MSAA by using the URP panel:
- Go to the Assets window.
- In the Inspector window, go into the Quality drop-down.
- Choose the required MSAA level from the drop-down menu here.
To enable MSAA by using the Project Quality Settings panel:
- Go to Edit, then Project Settings.
- Selecting Quality opens the Project Quality Settings panel.
- Now choose the Anti Aliasing drop-down, and then choose the appropriate setting. Preferably 4x Multi Sampling where possible.
Note: Be sure to set the anti-aliasing value for all quality levels.