TXAA Overview
MSAA
TXAA 2.1 - Motion Vector Input
TXAA 2.E - Resolved Depth Input
TXAA Library API
Terms - What is SGSSAA?
Progression of AA Quality
MSAA Without SGSSAA Methods
TXAA Without SGSSAA Methods
MSAA With 2xSGSSAA Methods
TXAA With 2xSGSSAA Methods
TXAA With 4xSGSSAA Methods
Example Timing With Driver Override
TXAA/MSAA Quality = # of Samples
TXAA/MSAA + Post Processing Problem
TXAA/MSAA + Post Processing Fix
Example TXAA/MSAA Friendly Post Pipeline
Post Example Optimizations
API Tools for Selective Super-Sampling
High Quality Alpha Test
OpenGL ARB_sample_shading
Manual Sample Frequency Shading
Thanks!
25.70M
Category: advertisingadvertising

NVIDIA Graphics Technology Libraries TXAA

1.

NVIDIA Graphics Technology Libraries
TXAA

2. TXAA Overview

TXAA is a form of temporal anti-aliasing mixed with MSAA
TXAA replaces MSAA Resolve
TXAA also provides a higher quality resolve filter
• Better than the default MSAA box filter
TXAA is provided as library
• Library supported on NVIDIA Kepler and future GPUs
• Library currently DX11 only (GL in progress)
• 2 versions of the library: TXAA 2.1 and TXAA 2.E

3. MSAA

2x or 4x
MSAA
Color
MSAA Resolve
Resolved
Color
Processing
After
Resolve

4. TXAA 2.1 - Motion Vector Input

Motion Vector is offset to
location of pixel in prior frame
Motion
Vectors
2x or 4x
MSAA
Color
Prior TXAA
Output
TXAA Resolve
Resolved
Color
Processing
After
Resolve

5. TXAA 2.E - Resolved Depth Input

Resolved
Depth
2x or 4x
MSAA
Color
Prior TXAA
Output
TXAA Resolve
(converts depth
to camera motion)
Resolved
Color
Processing
After
Resolve

6. TXAA Library API

Very simple library interface
• TxaaOpenDX()
• TxaaResolveDX() - Call in place of MSAA resolve
• TxaaCloseDX()
• Built in debug visualization modes
TXAA library header provides
• Example good precision depth to camera motion vector transform
• For those who want to roll their own motion vectors (TXAA 2.1)

7. Terms - What is SGSSAA?

Sparse Grid Super-Sampling Anti-Aliasing
In this talk SGSSAA refers to the full collection of methods
which increase the number of shaded samples/pixel
• Using a driver SGSSAA override
• Sample frequency shading in a pixel shader
• Setting coverage mask for alpha test
• ARB_sample_shading
• Manual super-sampling in a pixel frequency shader

8. Progression of AA Quality

Looking at samples used to reconstruct pixel color
• More shaded samples increases quality

9. MSAA Without SGSSAA Methods

Multi-sampling only on triangle edges
• Limited quality on surfaces like alpha tested leaves
Standard MSAA perceptual box filter
• Limited filter quality

10.

No AA
Call of Duty Black Ops 2

11.

2xMSAA
Call of Duty Black Ops 2

12.

4xMSAA
Call of Duty Black Ops 2

13. TXAA Without SGSSAA Methods

Approaches SGSSAA quality in motion
• Thanks to the temporal filter
Improved quality spatial filter
• Proper linear filtering
• Better quality on diagonals
• Slightly better quality on pixel frequency alpha test

14.

2xTXAA
Call of Duty Black Ops 2

15.

4xTXAA
Call of Duty Black Ops 2

16. MSAA With 2xSGSSAA Methods

2 shaded samples/pixel isn't enough with the box filter
• Box filter not leveraging samples around pixel

17.

2xMSAA + 2xSGSSAA
Call of Duty Black Ops 2

18.

4xMSAA + 2xSGSSAA
Call of Duty Black Ops 2

19. TXAA With 2xSGSSAA Methods

High quality:cost ratio

20.

2xTXAA + 2xSGSSAA
Call of Duty Black Ops 2

21.

4xTXAA + 2xSGSSAA
Call of Duty Black Ops 2

22. TXAA With 4xSGSSAA Methods

The ultimate in quality for relatively high cost
TXAA offers higher quality filtering over MSAA

23.

4xMSAA + 4xSGSSAA
Call of Duty Black Ops 2

24.

4xTXAA + 4xSGSSAA
Call of Duty Black Ops 2

25. Example Timing With Driver Override

15.2 ms/frame : 4xTXAA + 4xSGSSAA
13.9 ms/frame : 4xMSAA + 4xSGSSAA
Can do better with manual selective super-sampling!
10.4 ms/frame : 8xMSAA + 2xSGSSAA
10.2 ms/frame : 4xTXAA + 2xSGSSAA (Very high quality sweet spot!)
9.3 ms/frame : 2xTXAA + 2xSGSSAA
9.1 ms/frame : 4xMSAA + 2xSGSSAA
8.3 ms/frame : 2xMSAA + 2xSGSSAA
8.1 ms/frame : 4xTXAA
8.0 ms/frame : 8xMSAA
7.8 ms/frame : 2xTXAA
7.7 ms/frame : 4xMSAA (CPU bound in this example)

26.

Video
4xTXAA + 4xSGSSAA
Call of Duty Black Ops 2

27. TXAA/MSAA Quality = # of Samples

Visual edges require more than 1 sample/pixel
• Otherwise quality will be poor
Visual edges are caused by more than just triangles
• Alpha test surfaces from textures
• Soft particle to opaque triangle edge
• Post processing (depth of field, motion blur, etc)
Requires smart application of selective super-sampling

28. TXAA/MSAA + Post Processing Problem

Post Processing applied per pixel on edges removes AA
Edge AA
Gone
No Depth Of Field
Per Pixel
Depth Of Field

29. TXAA/MSAA + Post Processing Fix

Many kinds of effects
• Motion Blur
• Depth of Field
• Screen Space Ambient Occlusion
• Soft Particle Blending
Complex Pixel
Mask From
• Screen Space Reflections
Prior Slide
• etc
Fix by masking simple and complex pixels
Apply post processing per sample on complex pixels

30. Example TXAA/MSAA Friendly Post Pipeline

4
1
MSAA
Rendered Frame
Rendering
Per Pixel
Blend in Post
Processing
5
Custom
Resolve
Simple/Complex
Pixel
Stencil Mask
2
1/2 Res
Frame
MSAA Frame
+ Per Pixel Post
Processing
Per Sample
Blend in Post
Processing
MSAA Frame
3
Post
Process
+ All Post
Processing
1/2 Res
Post
TXAA
Resolve
6

31. Post Example Optimizations

Output full and low resolution target in single pass
• Leverage surface stores to write low resolution target
• Custom resolve sets full res stencil and writes 1/2 res frame
Hardware blending is bandwidth optimized
• Alpha=0.0 blending is very fast (no read, no write)
• Alpha=1.0 blending is very fast (no read)

32. API Tools for Selective Super-Sampling

33. High Quality Alpha Test

Manually super-sample alpha test in pixel shader
• Set coverage mask to samples which pass test
GL: interpolateAtSample(), gl_SampleMask
DX: EvaluateAttributeAtSample(), SV_Coverage
Pixel

34.

Image captured from Call of Duty Black Ops 2 with 4xTXAA+4xSGSSAA

35. OpenGL ARB_sample_shading

OpenGL only feature to adjust MSAA shading rate
Examples with 4xMSAA
• glMinSampleShadingARB(0.0) = 4xMSAA
• glMinSampleShadingARB(0.5) = 4xMSAA+2xSGSSAA
• glMinSampleShadingARB(1.0) = 4xMSAA+4xSGSSAA
The "0.5" option offers a middle ground in performance and
quality between full 4xSGSSAA and just 4xMSAA

36. Manual Sample Frequency Shading

For 4xMSAA turns on/off 4xSGSSAA for shader
• Not as fine of a control as glSampleShadingARB()
Enable sample frequency shading in pixel shader
GL: "sample" interpolation qualifier
DX: "sample" interpolation modifier

37. Thanks!

Special thanks to Activision and Treyarch
• For TXAA support in Call of Duty Black Ops 2
• Video and image crops from Call of Duty Black Ops 2
More info
• http://developer.nvidia.com
English     Русский Rules