BlendedAA Sample


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

Description

This sample implements a two-pass additive blending anti-aliasing technique using Target-Independent Rasterization (TIR), which should give comparable results to MSAA with a reduced memory footprint.

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

This blended anti-aliasing technique uses Target-Independent Rasterization (TIR) to perform a two-pass forward-rending algorithm which gives identical results to normal multisampling (MSAA) with a smaller memory footprint.

Target-Independent Rasterization allows the rasterizer's sample rate to differ from that of the render target. It then uses a configurable process to resolve the samples and write to the render target. For this sample, we modulate the final color by the percentage of samples covered, and use additive blending combined with a Z-prepass to accumulate the visible colors for each pixel. The result should be the same as running MSAA at the same frequency and resolving.

Benefits

With Target-Independent Rasterization, we can rasterize primitives at a high sample rate while keeping render targets at a lower sample rate, significantly reducing the memory footprint of the application compared to MSAA at the same frequency, especially as resolution scales up. The final resulting image is identical to that generated by a full MSAA pass with a normal resolve.

Caveats

Due to the need to use the high frequency coverage for each individual primitive to modulate the final color, this algorithm will only work with forward rendering. Also, to ensure that the additive blending only affects those pixels in which the primitive is actually visible, we need to do a Z-prepass to cull out occluded samples. Finally, rendering transparent geometry at the higher sample rate requires an alternative approach to the traditional SOURCE_ALPHA, ONE_MINUS_SOURCE_ALPHA back-to-front blending technique. For example, we can use SRC_ALPHA_SATURATE combined with additive blending and draw primitives front-to-back.

Memory Allocations

This sample provides a counter under the FPS display, which shows the current allocated GPU memory. Due to how the GPU allocates and frees memory as needed, it may not always equal the exact amount of memory the application actually needs in order to run. If we toggle between different AA modes, we will see that the reported memory usage will depend not only on the current setting, but some history of previous settings as well. However, we should still see a general trend that TIR will require less memory than MSAA, but more than no AA at all.

 

 


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