NVIDIA's New FXAA Antialiasing Technology

NVIDIA's FXAA technology debuted in Age of Conan, and was recently found in Day 1 Studio's F.3.A.R. We'll look into FXAA and tell you what it is, what it does, and what gamers can expect out of it. We were surprised by the results, and we think you will be too. Will it be methods like this that replace traditional AA? We certainly hope so.

Introduction

In our recent gameplay performance evaluation of F.3.A.R., we briefly touched on NVIDIA’s new FXAA technology. This new antialiasing algorithm created by NVIDIA hasn't had as big of a fan fare welcoming, or hype, as AMD's Morphological Antialiasing had. You might have not even heard of FXAA before, but this new type of antialiasing has the potential to challenge traditional AA, and even AMD's Morphological AA (MLAA). With two new games supporting FXAA, Duke Nukem Forever and F.3.A.R, with more games on the way, it is time for HardOCP to dive into this new technology and look at performance and image quality. You may be surprised just how well this new AA works, and you might find it gives AMD's MLAA a run for its money.

NVIDIA’s FXAA Technology

FXAA stands for Fast Approximate Anti-Aliasing. It does exactly what it sounds like. It is a higher-performance approximation of the effects of traditional Multi-Sampling Anti-Aliasing. It is a single-pass pixel shader which runs in the post-processing stage of the target game’s rendering pipeline. It is designed to be faster, and have a smaller memory footprint, than traditional MSAA, but with some compromises in precision and quality.

FXAA also has advantages, including the reduction of specular aliasing and sub-pixel aliasing (aliasing that happens when surfaces are rendered smaller than a single pixel, which makes them flicker). In his whitepaper (PDF) at developer.nvidia.com, FXAA creator Timothy Lottes claims that the cost to process a single 1920x1200 from on an NVIDIA GeForce GTX 480 is under one millisecond for FXAA preset 2, which stands in the middle of the technology’s performance/quality compromise.

The whitepaper lists these four items as initial bullet points:

1. Reduces visible aliasing while maintaining sharpness and keeping within a practical ms/frame cost for a typical game engine. Cost to process a 1920x1200 frame on GTX480 is under 1ms for FXAA preset 2.

2. Targets aliasing both on triangle edges and in shader results. FXAA has logic to reduce single-pixel and sub-pixel aliasing: see the reduction in stipple aliasing in the jittered sampling shadow area in Figure 1

3. Is easy to integrate into a single pixel shader. FXAA runs as a single-pass filter on a single-sample color image. FXAA can provide a memory advantage over MSAA, especially on stereo and multi-display render targets or back buffers.

4. Can provide a performance advantage for deferred rendering over using MSAA and shading multiple samples.

An important aspect of FXAA to note is that it is compatible with NVIDIA and AMD GPUs. In his blog, Mr. Lottes answers the "Why FXAA?" question with the following:

Wanted something which handles sub-pixel aliasing better than MLAA, something which didn't require compute, something which runs on DX9 level hardware, and something which runs in a single full-screen pixel shader pass. Basically the simplest and easiest thing to integrate and use.

So does FXAA use DirectCompute? No, FXAA is just a post-processing shader. It is independent of any GPU Compute API, which was Lottes goal. FXAA is to be an efficient alternative to traditional anti-aliasing where MSAA is either impractical (too costly) or ineffective (shader aliasing) while having broad compatibility and simple integration. While we can neither speculate nor comment on the ease of integration, we can measure performance and examine image quality.

It's not entirely that simple though. There are currently three versions of FXAA in the wild, and it can be customized quite extensively. We reached out to NVIDIA for more information, and Mr. Lottes responded to us with this information:

FXAA image quality and performance will vary from title to title.

FXAA is different in that unlike 4xMSAA and other hardware techniques, FXAA is a shader which gets adapted differently by each developer when FXAA is integrated into a title. The developer has full control over the trade-off between sharpness, reduction of aliasing, and performance. Some developers might prefer more aliasing to enhance the feeling of sharpness, other developers might prefer a higher reduction in aliasing which might be perceived being softer on still images.

What makes FXAA unique over techniques like MLAA is that FXAA has special logic to reduce the contrast of single-pixel and sub-pixel sized features that would otherwise be much more visually distracting without hardware AA. For example, single-pixel sized features alias by snapping from pixel to pixel, and sub-pixel sized features alias by flickering on and off as they overlap a pixel's center. Like other aspects of FXAA, the developer has full control as to how much of this contrast reduction to include in the title.

Note, there are also many different versions of FXAA: FXAA 1 (which was described in the NVIDIA DX11 SDK white paper you mentioned), FXAA 2 which was designed for the Xbox 360, and FXAA 3 of which there are two algorithms, FXAA 3 Quality for the PC and FXAA 3 Console designed for the Xbox 360 and PS3. Performance has changed between versions: FXAA 3 has some major performance advantages over FXAA 1. A typical 720p video frame can be processed with FXAA 3 Quality in around 0.21 milliseconds on a GTX 480 with the default settings in DX11. Performance will also vary between DX9 and DX11 for the same settings (DX11 being faster due to gather4 and programmable offsets).

The FXAA in FEAR3 is based on FXAA 1. FXAA 1 was also used in Duke Nukem Forever, Age of Conan, Crysis 2 (with their temporal 2x supersampling) and Brink.

So what we will see today in terms of performance and image quality is representative of FXAA 1, as FXAA improves in future titles the performance and image quality will only get better, this is the first implementation of the technology being shown here today in this game.


Test Setup

Article Image

For all three NVIDIA-based video cards in this evaluation, we are using NVIDIA's GeForce/ION Driver 275.50 Beta package, dated 20 June 2011. For all three AMD-based video cards in this evaluation, we are using AMD's Catalyst 11.6 WHQL driver package, dated 15 June 2011. All drivers are indicated for use with Windows 7 x64.


Test Procedure

Since this article focuses on the implementation of FXAA in F.3.A.R., we are going to use that game for testing. To evaluate performance in F.3.A.R., we played through the entire single player campaign. During that process, Intervals 03 and 07 proved to be more demanding than the others. Between those two, Interval 07 is slightly more graphically intense in certain areas, so we chose to use it for our testing procedure. We recorded framerates from the beginning of Interval 07 until the point at which Alma's screaming causes an Armacham helicopter to crash through the roof of the causeway through which we were walking, ending the test while looking at the burning wreckage. The test takes between 15 and 18 minutes to complete, depending on how the AI-controlled enemies react to our actions.

There is a noticeable degree of randomness to the enemy AI in this game, making each run slightly different than the one before. We used a trainer to test in godmode. The trainer's invincibility option allowed us to reproduce tests as consistently as possible, as well as reducing the amount of retesting required after dying and restarting or reloading. It also allowed us to test more gameplay time in our run-through so we could get a very thorough run-through with intense graphics. During testing, we determined that an average framerate of at least 37FPS is necessary for the game to retain a silky, fluid quality.