Anti-Aliasing.com
This webpage introduces several approaches to Anti-Aliasing (AA).
With Super Sampling AA (SSAA), the image is computed at a higher resolution, using only one sample point per pixel. Then the image is reduced with downscaling.
With MSAA, AA depends on the number of subpixel sample points, like x4, and x8. The quality of the anti-aliased image improves with the number of subpixels. MSAA is slow, since it needs several (4x or 8x) frame computations, followed by averaging. In order to improve the processing speed, sevaral methods have been introduced: FXAA, SMAA, TAA, ARAA, CSAA, EQAA, FXAA. Although MSAA produces better images, these solutions are a compromise between system performance and image quality.
A new approach, Area-Based Anti-Aliasing (ABAA), is a great improvement over other methods that rely on point sampling. ABAA relies on area sampling. It is faster, and more accurate and produces better images.
Q: Does the 8-queens puzzle provide good solutions for selecting MSAA sample points?
A: Not all solutions to the 8-queens puzzle provide acceptable results for MSAA. But all solutions for MSAA provide good results for near horizontal, near vertical edges and edges near 45 degrees. With these edges move across a pixel, the color mix changes in 8 equal intensity steps.
The AA effectiveness is considerably degraded for edges with angles in-between. While the solution works well at 45 degrees, it is worse for edges having nearby angles, and where there are gaps.
With 8 subpixels, there are 1+2+3+4+5+6+7s=28 cases where 2 samples are aligned with an edge. Cases with more aligned samples points should be avoided. Also, the width of gaps between aligned edge should be minimized. The situations can be improved by moving a couple of samples points to cover the gaps, at the expense of the 45 degrees solution.
Q: Why is ABAA the fastest solution?
A: With ABAA, only one image with AA is computed. There is no need for image averaging or postprocessing.
Another advantage of ABAA is the speed and simplicity for detecting partially covered pixels.
Q: How can the detection of intersected pixel and computation of covered pixel area be so efficient?
A: ABAA classifies triangle edges into 2 types, according to their slopes:
if (edge slope |x/y| < 1.0) the type is Horizontal edge (HE);
else the type is Vertical edge (VE);
In most cases, when an edge intersects a pixel, it divides that pixel into 2 trapezoid.
Since the height of the trapezoid is 1.0, the areas of these trapezoids are equal to the average of their top width and bottom width. The covered area can be easily measured where the edge intersects a pixel midline. Refer to figure 1.
Detecting intersected pixels and measuring the covered area is executed in only 1 step.
For a V-edge, look for the H-midline. This the case for the 1st example with 4 subpixels.
For a H-edge, look for V-midline. This the case for the 2nd example with 8 subpixels.
With ABAA, a pixel is considered intersected by an edge only when that edge intersects the midline inside of that pixel. This intersection is where the covered area is measured.
It does not matter if the trapezoid extends partially into an adjacent pixel. A pixel is not considered as intersected when an edge intersects a pixel near a corner without intersecting a midline.
Note that even when the trapezoid extends outside the pixel boundary, the measured area is still correct. As edges move across pixels, the covered area transition from non-covered to fully-covered in equal steps, from 0.0 to 1.0. This method is very accurate. With 4 fractional bis, there can be 16 equal steps. The pixel color of intersected pixels is a weighted mix according to the 2 areas.
Ther are 2 ways to computes the color mix. The color mix can be calculated either by using the exact covered areas, or by using the covered subpixel counts.
Q: What is the difference in image quality between ABAA and MSAA?
A: With vertical and horizontal edges, the rendering quality is the same between ABAA and MSAA. With MSAA and N samples, as a V-edge or H-edge moves across a pixel, the intensity mix always changes in N equal steps. In this special case, the quality would be the same if there were only rectangles with V-edges and H-edges. This is good, since most buildings in an image are made of edges slopes near vertical or horizontal.
For other edge angles, the quality with MSAA is getting worse, while it is unchanged with ABAA. With ABAA and N samples, as an edge moves across a pixel, the intensity mix always changes in N equal steps, regardless of the edge angle.
Q: What is the main advantage of ABAA vs MSAA and other AA solutions?
A: First, ABAA relies on subpixel area sampling. A pixel is considered intersected only when an edge intersects a midline in that pixel. The covered area is measured (1 measurement) on that midline and is used for computing the mixed color. This solution is the fastest. ABAA produces a single image that is the best and the most accurate.
With the other solutions, the first step consists of computing an image with jaggies using a single sample point. With MSAA, the process continues by processing images with more sample points, followed by image averaging. For the other solutions, the process continues by doing post processing, starting with a single sample point image with jaggies.
This is comparable of buying a used car with defects and trying to fix it, so that it looks like new.
Q: Can MSAA handle “Narrow Face Breakup” and “Faces Popping in-an-out of Scene”?
A: In the general case, MSAA can handle “jaggies” for faces that are wide enough. This consists of blurring edges with sharp color transitions.
The following rules are estimated guidelines.
With single sample point sampling, narrow faces should have a width > ~1 pixel).
For MSAA4, they should be > ½ to ¼ pixel wide. For MSAA8, they should be > 1/4 to 1/8 pixel wide.
ABAA4 can handle narrow faces > ¼ pixel wide. ABAA8 can handle narrow faces > 1/8 pixel wide.
Q: Is there a problem with ABAA for Narrow face?
A: One problem with narrow faces is that the image gradient could be very large. The computed values could overflow for points selected outside of very narrow faces. With ABAA, the Color, Texture and Zi are sampled at the center of pixels. Zi can be sampled at the center of subpixel areas for detecting penetration.
In order to prevent overflow of function gradients in the projected triangle, the gradients should be clamped for faces narrower than 2-pixel wide, for example. There is a patent from Michel A Rohner that provides a solution for gradient clamping.
Method and apparatus for clamping image gradients
US US6184887B1 Michel A. Rohner, Oak Technology, Inc., 2/6/2001.
https://patentimages.storage.googleapis.com/fc/12/09/fa30d26af5f2ba/US6184887.pdf
Q: Where can I get a computer system with ABAA.A: ABAA is a new solution for AA in CGI. After companies start manufacturing systems with ABAA, it should take between 6 months to 2 years until systems appear in the market. But knowing that such systems will be available might influence how you want to spend on an expensive system now. ABAA is an attractive solution for computer hardware. It is not a question of if, it is a question of when.
Also, the ABAA solution can be applied in software for 3D rendering. The better image quality and faster processing should be an incentive for modifying rendering programs.
8-Queens Puzzle:
The 8-queen puzzle consists of looking for solutions on a checkerboard where no queen can threaten another queen.
https://en.wikipedia.org/wiki/Eight_queens_puzzle
The Meaning of Anti-Aliasing: FXAA, SMAA, MSAA, SSAA, TXAA Algorithms, 9/18/24
What Is Anti-Aliasing and Which Type Should You Use?
https://vr.arvilab.com/blog/anti-aliasing
This webpage introduces several approaches to AA. With SSAA (Super Sampling, the image is displayed at a very high resolution, using only one sample per pixel. With MSAA, the AA depends on the number of Subpixels, like x4, and x8. The quality of the anti-aliased image improves with the number of Subpixels. It introduces variations of MSAA with CSAA, EQAA, FXAA and TXAA, but with a compromise between image quality and system performance.
AA & Postprocessing: docs.unity3d.com
FXAA, SMAA, TAA
https://docs.unity3d.com/Packages/com.unity.postprocessing@3.0/manual/Anti-aliasing.html
MSAA and Subpixel Rendering:
MSAA Example at flickr.com for 2×2, 3×3 and 4×4 Subpixel array:
https://www.flickr.com/photos/dominicspics/3991177364/in/photostream/
MSAA, A Closeup View (8 Pages)
May 22, 2003 / by aths / page 1 of 8 / translated by 3DCenter Translation Team
http://alt.3dcenter.org/artikel/multisampling_anti-aliasing/index_e.php
Nvidia Adaptive Temporal AA Technology (ATAA), by Zhiye Liu July 31, 2018
Comparison between SSAA4 (MSAA4), ATAA, TAA, FXAA and NoAA.
https://www.tomshardware.com/news/nvidia-adaptive-temporal-antialiasing,37534.html
Digital Trends: What is anti-aliasing? TAA, FXAA, DLAA, and more explained
https://www.digitaltrends.com/computing/what-is-anti-aliasing/
A Quick Overview of MSAA, Written by MJP, Oct 24 2012
https://therealmjp.github.io/posts/msaa-overview/
This webpage describes the same approaches as the previous webpage. But it provides interesting static and dynamic examples.
MSAA and Solutions to the 8 Queens Puzzle:
In the literature, the selection of subpixels within a pixel is often referred to as “Solutions to the 8 Queens Puzzle”. The idea is to position 8 Queens on a chess board, so that no Queen can attack another Queen. This algorithm provides good solutions for MSAA. But there are other acceptable solutions that do not satisfy the 8 Queen requirement.
https://en.wikipedia.org/wiki/Eight_queens_puzzle
The solutions to the 8 queens puzzle provide good results for near horizontal and vertical edges and edges at 45 degrees. But the AA effectiveness is considerably degraded for edges with angles in-between. On the other hand, the ABAA solution works consistently for all angles.
Anti-Aliasing Analysis & Reviews by Toms Hardware
AA Analysis Part 1: Settings and Surprises (8 pages), by Don Woligroski April 13, 2011
https://www.tomshardware.com/reviews/anti-aliasing-nvidia-geforce-amd-radeon,2868.html
AA Analysis Part 2: Performance (19 Pages), by Don Woligroski, November 21, 2011
https://www.tomshardware.com/reviews/anti-aliasing-performance,3065.html