The following article will explore some problems related to the image quality in modern PC games - indeed, even in the latest hardware, we will still encounter these problems. Although I am more willing to talk directly about our second topic today (Alpha Transparency in the material), but before this, we still have some basic knowledge, so that different levels of readers can read this article. . Below we are analyzing why Rotated Grid Antialiasing is better than Odered Grid AntialiaSing technology.
What is anti-aliasing?
We know that the computer screen is made up of a small pixel. Although these pixels are very small, each pixel covers a certain area on this screen. We can make these pixels than a single window to the virtual world, and our computer's task is to determine the color of each pixel to make us see a beautiful picture through these windows. However, the speed of rendering is also an important factor in the "real-time" picture (we call "real-time" is because we are always changing in the game), so usually the color of usually passed The color of this pixel is determined by sampling (ie, we call Point Sampling). Unfortunately, this approach taken in order to improve speeds may make the color of the sampled single point that cannot reflect the color conditions of the area covered by the entire pixel. When this situation occurs, it is very obvious when the edge of the object is.
There are some pixels "cross" in the edge of the object, and the color inside the pixel is a certain proportion, and the exterior display we also want to reflect this ratio. The edges of the object will present different colors (otherwise we are not called edge). Point sampling techniques will cause the entire pixel to present some of the colors on both sides of the edge. In this way, the coloring of the object edge is in the foreground or which is the background color, the sudden jump of the color between the pixels will naturally exhibit a serrated shape. This is what we say is already aliasing. This is because the area of this pixel is exactly on the edge, and there is its existence on both sides. A better way is to mix the foreground color and background colors to create a third color to fill a pixel. This method can effectively improve the performance effect of the image edge, and it is to achieve the role of "anti-" zigzag.
We can calculate this purpose by calculating the intersection of the pixel, and the effect of the boundary reflects an aspect of each pixel that can perform detail. For example, the boundary of a vertical growth tree may have only a pixel, how do we embody the edge of this tree? What we need is a relatively general method to enhance the effect of a scenario in pixels, and to do this, the most direct method is to increase the number of sample points adopted for a small scene occupied by each pixel. These independent sampling points are often referred to as sub-samples, while they are generated by pixels. Each independent sampling point for each pixel generated sub-sample is called UP-Sampling, and the number of subsequent sampling we use "X" (such as 2x, 4x, 6x, etc.) . Coloring a single pixel is colored by the average operator sample to make the pixel more expressive. We become down-sampling. Although the number of points calculated during the sample process is the same as the number of sub-sampling points generated in the upper sampling, this is not constant in actual operation. NVIDIA's five-point plum arrangement sampling method (Quincunx) Anti-aliasing is sampled to each pixel only two sub-sampling points, while the sample is sampled (by nearing pixels) Go to "Borrow" sub-sample point method to get more 3 sub-sample points).
Different anti-aliasing methods
Today's two different kinds of anti-aliasing techniques are super Sample Super-Sampling (SSAA) and multi-sampling Multi-Sampling (MSAA) super sampling simple sampling, sampling for each sampled pixel. Calculate. Its method is similar to what we described above. This approach is very occupied by the increase in the data to be calculated. It can be understood that this working state is actually equivalent to a low resolution of the screen after higher resolution operation.
Multi-point sampling aware of the sub-samples that are repeated inside the same object material will have a very similar color, so precise color operations for each pixel are simply wasting time. It first detects the position of the pixels prior to the anti-aliasing treatment for the pixel to see if it is located on the edge of the material, and a method of not performing average processing inside the material. Therefore, multi-point sampling anti-aliasing can only read a material on each group, which is why MSAA is faster than SSAA. For those pixels that are in the edge of the object, it is still necessary to fill the new color after calculating by the foreground and background colors, and the color of these transitions succeeds that the edges look smoother. MSAA actually did not improve the picture quality inside the object that used a transparent material. In the following discussion, we will see this.
Note: Mixing MS and SS in a packet is still possible!
Subcarpse point arrangement
It seems that the arrangement of pixel internal sub-sampling is not important, but in fact these sampling points are arranged in relation to our effects on the edge of the object. We are arranged as an example for the 4X (4 sub-sample points per pixel 4 sub-sample points) below.
Each pixel (red square) in the above figure is surrounded by 8 other pixels (black square). Each pixel contains four sub-sample points. Let's take a look at the situation of a near level red boundary line through such a line of pixels:
We assume that the top of the red line is black and below it is white. As the red edge increases, we can see changes in each pixel gray. In the top three plaids of the sampling, all 4 sub-sample points are all in the black area, all the colors obtained by all the points are all black, so the colors obtained after the average operation is also black. The fourth pixel has a point in the white area, so its gradation is 75%. With this type, the next 8 pixels are 50% grayscale. The last four pixels of the sampling point color is all white, so these pixels are also all white.
Through the above example we can understand how the child sampling is through the intermediate transition color to smooth the edge between two colors, which may be used for the transition color, we can define 75:25 , 50:50 and 25:75. However, this sampling arrangement does not optimally use these three colors. And you can see it 25:75 is not used!
Let's take a look at another 4 sub-sample points. It can be seen that this arrangement makes these four sampling points a 1-in-2 (in a small grid as a computing unit).
This transformation makes the sampling point over the red boundary, without the case where two sub-sampling points are crossed by the front, which reflects the effect of this arrangement.
Obviously, we see this arrangement of these three transitions to make the border smoothing better than the former. However, the problem is not as simple as it is. When using this arrangement, the effect is not as good as before the angle of the edge of the edge is similar to the rotation angle of the sub-sample point group. So why should we say that the spin is better?
Take an edge with 1-in-2 inclination, you need to perform smooth processing, each level of the jump is only two pixels, so there is not enough space to fill these three transitions! This is why the orthogonal arrangement is not good. It may complete the task of smooth bevel borders, but there is not enough space to let him complete this task, but it is very poorly in the case of a near-level and near-vertical situation that requires a very good distribution color. The rotating grid arrangement is more effective due to another way.
Before, ATI and NVIDIA have used some sampling methods that are not optimized. ATI has introduced 2X & 3X anti-aliasing features to list the vertical queue to smooth the horizontal edge, but the vertical direction is not powerful, and even a simple tilt arrangement can make both to obtain smoothing. On the other hand, NVIDIA is not placed with their 4X orthogonal model until it will introduce new arrangements in the 6800 family. It's hard to imagine what is why they take these practices. Below we use the facts to compare the effect of 4X orthogonal arrangement and 4x rotation in the actual game. The following animation is a screenshot from Farcry's Mango River. The fallen waterfall provides us with a very good certificate. You can see images between point sampling (without open anti-aliasing function), 4X orthogonal sampling and 4x rotation sampling. The role of the transitional color we discussed earlier is very obvious here, and you can see this in the enlarged map of the lower right. Standing away from the display, observe this enlargement, you will find the 4X orthogonal sampling waterfall edge still have some edge trips, and it is completely not available in the way to rotate sampling.
Note: The screenshot of the spin sample is from GeForce 6800 Ultra, so
We also confirmed that NVIDIA actually used 4X rotary sampling mode.
In fact, the so-called "rotating" said is just a kind of description. This kind of sub-sampling method is more effective because it is rotated, from essentially due to its horizontal or vertically passing through a single pixel in accordance with a certain interval with a single sampling point in accordance with certain intervals. The following 8-point sampling (8x anti-aliasing) arrangement is also met like this requirement, but it can't be classified as rotation.
Subsamples in other points have the same limitations and 4-point sampling. The above 8-point sampling can be calculated to get 7 transitions. However, it is necessary to fully utilize the entire seven types of transitions, and the slope level of the edge cannot exceed 1-in-7, and vertical cannot exceed 7-in-1. Therefore, increasing the number of sampling points can only improve the display effect of very close to horizontal or vertical boundaries.
As the resolution increases, the visual improvement effect of increased sub-sample points can gradually decrease. However, the purpose of sub-sampling anti-aliasing is not only to improve the display effect of the boundary, but also to make these objects make more coordination and easily identify when coloring the fine object. Remember those vertically growing small trees? Here we have a lifetime problem with a person's eye perceived visual effect. Unlike improved resolution, sub-sampling anti-aliasing can only improve the details of the details by changing the color of the pixels. In other words, suppose if there is a small tree in the picture, how should we color it when it is smaller than a pixel? In fact, the sub-sampling anti-aliasing is just a continuity of the appearance of the object, that is, the colored tree should be in the center of a pixel, or between the two pixels or four pixels. For those details of all other sub-sampling anti-aliasing trying to improve, the above-mentioned examples are still applicable to the principle that the above-mentioned visual improvement effects by increasing sub-sample points is still applicable.
I personally think that the pattern of 4 sampling points rotation sampling is a better balance point between performance and visual effects. However, the industry does not seem to be this model as a standard. Just as we will see in the next section, maybe they just need to make a choice in super sampling and multi-point sampling.
Transparency & Translucency (transparent and translucent)
Note: In this part, our so-called "transparent transparent" refers to a surface that can be completely perspective (invisible), and "translucent translucent" means a surface that can be partially perspective (like colored or fog glasses)
One surface is reflected in the combination of red and green (RGB), and translucent is represented by ALPHA (A) channel. A surface is covered by the material of different formats and styles to reflect the color change of this surface. The usual material is 32-bit 8888 (RGBA), which provides 256 levels of color intensity for each of the three colors of the red green, which is 1,6800,000 colors. For materials typically define their transparency, transparency or opaque (note, so-called single bit, that is, only one bit channel value is recorded using only one bit channel value, then only one bit channel value is recorded, then the alpha channel value can only be 0 or 1 There are two states of transparent or unknown states. This is half a transmissiveness corresponding to the ALPHA channel with a plurality of Bit alpha channel values by indicating red green blue, or later, respectively. This will be very convenient when you use a material to define a one-dimensional or two-dimensional object of a complex structure. For example, a barbed wire, plant or a series of fences, etc. are all such objects. All of these objects have very delicate details make it difficult to model multiple deformations. If you use some small amounts of large multilateral buildings, you will be much better by defining the transparent part of the details.
The image below is cut from the game of Crytek. The shape of the large leaves is just consisting of a few polygons. Each leaf material is green, but each leaf uses a bit to record the alpha channel value define its transparency: transparent or opaque.
Unfortunately, the use of a single bit of Alpha channel value is defined by some shortcomings. First, multi-sample full-screen anti-aliasing (MSAA) cannot improve image quality inside the same material, and cannot perform anti-aliasing operations for boundaries generated by defining the inside of the material (because these boundaries are in the material inside, in the previous part) We have said the principles of MSAA). However, there is no longer existence for the problem of super sampling anti-aliasing (SSAA).
Note: Unfolding MSAA does not talk, NVIDIA's five-point plum sparking anti-aliasing makes a border display from partially transparent. This blur we believe that it cannot be seen as an anti-aliasing and a certain degree of confusion. This is determined by the five-point plum blossom anti-algorithm itself. Because the five-point plum anthrapeutic is to achieve anti-aliasing by using information about some sub-sample points by the nearby pixels. After the algorithm is operated, it looks more blurred and has not effectively improves the visual effect.
The following pictures (GIF animation) are varied between single-point sampling to MSAA to SSAA so that everyone will make a comparison.
In the first example, pay attention to the edge of the front large leaf, the effect of MSAA is limited, while SSAA is good.
Next example, pay attention to the stones and cockroaches to get smoothing through MSAA, but only SSAA can improve the performance of the innerness of the natural.
In this picture, some edges of the sky are composed of rocks, MSAA makes the edges of the rocks relatively smooth, while other parts, the boundary of the trees, is not improved. Only SSAA has made both improvements.
Finally, we see the leaves of the trees improve in SSAA, and even you can see that the red little flower is more expressive.
The last picture here demonstrates the second problem that is limited to the Alpha channel value of the single bit; it is how to maintain its details when the object becomes smaller (more and more far). When the boundary pixel can only be opaque or transparent (ON or OFF), becoming less available pixels may not be used to constitute the original shape. Fortunately, the material can be replaced according to the size of the distance (LOD MIP-MAPPING Detail Level MIP map). This makes it possible to make the corresponding material for a long distance such that the available pixel can be used to maximize. I personally believe that CRY TEK has made the work in manufacturing a high-view plant material, making them effective restrictions in FAR CRY. However, these problems can be resolved by using multiple Bit alpha channel values (such as transparency). Note: Although you may think that Crytek uses the method of automatically generating MIP-MAP, I want to remind you that it will be much more rough than the material generated by automatically generated profiles.
Vivetical materials can greatly enhance their performance effects by combining the changed transmissiveness, while adding multiple BIT filtration during standard material filtration, such as Bilinear, Trilinear (three-linear) or Anisotropic (each Anisotropy), can help the edge part of the smooth material inside, without the need to solve the problems encountered by the multi-point sampling mentioned earlier.
Farcry is actually introduced in a few plants into a plurality of Bit alpha channel values (mostly transparency). Note that we did not open full-screen anti-sawing function in this series of pictures, and the boundaries of the leaves were still smoothed. At the same time, you should also notice that the plants in the distance have not become broken, and this situation occurs during the previous example.
Take a look at the upper half of the iron window in this picture. Although material pixels are easy to break, but their borders are relatively well to be well obtained. Wait a minute, what happened to the lower half of the iron window? Obviously, it is a bit less right.
Here is indeed a problem. If you can smooth the boundaries and details by using a translucent approach, why does Farcry use it on all plants?
Translucent problem
When 3D drawings are performed, the objects should be placed on the distant objects. Before, this requires the alignment of the object (polygon) from the previous. Unfortunate things This arrangement is very time-consuming time and for real-time images. In addition, the mutual intersection of the object also makes it possible to make a correct sorting. This introduces the concept of depth buffer (Z-buffered Z-buffer). A set of data data is used in each pixel in the 3D environment to define the vertical depth (ie the z-axis seat value) when the pixel is displayed. When a new object is to be drawn, the vertical depth of each new pixel is compared to the currently recorded depth buffer. If the new pixels are behind the pixels that have already existing, this pixel will not draw. Otherwise, the new pixels will be drawn and then updated with the new value to reflect this new, closer distance. The depth buffer allows the object to draw in any order, and since the hidden surface is processed in pixels, the object intersects each other can be properly rendered. Therefore, it is not necessary to sort.
The method mentioned above is very effective in handling all objects is opaque, but if they are transparent or translucent?
There is no problem in transparency. When rendering a material with a transparent part, an opaque area can be used for depth buffering comparisons and updates. Let's take an example to explain it. In a scenario in a single fence, the current scenes and backgrounds have been rendered, and another object can still be added between them. This is due to the smaller Z-axis seat value compared to the opacity of the opaque portion of the fence, thereby preventing a new object on these pixels. The transparent part maintains the background of the Z-axis seat value, and the new object is smaller than this value, so the replacement of this portion is achieved. So although the new object is added after the fence is rendered (that is, we can still render the entire scene. Because those behind the gaps that can be seen through the fence are also drawing. By do not update their Z buffer values for the transparent material, these transparent parts become a hole - this is the effect we want. Unfortunately, these methods said above cannot be used on a translucent surface. Because they are neither entity, it is not a hole. The translucent reflects a synthetic effect of background material and foreground material. If the previously mentioned example, convert the fence into a green glass, and bring green glass through the green glass background. We can't put another object between the glass and the background of the foreground. Because this requires a new object to bring green green. The green glass has been drawn after mixing with the background. The Z-axis seat value is recorded as the value of the coloring glass, which is clearly less than the Z-axis seating value of the object to the object, which will not draw the newly added object. The only way to ensure that the scene seen by green glass is correctly rendered to all objects behind the glass. Finally, the rendering of green glass is performed at the top. This means that all translucent surfaces must last rendering.
Although it will introduce a certain surface classification, this classification is only to distinguish the opaque surface and translucent surfaces, and this work is obviously very simple.
But this is not enough. This technology has certain limitations! It is only valid for the translucent surface without overlapping. Once the multi-level translucent material is introduced, the above method is invalid. There is a method of processing to arrange these materials to be arranged before. In a game like Farcry, if there are some plants that use multi-level translucent methods (to increase the fiber "and the smoothing of the plants), then the hundreds of plants and thousands of polygons are sorted. . This is clear that it is clear.
Now we can understand the problems existing in front of the picture. Here, the plant is drawn after the iron window. The material of the iron window is partially transparent, the depth buffer value of the transparent portion maintains a buffer value of the distal wall. This allows the plant to be drawn. However, the portion of the wall depth buffer value must be a completely transparent part of the iron window. Due to the smoothing effect of the edge edge of the iron window, the edge portion is translucent, so that the color of the wall is mixed after the translucent portion of the drawing. At this time, the Z buffered value is recorded for the value of the foreground iron window. When the plant is drawn, let us see the edge of the color of the wall through the "translucent iron window"!
You may ask, why don't you say what we have previously said before, and finally rendering iron windows? Well, it should do this, but here, plants are also used in translucent features to define its shape, so this should be left to decide which one should be rendered before. This explains why it is sorted by the overlapping translucent layers. However, most of the games will not be in this order, and if you want to get the correct sorting, you have to rely on probability. And usually the order obtained is incorrect. Many games allow plants to intersect each other when they run. This causes the case where the surface arrangement of the crosspoint is reversed. So there is a rendering in the correct order, while the other has an error. The following picture is a good example:
This picture is cut from the current popular game GTA VICE City. This game is also a transparent method to define a plant and a fence, but the game is converted to a visual effect by allowing Alpha to smoothing by allowing Alpha to smoothing. Below is an example of a rendering error: the first picture and the front iron window example. The edges of the railings have the color of the sky, and the characters are significantly rendered after the railings (the characters are usually rendered).
In the second example, the green translucent glass shows us the rendering of the palm trees behind it. Obviously, the little palm tree on the right is first rendered, and then the green glass above is mixed with it. The other two palm trees will be rendered, because the green glass has updated the value of the depth buffered value with its entire surface, and the far away is not rendered with the glass (otherwise they may seem abnormally). If we can't see these glasses, there is no problem, it is because of the translucent state of the glass, it reflects the shortcomings of translucent disadvantages.
The last example looks very confused, because the red cars are in front of the wire, and the wire is in front of the person, what about people? People in front of the car! See what everyone can think about this? :)
Through the above analysis and examples we see, the disorderly transparent material rendering is working properly, and the disorderly translucent material render does not work. That's why only a small part in so many plants in the Farcry is the use of single bit's Alpha channel values (transparent), and abandon the disadvantages of Alpha smooth and multi-point sampling anti-aliasing.
Solution?
Can we find a way to solve the problem that the sequential rendering is encountered? This allows us to enhance the details of the details of the material inside the material with Alpha channel values of the multi-bit ALPHA channel value. In fact, if there is a simple method, it is sure it has been widely adopted :)
There is a technology called "depth peeling", which uses multiple depth buffers to avoid classification of materials, but at least four rendering channels have been consumed. There is another way to call Z3, and I think that I don't think about the discussion of this article today. I want to temporarily only accept such facts, that is, the single-layer translucent surface must be rendered, while multi-layer translucent surfaces must introduce local surface sorting this approach, or simply use single bit of Alpha channel values. Bar. Everyone has seen Farcry to show us excellent material design that allows the use of single Bit alpha channel values to make a beautiful picture. I believe that the continuous advancement of graphics technology will be very beautiful, using 4X SSAA's material for single Bit alpha channel values. It will be very beautiful!