Understanding various AA features

Source: Internet
Author: User

AA (anti-aliasing) anti-aliasing many players may often encounter in the game's image quality settings. In other words, AA is a little more popular: mixing the image edge and the pixel colors on both sides, then, replace the original position with the newly generated point with a mixed property... AA (anti-aliasing) anti-aliasing many players may often encounter in the game's image quality settings. In other words, AA is a little more popular: mixing the image edge and the pixel colors on both sides, then, replace the points at the original position with the newly generated points with mixed characteristics to soften the shape of the object and eliminate the Sawtooth effect. With the continuous innovation of graphics technology, the AA anti-tooth technology is also constantly developing and improving. In the face of the "wide variety" AA anti-aliasing in the game's image quality setting options, how should we choose? Do you have any knowledge about the AA anti-aliasing options? Today, the graphics card Emperor will give you a detailed explanation of the past and present AA anti-aliasing, so that you can happily understand the AA anti-aliasing.

The video card Emperor reveals the past and present of AA anti-aliasing

In this article, netizens will discuss and decrypt the following issues with the video card Emperor:

I. What is the basic principle of the AA anti-aliasing technology;
Ii. Features of hardware AA and related AA technologies;
3. Post process AA features and related AA technologies;
Iv. Features of hybrid aa and related AA technologies;

The above contents are the general idea of this article. The graphics card Emperor hopes to allow many players to have a deeper understanding of AA anti-aliasing through step-by-step analysis and interpretation, after reading this article, I will be able to have a clear understanding of the general classification of the AA anti-tooth technology.

Detailed explanation of the basic principles of AA anti-aliasing

AA (anti-aliasing): translated as "anti-image folding distortion ". In terms of popularity, AA is a precise Rendering Technique of secondary pixels in raster images. Because the computer screen is displayed in pixels, it is the smallest small block on the screen. As long as you look closely at the TV, you will find Red, green, and blue dots, which are pixels. However, if the curve and angle are represented by square pixels, this is obviously "inconvenient", because curves and angles are prone to generate "dog-like" sawtooth. AA is a technology that solves this problem. Its purpose is to make the image look smoother and more natural. In short, after AA processing, the image eliminates the "Block feeling" caused by the Sawtooth ".

The picture on the left is very smooth, but the picture on the right is a piece

From the figure above, we can intuitively see that the image without AA anti-aliasing technology is much more serious than the image with AA anti-aliasing technology after the "Block sense" is processed.

The premise of AA is very simple. See the following chart:

Smooth transition of circles

First, suppose you want to show a circle on the screen. If the circle is large, you can arrange it by many pixels, but if you want to show a small circle, because the number of pixels that are provided to you is very small, the circle built through the pixel square may not be like anything at the end. At this moment, the anti-aliasing of AA has helped a lot. We first enlarge the circle (the first circle on the leftmost side), and then align it with a Pixel Grid. Each square represents a pixel. At this time, you will find that many pixels in the grid are not filled, and the fill ratio is also different. Then, our goal is to find out these incomplete filled grids, and select the corresponding proportion of the basic color (black here) based on the fill ratio to fill in, that is, to get the fourth circle. After careful analysis, the circle is completely filled with black, and some 50% fill with a 50% gray, and 75% fill with 75% gray, and so on. Finally, we will fill out the fourth circle of the graph to reduce the original size, that is, to 5th circles, the effect is not very good. However, this method is only applicable in part to the "pixel art" field, because the pixel size and color quantity are limited.

It is worth mentioning that AA has both correct and incorrect usage. The correct method is as shown above, resulting in a smooth transition. The incorrect method is to add a gray pixel of 50% to the far left of the image on the periphery of the Black edge:

AA has correct usage and incorrect usage

People often make a mistake when they are new to AA anti-aliasing: adding a single light pixel to each "Step. In fact, this method is very bad. The intermediate method is correct: add the appropriate transitional pixel to the desired place. Although the arc is working smoothly at the moment, the Sawtooth effect has not been completely eliminated. The last side is the best method: Add two layers of transition colors to make the arc look smoother. Therefore, a single separated pixel is generally not the best AA transition, and the AA effect can be better expressed by the same color line or pixel group.

OK. The above describes the basic premise of AA, but you will find that we only introduce the black and white colors. What should I do if I change to color? In fact, the method is similar to the AA transition in the case of black and white, but it is no longer the percentage of black, but the ratio of each color. :

Each square represents two or three different colors to be converted using pixels.

The first one on the left is black and white (as discussed above ). We found that the transition colors used to transition black and white are intermediate gray. This color is determined by the black mixture of the proportion of the mixed white to the proportion of the black. Similarly, if we mix red and yellow, we get orange, and then dark green + Blue = sea blue, we have a little change on the far right: three colors together. We use the same method for waiting. After mixing, we get a blue purple. The method is really not complex, but it can be used without color restrictions, because in reality there is no infinite color disk for AA transition, even if there is a very time-consuming. Therefore, we can only use continuous attempts to select the appropriate AA transition color until it succeeds.

AA past and present: hardware AA

Having gone through the original analysis of the AA anti-sawtooth technology, the player has a preliminary understanding of AA. The AA anti-aliasing technology has been developing for decades and gradually transitioned from offline rendering to real-time rendering. AA is widely used in graphics to improve rendering quality. Next, we will give a detailed description of the past and present life of the AA method used in real-time rendering. First, we will talk about the AA method supported by hardware.

Figure 1: sample points within a pixel

Is an internal pixel sampling point. 16 red circles represent 16 sampling points. blue and yellow represent the two triangles that cover this pixel. A few times of anti-sawtooth refers to the number of sampling points in a pixel.

Ssaa (Super sampling anti-aliasing) Super sampling

Ssaa is the most intuitive AA and also an early AA anti-aliasing method. The basic idea is: this means to compress a blurred big image into a clear small image after being refined. One of the implementation methods is to render a large image first, and then downsample (lower sampling rate), which can be equivalent to a uniform distribution sampling inside each final pixel. A more general description is that each pixel distributes multiple sampling points (which can be uniformly distributed, Poisson distribution, random distribution, jitter distribution, etc.), and each sampling point has an independent color and depth, run pixel shader once at each sampling point. In this case, one white, one light blue, and 14 yellow sample points will be obtained. The final value of this pixel is the average of the 16 sampling points, that is, white (1, 1, 1) + light blue (0.77, 0.77, 1) + 14 * Yellow (1, 1, 0)/16 = (0.98, 0.98, 0.125 ). Among these methods, ssaa has the best quality. After all, it is the most primitive and most violent method. On d3d 10.1 +, you can select per-sample or per-pixel to execute pixel shader, that is, ssaa is directly supported. Performance Statistics (N samples, the same below): The number of PS (pixel shader) executions in each pixel is N, occupying n color + N depth space. In short, ssaa is simple, direct, but resource-consuming.

Msaa (multisampling anti-aliasing) Multi-sample anti-aliasing

Msaa is a special type of super sampling (ssaa ). Msaa comes from OpenGL first. Specifically, msaa only performs super sampling and anti-sawtooth processing on the data in the Z-buffer and template buffer. The basic idea is that only the edges of a polygon are anti-sawtooth. We know that ssaa needs to execute PS once at each sampling point and save color and depth. Both the time and space overhead are amazing. The emergence of msaa greatly improved this. Msaa only executes PS once per pixel, and the output color is written to all samples tested by depth-stencer. Before Shader Model 3, PS input must be taken from the center of the pixel. After centric interpolation is added, the INPUT attribute of PS can be the center of all sampling points covered by the triangle:

Comparison of centric Interpolation

1, without centric interpolation, the two sampling points of the blue triangle get the pure blue color (the color of the third pixel), and the final pixel color is (2 * (0, 0, 1) + 14 * (1, 1, 0)/16 = (0.875, 0.875, 0.125 ). Centric interpolation is a more accurate light blue (1, 1, 1) + (0.77, 0.77, 1)/2 = (0.885, 0.885, 1 ), the final pixel color is (2 * (0.885, 0.885, 1) + 14 * (1, 1, 0)/16 = (0.98, 0.98, 0.125 ). As shown in: Performance Statistics: The number of PS executions in each pixel is once for each triangle that overwrites the pixel, occupying n color + N depth space. In short, msaa greatly reduces resource consumption, but its image quality is slightly inferior to ssaa.

Csaa (coveragesamplinganti-aliasing) overwrite sampling

Comparison between NOAA, msaa, and csaa

Csaa is NVIDIA's first practical AA Technology in g80 and Its Derivatives. It is also the exclusive AA Technology in the NVIDIA geforce 8/9 series. Although msaa solves the computing problem, the storage volume is still large, especially when the sampling rate is above 8. Csaa further saves the memory usage and bandwidth on the basis of msaa. Simply put, csaa overwrites the sub-pixel coordinates to be sampled in the edge polygon, place the original pixel coordinates in the pre-calculated coordinates of the hardware and driver, so that you can use a small amount of color/depth space to store the quality of the original high sample size. Example 1: When we use csaa 16x (16 sampling points) for rendering, a pixel is divided into four areas: top left, top right, bottom left, and bottom right, each region has four coverage sampling points, but the same color and depth are shared. The result of Figure 1 is (0.25 * (0.885, 0.885, 1) + 0.25 * (0.885, 0.885, 1) + 3.75 * (1, 1, 0 )) /4 = (0.98, 0.98, 0.125 ). Performance Statistics: The number of PS executions in each pixel is once the triangle that overwrites the pixel, occupying space M color + m depth, and m is less than N. In short, csaa is like the uniform msaa of sampling standards. It can perform Edge Sampling with the highest efficiency, and the efficiency is also significantly improved. For example, the downsampling rate of 16xcsaa is slightly lower than that of 4xmsaa, but the effect is almost the same as that of 8xmsaa. 8xcsaa has the processing performance of 4xmsaa, but the performance consumption is the same as 2xmsaa.

AA past and present: post process AA

The ssaa, msaa, and csaa AA methods are directly supported by hardware, resulting in a large amount of additional resource overhead. On the one hand, AA consumes a lot of memory resources. Furthermore, the AA method considers edge as the original boundary, and does not consider whether AA is really needed for this edge, therefore, some computing workload is wasted. In chapter 2 of GPU gem 2, deferred shading in S. t. a. l. k. e. R ., for the first time, he promoted the deferred shading concept for the game industry ., The deferred framework cannot use the hardware msaa. Although deferred lighting solves the problem, the cost of re-rendering the scene is not small. More importantly, due to the introduction of the deferred framework, people finally began to face up to msaa, which actually caused a lot of time and space waste. Since post process-based AA methods have been booming over the past few years, there is a great momentum to replace hardware-based AA.

Edge AA

Edge AA is deferred shading in s.t. a. l. k. e. the method proposed by r performs an edge detection based on the degree of difference between depth and normal of the "neighbor pixel". Each pixel can obtain a weight, indicating the degree of "Image Edge ":

Based on this weight, the color of the neighbor pixel can be used for interpolation to obtain the effect of AA.

In Chapter 3 deferred shading in tabula rasa of GPU gems, NCsoft makes some minor improvements to edge AA. Edge Detection is no longer dependent on image resolution and is more stable.

Direally ally edge AA

Edge AA has created the post process AA era, but edge AA cannot compete with hardware AA in terms of quality. Subsequently, AMD's paper on hpg09, a directionally adaptive edge anti-aliasing filter, improved edge AA and no longer used independent edge points to determine the AA hybrid method, the isoline (isoline) is determined based on the condition around the edge point, and then the hybrid direction is determined based on the vertical direction of isoline. In this way, a boundary will be mixed along the orientation to restore more precise sub-pixel information. This method enters the amd driver and is automatically enabled when adaptive AA is enabled.

MLAA (morphological antialiasing) morphology

Adaptive edge AA proposed the research direction of replacing points with lines, but the isoline computing workload is large after all, and rendering performance decreases significantly after it is enabled. Morphological antialiasing, a fully CPU-based anti-aliasing solution launched by Intel, has made another effort in this direction. It does not calculate isoline, but classifies edge into several specific shapes, such as Z, U, and L. Both Z and u can be decomposed into L.

Both Z and u can be decomposed into L

Finally, a triangle is drawn based on L to determine the mixed area, which saves all heavy calculations and increases the AA speed. In AMD's newer drivers, MLAA replaces direally ally edge AA as the preferred choice for adaptive AA. The MLAA framework derives multiple different methods:

CPU MLAA

Intel's morphological antialiasing article on hpg09 is implemented on the CPU. The Code uses a very deep branch to determine the edge shape. It is completely optimized for the CPU and not suitable for GPU hardware or real-time rendering.

GPU MLAA

Siggraph 2010 poster's practical morphological antialiasing on the GPU, uses the SAT to determine the edge shape, and requires log (width) + Log (height) Pass. After determining L, You need to query a pre-calculated 512 × 512 r32f texture. Each Texel corresponds to the mixed area of a specific L. That is, the side length is 512 pixels at maximum. It can be seen that this method is very violent, although it may be faster than reading back the CPU, but the overhead is still very large.

Jimenez's MLAA

In the article practical morphological anti-aliasing in GPU Pro 2, a more practical gpu mlaa method named Jimenez's MLAA to differentiate. In MLAA, Z and u do not need to be decomposed into simpler L, and a pre-computed table is directly used for query. Each pixel searches for the desired pixels in the search table based on its position in the shape. In 360 P resolution, this method can reach 3.79 Ms on Xbox 9800 and 0.44 Ms on GeForce GTX +. 8 x msaa requires 5 ms under the same conditions.

Fxaa (fast approximate anti-aliasing)

NVIDIA provides a method called fast approximate anti-aliasing in graphics SDK 11. This method is very close to MLAA, but only recognizes long edges without recognizing shapes. With the long side, the sub-pixel coverage rate in each pixel can be estimated based on the intersection of the side and pixel, and AA is mixed. Later, Timothy lottes developed the fxaa II, which reduced the quality and improved the speed. On the Xbox 360, the 2.0 P resolution can be MS.

Comparison between no aa and fxaa

Another aA method published on gdc11 is called directionally localized anti-aliasing (Jimenez's MLAA and fxaa described earlier are also published during gdc11 ). This method is special. It performs horizontal edge detection on the image after vertical blur, and the obtained result is merged back to obtain the image after AA.

The left is before AA, and the right is after dlaa

Dlaa's execution efficiency is still relatively fast. According to tests on Xbox 360, 2.2 p requires MS.

In short, the post-processing method of AA is to estimate the sub-pixel-level ry through pixel information, but then aa. The difference is that edge AA is estimated by independent points, MLAA is estimated by L shape, and fxaa and dlaa are estimated by line segments.

AA past and present: hybrid aa

We have introduced the hardware-based AA and post-processing-based AA anti-aliasing methods. Is there a solution that combines the two? This is what we will talk about below: hybrid aa (hybrid aa ). We will first compare the calculation waste of msaa:

Edge to be calculated by msaa

Calculate the edge of AA

Through the comparison above, we can intuitively feel that there are not many edge nodes that really require AA processing, msaa actually wastes a lot of computing workload on pixels that do not actually need AA. Therefore, the more sampling points, the more serious the waste. Through the introduction of post-processing AA, we know that the post-processing aA method is to try to estimate the sub-pixel-level ry through pixel information, but then do Aa. The difference is that edge AA is estimated by independent points, MLAA is estimated by L shape, and fxaa and dlaa are estimated by line segments. The idea of hybrid aa is to simply store the sub-pixel ry directly without "estimation ".

Sraa (subpixel reconstruction anti-aliasing)

Sraa is a new approach published by NVIDIA researchers at i3d2011. It places the fact that the shading variation frequency is generally lower than the ry variation frequency, so it can be shading at a lower resolution, and restoring the ry with a higher resolution. The basic process of sraa is to render a high-resolution (or G-buffer with msaa) in the deferred shading framework, however, shading is only performed in normal resolution (or without msaa. The accumulated Results Use G-buffer to reconstruct sub-pixel information for AA calculation similar to MLAA. This method combines msaa and MLAA. The advantage is that a higher msaa can be achieved with a lower number of samples without increasing the amount of shading computing. Due to the principle problem, sraa can only be used in the deferred framework.

Subpixel reconstruction anti-aliasing

Gpaa (geometric post-process anti-aliasing)

Gpaa is an AA method independently proposed by humus. The basic idea is to render the ry again in the box mode. At this time, we can get the coverage rate of each triangle in each pixel:

Geometric post-process anti-aliasing

Through this coverage rate, it is quite easy to calculate AA, and the results are compared as follows:

Comparison

The cost of this method is that it is rendered over a box, but it can be used in two frameworks: Forward and deferred. Unfortunately, humus Twitter says this method was actually patented by someone else in 1996.

Adaptive AA

Intel mentioned a very simple and violent aA method on course deferred rendering for current and future rendering pipelines in Siggraph 2010, where per-sample computing in edge, in the non-edge area, perform per-pixel computing. Like the post process-based method, this requires an edge detection, which is marked in the stencel (Template), and then can be calculated separately. The red line is marked with the detected edge:

The red line is the detected edge.

The result of this method is the same as that of ssaa, and there is no problem with repeated msaa calculation.

In short, hybrid aa is a compromise between the two AA schemes, hardware AA and post process AA. The advantage is that the hardware overhead lower than the hardware AA can achieve the same effect as the computing workload. The disadvantage is that you need to modify the original graphic rendering pipeline.


Conclusion: AA anti-aliasing is designed to reduce the block effect.
Conclusion: AA anti-aliasing is designed to reduce the block effect.

Based on the introduction in the previous system, it is assumed that gamers and friends have a deeper understanding of AA anti-aliasing. In 3D images, because of resolution constraints, the edge of an object always presents more or less "edges" that are not smooth enough, and anti-sawtooth is the result of softening the edge of the image, makes the image edge look smoother and closer to the object. Therefore, AA anti-aliasing is a rendering method that improves image quality and softens it. Finally, we will summarize the core knowledge points of this article:

I. Effect of AA on anti-aliasing: mixing the image edge and the pixel colors on both sides, then, replace the points at the original position with the newly generated points with mixed characteristics to soften the shape of the object and eliminate the Sawtooth effect;

2. what we usually call "several times" anti-sawtooth "refers to the number of sampling points in a pixel;

Iii. AA anti-aliasing are classified according to the evolution of technology: hardware AA, post process AA and hybrid aa;

Iv. Features of hardware AA (hardware-based aa): The principle is simple and direct, but hardware resources are greatly consumed. Such aA technologies: ssaa, msaa, and csaa;

5. Post process AA (post-processing aa) features: the post-processing aA method is used to estimate sub-pixel-level ry through pixel information, but then aa is used. The difference is that edge AA is estimated by independent points, MLAA is estimated by L shape, and fxaa and dlaa are estimated by line segments. Such aA technologies: edge AA, directionally edge AA, MLAA, and dlaa;

6. Features of hybrid aa: hybrid aa is a compromise between the two AA schemes, hardware AA and post process AA. The advantage is that the hardware overhead lower than the hardware AA can achieve the same effect as the computing workload. The disadvantage is that you need to modify the original graphic rendering pipeline. Such aA technologies: sraa, gpaa, and adaptive AA;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.