To understand anti-aliasing, we first need to understand the concept of aliasing.
You may have experienced pixelated or jagged edges on your screen while watching videos or playing video games. These ‘jaggies’ are known as aliasing. It lowers the overall viewing experience.
But why does aliasing occur?
The images displayed on the screen are made out of tiny squares known as pixels. Each pixel, the smallest controllable element of a picture, has its own intensity and color. Vertical and horizontal lines can be mapped precisely onto square pixels, but curved lines or corner to corner images must be adjusted point-to-point. When pixels along the edge are either off or on, it results in jagged edges (aliasing or stair-stepping).
The obvious solution to avoid aliasing is to increase your screen resolution, but not every person can afford a high-end monitor. That’s why engineers have developed several techniques for reducing the impact of jaggies on the screen. One of these effective techniques is anti-aliasing.
What Is Anti-aliasing?
Anti-aliasing is a technique of blending the edges of the pixels with surrounding pixels in order to create an illusion of a smoother edge. This is not as simple as it sounds: you are telling your computer to process millions of pixels each frame and make the edges smoother.
The CPU/GPU smoothes edges by adjusting the colors along all edges. Instead of turning the pixel on or off, the processor puts it somewhere in between. For example, a white diagonal line on a black background might have shades of dark and light grey along the edges instead of white and black.
Zoomed-in image of aliased vs. anti-aliased line
Anti-aliasing algorithms are designed to make digital pictures look natural when viewed from a certain distance. When zoomed in, anti-aliased text and pictures appear fuzzy due to the adjusted pixels.
In addition to digital photography and computer graphics, anti-aliasing is also widely used in digital audio (to remove unwanted frequencies from sampled audio). In this overview article, we have focused on the former.
Jaggies are not noticeable on modern HiDPI (high dots per inch) screens because they have denser pixel grids that can represent images more sharply. However, even these high resolutions screens benefit from anti-aliasing.
There exist different types of anti-aliasing techniques to make viewing and gaming experience better and more immersive. Each has its own benefits and shortcomings. Let’s discuss the eight most popular types of anti-aliasing in detail.
1. Supersampling Anti-Aliasing (SSAA)
Before (left) and after (right) applying SSAA
Provides exceptional image quality but drags down the performance
Also known as Full-Scene Anti-Aliasing (FSAA), Supersaming Anti-Aliasing (SSAA) is one of the oldest and most effective spatial techniques. It is perfect for processing photorealistic images because it gives the image softer appearances and makes it look more lifelike.
In this method, the image being displayed is rendered at a much higher resolution. Color samples are taken from excess pixels that weren’t present in the low-resolution image, and the average color value is measured.
When the image is shrunk, the average value is applied to remove jaggies. This gives a downsampled image with much smoother transitions. The quality of the output depends on the number of color samples: the higher the number of samples, the higher the quality.
Although this technique provides excellent image quality, it degrades the performance because rendering images at high resolution takes a lot of computing resources. This is why it isn’t widely used in gaming anymore.
Another downside of using this method is that it negatively affects pictures that have lots of vertical or horizontal lines. When processed, these lines (which are sharp by nature) appear soft.
2. Multisample Anti-Aliasing (MSAA)
Image source: Nvidia
Requires relatively less computational resources but produces lower quality images
Multisample anti-aliasing is a special case of supersampling where certain components of the picture are not fully supersampled. Only the edges of the polygon (the most common source of aliasing in 3D graphics) are anti-aliased. Textures are not smoothed out.
More specifically, when CPU/GPU renders a picture on display, it makes a distinction between two different components: a polygon and a texture. The CPU/GPU first draws the general shape or outline of an object (polygon) and then fills it with a texture. MSAA only adjusts jaggies on the polygon, leaving textures as it is.
Since MSAA does not process all parts of the final image, it is more efficient and requires less computational resources than SSAA. However, it produces relatively lower quality images and can’t deal with transparencies.
3 & 4. Coverage Sampling Antialiasing (CSAA) & Enhanced Quality Anti-Aliasing (EQAA)
MSAA (left) vs. CSAA (right) [tighter edge resolution in CSAA]
Both provide better quality while introducing only a minimal performance hit
GPU manufacturers AMD and NVIDIA have developed their own spatial anti-aliasing methods. NVIDIA has created CSAA, and AMD has created EQAA. Although they have different names, they function in a similar manner.
In both methods, GPU identifies the polygon in the image and calculates which regions of the polygon are likely to have jaggies. It then supersamples only those pixels.
Since the entire image is not processed, GPU takes substantially less processing power to run. Furthermore, both CSAA and EQAA do not require additional color/depth/stencil samples. Thus they consume the same video memory as MSAA (in equivalent mode).
5 & 6. Morphological Anti-Aliasing (MLAA) & Fast Approximate Anti-Aliasing (FXAA)
Implementation of FXAA method (step-by-step process from left to right, top to bottom) | Credit: NVIDIA
Fast, requires less computational resources but not suitable for images with detailed textures
NVIDIA and AMD have developed two post-process anti-aliasing techniques known as fast approximate anti-aliasing and morphological anti-aliasing, respectively. Both work in the same way — pixel is blurred after it is rendered.
In post-process anti-aliasing methods, the GPU compares the color contrast between two adjacent pixels to determine where the edge of a polygon is. Pixels with similar color and intensity are usually part of the same polygon. Once the edge is detected, the GPU blurs the pixels in proportion to their contrast.
7. Enhanced Subpixel Morphological Anti-aliasing (SMAA)
Example of SMAA 4x integrated into the Crysis 2 game
Combines both spatial and post-process antialiasing methods
This post-processing anti-aliasing technique combines morphological antialiasing (MLAA) with additional multi/supersampling strategies (MSAA, SSAA) for precise subpixel features.
SMAA yields better image quality while maintaining exceptionally fast execution times. More specifically, it delivers very accurate gradients and temporal stability while introducing minimal overhead. This makes it a preferred choice for low-end configurations.
8. Temporal anti-aliasing (TXAA)
Provides better image quality than FXAA or MLAA but requires a lot more computational resources
This complex method utilizes both blurring and supersampling to build sharp graphics and graceful motions. In other words, it aims to maintain a smooth level of motion in a virtual environment.
In recent years, researchers have developed Adaptive Temporal Anti-aliasing (ATAA), which deals with the shortcomings of TXAA. For example, it eliminates blurring and ghosting artifacts without introducing a significant performance hit. ATAA outcomes are close to what 16x supersampling could provide.
Which Anti-Aliasing Method Should You Use?
If you have a good understanding of the hardware you are using and know what kind of performance you want out of your machine, then it would be easier to decide which anti-aliasing technique is best for you.
The following questions will help you make the right decision:
- What are your GPU specifications?
- How heavy or graphically demanding are your games?
- What graphics features do you want to be perfect, and which ones you don’t care about?
If you have powerful/ high-tier gaming equipment, you should go for SSAA, MSAA, and TXAA. If you have a moderately-powered CPU/GPU, you can select MSAA, FXAA, or MLAA. And if you have lower-tier gaming hardware, which cannot handle high frame-rates and is prone to overheating, you should prefer CSAA or SMAA.
You can also experiment with your graphics settings to find out what your CPU/GPU is capable of handling. There are dozens of parameters to tweak, such as resolution, shadow quality, field of view, view distance, texture, and anisotropic filtering.
It is advisable to start with the lowest possible configuration and then move to higher, detailed levels. Although it is quite a tedious task, it is the simplest way to figure out how you can get the best gaming experience on your machine.
However, considering the recent advances in graphical processing units and display technology, it is really not worth worrying about anti-aliasing. In fact, newer video games and ultrahigh-resolution images do not require anti-aliasing at all.
It is still a good idea to gain knowledge about different types of anti-aliasing so that you can make informed decisions about balancing the visuals and performance of your next desktop. The information would also be useful if you ever decide to edit professional videos or develop your own game.