Aliasing and Anti Aliasing: What is Aliasing?
In signal processing and related disciplines, aliasing is an effect that causes different signals to become indistinguishable (or aliases of one another) when sampled. It also refers to the distortion or artifact that results when the signal reconstructed from samples is different from the original continuous signal.
Aliasing in computing, aliasing describes a situation in which a data location in memory can be accessed through different symbolic names in the program. Thus, modifying the data through one name implicitly modifies the values associated with all aliased names, which may not be expected by the programmer. As a result, aliasing makes it particularly difficult to understand, analyze and optimize programs. Aliasing analysers intend to make and compute useful information for understanding aliasing in programs.
What Causes Aliasing: Why does aliasing occur?
Aliasing can occur in signals sampled in time, for instance digital audio, and is referred to as temporal aliasing. Aliasing can also occur in spatially sampled signals, for instance moiré patterns in digital images. Aliasing in spatially sampled signals is called spatial aliasing.
Aliasing is generally avoided by applying low pass filters or anti-aliasing filters to the input signal before sampling. Suitable reconstruction filters should then be used when restoring the sampled signal to the continuous domain.
Anti Aliasing filter: What is anti aliasing?
Specific topics in anti-aliasing include:
- Anti-aliasing filter, a filter used before a signal sampler, to restrict the bandwidth of a signal such as in audio applications
- Spatial anti-aliasing, the technique of minimizing aliasing when representing a high-resolution image at a lower resolution
- Temporal anti-aliasing, techniques to reduce or remove the effects of temporal aliasing in moving images
If you’ve ever played a video game on your PC, you’ve probably seen a setting called “anti-aliasing”, which smooths out jagged graphics. But there are different types of anti-aliasing, and some are better than others.
- SSAA (also known as FSAA): Super sampling anti-aliasing was the first type of anti-aliasing available. It’s useful on photorealistic images, but isn’t very common in games anymore, because it uses so much processing power.
- MSAA: Multisample anti-aliasing is one of the more common types of anti-aliasing available in modern games. It only smooths out the edges of polygons, not anything else—which cuts down on processing power compared to SSAA, but doesn’t solve pixelated textures. (MSAA still uses quite a bit of power, though.)
- CSAA and EQAA: These types of anti-aliasing (used by newer NVIDIA and AMD cards, respectively) are similar to MSAA, but at a fraction of the performance cost.
- FXAA: Fast approximate anti-aliasing, which we’ve mentioned before, has a very small performance cost, and smooths out edges in all parts of the image. However, it usually makes the image look blurry, which means it isn’t ideal if you want crisp graphics.
- TXAA: Temporal anti-aliasing only works on certain newer graphics cards, but combines lots of different techniques to smooth out edges. It’s better than FXAA, but still has some blurriness to it, and uses a bit more processing power.
- An anti-aliasing filter (AAF) is a filter used before a signal sampler to restrict the bandwidth of a signal to approximately or completely satisfy the Nyquist–Shannon sampling theorem over the band of interest. Since the theorem states that unambiguous reconstruction of the signal from its samples is possible when the power of frequencies above the Nyquist frequency is zero, a real anti-aliasing filter trades off between bandwidth and aliasing. A realizable anti-aliasing filter will typically either permit some aliasing to occur or else attenuate some in-band frequencies close to the Nyquist limit. For this reason, many practical systems sample higher than would be theoretically required by a perfect AAF in order to ensure that all frequencies of interest can be reconstructed, a practice called oversampling.
Of course, when you fire up a game, you usually don’t get to choose between all these types of anti-aliasing. If you’re lucky, you might get a choice between two, but in most cases, you either get one (or none). However, you can often enable them in your graphics card’s drivers, or even download new drivers with other types of anti-aliasing not mentioned above.
All that said, anti-aliasing has become less and less necessary as graphics become better and monitor resolution increases. You may find that some games don’t need it at all, while others do. It probably isn’t worth stressing out about, but if your graphics drivers have the option, you may find that you have more choices than you realized—and introductory knowledge to these methods can come in pretty handy.
Different Types of Anti-Aliasing as Fast as Possible | Techquickie
How to reduce aliasing: How do you avoid aliasing?
Sampling, Aliasing, and Analog Anti-Alias Filtering
The aliasing problem that arises from sampling
When data is sampled at discrete points in time, faster sampling periods make it possible to accurately see higher frequences and faster changes in signals. For a sine wave of with a period P, the signal must be sampled at least twice in the time period P to even be able to theoretically reconstruct the original signal, even knowing that no higher frequencies are present (Shannon’s sampling theorem). From a practical standpoint, not using an ideal filter designed for this reconstruction (and not knowing what frequencies are really present), it is best to sample at least 3 to 4 times within the period of the highest frequency signal of interest.
If the sampling rate is inadequate, aliasing will make the high frequencies appear as if they were lower frequencies. The noise at those higher frequencies is not eliminated — it is just converted to lower frequency noise. This is best illustrated by plotting the sampled data and interpolating the points between the samples. The signal in blue below represents interpolated values from the points sampled at too low a rate. (Those points are sampled at equal time intervals – it is only an optical illusion that they aren’t!)
Antialiasing is a technique used in computer graphics to remove the aliasing effect. The aliasing effect is the appearance of jagged edges or “jaggies” in a rasterized image (an image rendered using pixels). The problem of jagged edges technically occurs due to distortion of the image when scan conversion is done with sampling at a low frequency, which is also known as Undersampling. Aliasing occurs when real-world objects which comprise of smooth, continuous curves are rasterized using pixels.
Cause of anti-aliasing is Undersampling. Undersampling results in loss of information of the picture. Undersampling occurs when sampling is done at a frequency lower than Nyquist sampling frequency. To avoid this loss, we need to have our sampling frequency atleast twice that of highest frequency occurring in the object.
This minimum required frequency is referred to as Nyquist sampling frequency (fs):
This can also be stated as that our sampling interval should be no larger than half the cycle interval. This maximum required the sampling interval is called Nyquist sampling interval Δxs:
Δxs = Δxcycle/2 Where Δxcycle=1/fmax
Methods of Antialiasing (AA) –
Aliasing is removed using four methods: Using high-resolution display, Post filtering (Supersampling), Pre-filtering (Area Sampling), Pixel phasing. These are explained as following below.
- Using high-resolution display:
One way to reduce aliasing effect and increase sampling rate is to simply display objects at a higher resolution. Using high resolution, the jaggies become so small that they become indistinguishable by the human eye. Hence, jagged edges get blurred out and edges appear smooth.Practical applications:
For example retina displays in Apple devices, OLED displays have high pixel density due to which jaggies formed are so small that they blurred and indistinguishable by our eyes.
- Post filtering (Supersampling):
In this method, we are increasing the sampling resolution by treating the screen as if it’s made of a much more fine grid, due to which the effective pixel size is reduced. But the screen resolution remains the same. Now, intensity from each subpixel is calculated and average intensity of the pixel is found from the average of intensities of subpixels. Thus we do sampling at higher resolution and display the image at lower resolution or resolution of the screen, hence this technique is called supersampling. This method is also known as post filtration as this procedure is done after generating the rasterized image.
- Practical applications:
In gaming, SSAA (Supersample Antialiasing) or FSAA (full-scene antialiasing) is used to create best image quality. It is often called the pure AA and hence is very slow and has a very high computational cost. This technique was widely used in early days when better AA techniques were not available. Different modes of SSAA available are: 2X, 4X, 8X, etc. denoting that sampling is done x times (more than) the current resolution.A better style of AA is MSAA (multisampling Antialiasing) which is a faster and approximate style of supersampling AA.It has lesser computational cost. Better and sophisticated supersampling techniques are developed by graphics card companies like CSAA by NVIDIA and CFAA by AMD.
- Pre-filtering (Area Sampling):
In area sampling, pixel intensities are calculated proportional to areas of overlap of each pixel with objects to be displayed. Here pixel color is computed based on the overlap of scene’s objects with a pixel area.For example: Suppose, a line passes through two pixels. The pixel covering bigger portion(90%) of line displays 90% intensity while less area(10%) covering pixel displays 10-15% intensity. If pixel area overlaps with different color areas, then the final pixel color is taken as an average of colors of the overlap area. This method is also known as pre-filtering as this procedure is done BEFORE generating the rasterized image. It’s done using some graphics primitive algorithms.
- Pixel phasing:
It’s a technique to remove aliasing. Here pixel positions are shifted to nearly approximate positions near object geometry. Some systems allow the size of individual pixels to be adjusted for distributing intensities which is helpful in pixel phasing.
Other Applications of antialiasing techniques:
- Compensating for line intensity differences:
When a horizontal line and a diagonal line plotted on the raster display, the number of pixels required to display both lines is same, even though the diagonal line is 1.414 times larger than the horizontal line. This leads to a decrease in the intensity of the longer line. To compensate for this decrease in intensity, the intensity of pixels is assigned according to the length of line using anti-aliasing techniques.
- Anti-aliasing area boundaries:
Anti-aliasing concepts can also be applied to remove jaggies along area boundaries. These procedures can be applied to scanline algorithms to smoothen out area boundaries .if repositioning of pixels is possible then pixel positions are adjusted to positions closer to area boundaries. Other methods adjust pixel intensity at a boundary position according to the percent of pixel area inside the boundary. These methods effectively smoothen out area boundaries.