FXAA Sample


Category:  Performance Visuals
Min PC GPU: Fermi -based (GTX 4xx)
Min Tegra Device: Tegra 4

Description

This sample presents a high performance and high quality screen-space software approximation to anti-aliasing called FXAA.

APIs Used

Shared User Interface

The OpenGL samples all share a common app framework and certain user interface elements, centered around the "Tweakbar" panel on the left side of the screen, which lets you interactively control certain variables in each sample.

To show and hide the Tweakbar, simply click or touch the triangular button positioned in the top-left of the view.

Other controls are listed below:

Device Input Result
touch 1-Finger Drag Orbit-rotate the camera
2-Finger Drag Move up/down/left/right
2-Finger Pinch Scale the view
mouse Left-Button Drag Orbit-rotate the camera
Right-Button Drag Move up/down/left/right
Middle-Click Drag Scale the view (up:out, down:in)
keyboard Escape Quit the application
  Tab Toggle Tweakbar visibility
gamepad Start Toggle Tweakbar visibility
  Right Thumbstick Orbit-rotate the camera
  Left Thumbstick Move forward/backward. Slide left/right
  Left/Right Triggers Move up/down

Technical Details

Overview

FXAA is a single-pass, screen-space, anti-aliasing technique designed for producing high-quality images with low performance impact. The included code and sample use FXAA version 3.11, the latest version available as of this writing.

Figure 1: No AA vs FXAA

The technique targets aliasing both on triangle edges and within shader results. It has logic to reduce single-pixel and sub-pixel aliasing, which one can see clearly in the reduction of stipple aliasing in Figure 1.

Usage

FXAA is designed to be easy to integrate into a single pixel shader and it runs as a single-pass filter on a single-sample color image. Depending on the engine, there may be a performance advantage in merging FXAA into an existing post-processing pass. For example, the following can be done in a single full screen pass: FXAA + composite bloom results + color grading + adding film noise. If the engine already has the ability to selectively apply post processing to only the regions which need a given effect — anti-aliasing — and thus FXAA, is likely not needed in areas under strong motion blur or depth of field.

Please refer to the extensively-commented FXAA3_11.h file included in the sample for additional tuning parameters and explanation. Also refer to the original FXAA whitepaper and presentation for additional technical details.

Benefits

FXAA reduces visible aliasing while maintaining sharpness and keeping within a practical ms/frame cost for a typical game engine. For example, on a GTX 460, FXAA costs 0.88ms/frame on 1920x1080 @ 60Hz with default presets. On a GTX 560, the time drops to 0.39ms/frame with the same scene and settings.

Further, FXAA provides not only a memory advantage over MSAA, especially on stereo and multi-display render targets or back buffers, but also a significant performance advantage for deferred rendering over using MSAA and shading multiple samples.

See Also

 

 


NVIDIA® GameWorks™ Documentation Rev. 1.0.220830 ©2014-2022. NVIDIA Corporation and affiliates. All Rights Reserved.