📜 ⬆️ ⬇️

FXAA - NVIDIA's new anti-aliasing algorithm

Hello.

The time has passed when video games brought a hurricane of emotions simply because we play them; the player has long been demanding, and last but not least - the quality of the picture on the screen. About one of the components of this quality - smoothing - I want to tell.

The vast majority of players are aware of the "ladders" at the edges of the objects and a possible solution to this problem - "anti-aliasing" or "smoothing". This issue is described in great detail in the article by Don Woligroski Anti-Aliasing Analysis, Part 1: Settings And Surprises ( Russian translation ). Also a good comparison with the examples of games of the current generation of game consoles is in Digital Foundry - The Anti-Aliasing Effect (eng.) . In short, it all comes down to one thing: smoothing is great, the perception of the picture grows in price, in the modern realities of the igroproma products with little or no smoothing are in the category of booed (first of all by the fans of competing platforms, but nonetheless) , but the implementation of high-quality anti-aliasing leaves much to be desired, mainly due to the insufficient computing power of the target equipment. In this case, apologists of the game on the PC are, of course, in much more favorable conditions. the power of their iron is influenced only by the material factor, but consolers do not miss a chance to jig above PKshniki on the subject of “PC HAZ NO GAEMZ!”, they say, you do not have games, you play in graphics. I will not specifically address this issue, because there can be no rational-objective arguments in favor of the subjective feeling of “warm tube gaming” in principle, it is a matter of personal choice with all that it implies. Already existing and used algorithms are described by the above links, so I’ll go directly to the topic: what is FXAA, what does it eat and how tasty is it.

Let's start with the theory. To be extremely precise, FXAA is not such a new algorithm: it was first used in the MMORPG Age of Conan and was already noted in the F.3.AR shooter, but I will consider it as new, thanks to an interesting solution that I came across eyes on the frequently visited forum (thanks to h0w1er ). FXAA - X ast Xtimate is a more productive solution in comparison with traditional MSAA (Multi-Sampling Anti-Aliasing). This is a single pass pixel shader that cheats the resulting frame at the post processing stage. It is designed to be faster and less memory-demanding in comparison with MSAA, “paying” for its “advantages” with precision and quality, although in reality everything is not as scary as it sounds. FXAA also has a number of advantages, including improved smoothing of specs and subpixels (talking about surfaces smaller than one pixel, "ladders" make such objects twinkle). In an official document (PDF), FXAA creator Timothy Lottes states that for the FXAA algorithm with medium quality settings (the middle ground between quality and performance), post-processing a 1920x1200 frame on a GTX 480 takes less than a millisecond. The main advantages of FXAA, according to Timothy, are the FXAA subpixel smoothing algorithm that works better in MLAA , the sufficiency of DX9 level iron, post-processing a frame in one pass and, in my opinion, the most interesting thing is independence from the Compute API used by the GPU . But there is one problem - the need for developers to embed this anti-aliasing technology into their games, while traditional anti-aliasing methods work (or do not work) at the driver level. In other words, as long as the programmers do not use the FXAA code for smoothing in their engines, we will not get the desired effect, it is impossible to officially enable FXAA from the outside. Until recently.
')
On July 31, in the Alles rund um FXAA branch (Treibereinstellungen, Shader-replacements) of the 3DCenter Forum, “some dude” appeared , which injected the FXAA code into the d3d.dll library and allowed to flexibly adjust the result through configuration files, as well as enable and disable FXAA on the Insert button and take screenshots by pressing Delete [Pause], and [Print Screen] takes a screenshot starting with beta 9. This set of files is copied to the directory with the executable file of the DX9 application (games, demos is not important), and this application when launched, it “picks up” the library with the necessary injection. And off we go: since Gast (the author of the injection) was initially preoccupied with saving the results of the work to the log, the people began to send him bugs, which Gast, in turn, began to rule. Later, an injection for DX10 (dxgi.dll) appeared in his set , now the option to add FXAA to DX11 is being considered, but the author does not have DX11 iron, so the question hung a bit in the air , and from the beta 10 version - and DX11 (but do not forget that it's still a beta injection).
UPDATE 08/19/2011
<There used to be a bunch of links that have lost relevance>
On August 19, 2011 the current version is beta 10 , mirrors: rapidshare.com , letitbit.net , depositfiles.com , rghost.net . Unfortunately (or fortunately, someone like) a set of filters from pedace with vignetting, sepia, etc. for beta 10 has not yet been announced, but came across custom filters for this version, mirrors: [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ].

And now - dancing practice. Will practice on World of Tank, version 0.6.6.

WoT no WoT EdgeAA

WoT FXAA WoT FXAA Sharpen

The non-anti-aliasing option (No AA) shows obvious “escalators”, and although the models of tanks are quite large and detailed, the artifacts can be seen quite clearly, especially on thin objects, which are further discussed below.

The option of built-in anti-aliasing (Edge AA) tries to blur the edges of objects, but it does it rather mediocre, not to mention leaving the picture in a small soap.

The next option is FXAA, the result is obvious: there are no artifacts around the edges, however, the soapness, in comparison with noAA, was also added a little, although with EdgeAA the difference is almost imperceptible.

Well, option FXAA Sharpen. Gast in the version of beta 6 added a sharpness filter, taken from MPC-HC , and the result is very decent: the soap disappeared, the textures began to look even sharper than in the original, and the “ladder”, despite this filter, was hardly added. Because of the unplanned authorship of the sharpness of the texture of the tower, a little bit “knocked out” (blue zone), but in the game, I can assure you, it is absolutely imperceptible.

And what about performance? Yes, almost nothing bad. Unfortunately, the WoT engine lives in its own world, and surges / drops in performance can pop up on the most level ground. I got the following:

WoT inbattle noAA WoT inbattle FXAA Sharpen

The “In battle no AA” picture is what I mentioned above: thin trees crack from artifacts, whereas with the “In battle FXAA Sharpen” option, the pictures are much more pleasant to the eye, except for the problems of the sharpness filter, which narrows too thin the thickness of the hair, such as, for example, a mounted artillery sight. And the number of frames per second in the FXAA version is even higher, despite the fact that these two screenshots were made with a difference of 1 second and the tank was still.

In fact, with a long test, a figure of ~ 10-12% was obtained - performance drops as much when using FXAA, while MSAA 4x, with the smoothing quality of which FXAA competes, quite often results in a fall of twice. If comparisons are interesting - more numbers and pictures can be found in NVIDIA's New FXAA Antialiasing Technology article from the [H] ard | OCP site, where I gathered some information, and in the end of my short review I agree with Mark Warner @ HardOCP: with proper implementation from FXAA a great future, especially on consoles, where resources are tightly limited, and with the ability to customize the injection configuration to your liking, many now without the help of developers can enjoy the beautiful picture in their favorite game.

UPD. On August 10, a more customizable injection , a so-called “hodgepodge” from discussion participants, has already appeared: INJ_FXAA_DX9_pedace_v1.rar , mirrors: rapidshare.com , letitbit.net , depositfiles.com , rghost.net , hotfile.com . The assembly includes various filters: color saturation, vignetting, blur, sepia and others. All this is configured through a single settings file and the most useful - the settings change “on the fly”: Alt + Tab from the settings editing application, Alt + Tab back - the new settings work, no restart is required. With this injection option, I got rid of fading when turning on the sharpness filter, in the settings I completely disabled USE_TECHNICOLOR, USE_TONEMAP and USE_VIGNETTE. The result looks like this:

WoT pedace noAA WoT pedace FXAA

There is a clearer picture without the “ladders” and soap, even the textures look more fun.

UPDATE # 2



Added BMP PNG from Fraps. Somewhere my joint, I agree: I assumed that it’s impossible to get a screenshot of the FXAA results directly from the game, as it cannot be done in the case of MLAA, but as it turned out, you can, because This is not a post-processing of the frames by the driver after the output to the screen, but a direct image through the injection.

Source: https://habr.com/ru/post/126047/


All Articles