Raytracing made a big debut at the Game Developers Conference 2018 in San Francisco thanks to the announcement of NVIDIA RTX and Microsoft DXR API.
The idea to adopt a hybrid approach to enable raytracing in the very near future (the first game due to support it should be Metro Exodus by 4A Games) initially led to improvements in lighting, real-time reflections and ambient occlusion techniques.
However, NVIDIA shared a paper ahead of the upcoming High-Performance Graphics 2018 event (Vancouver, 10-12 August) to highlight a new Adaptive Temporal Antialiasing technique, ATAA. Signed by Adam Marrs, Josef Spjut, Holger Gruen, Rahul Sathe, and Morgan McGuire, the paper demonstrates a hybrid approach whose goal is to remove the ghosting and blurring seen with the standard Temporal Antialiasing (TAA) technique while achieving quality approaching 8x supersampling of geometry, shading and materials.
The authors mention clearly that the use of this technique cannot be advocated on current generation GPUs, given that it’s very much based on raytracing. However, they suggest that will change once mainstream GPUs with support for Microsoft DRX API become widely available to customers. We’ll be sure to update you once ATAA becomes featured in commercial games.
We designed our method for compatibility with conventional game engines and to harness the strengths of TAA, while addressing its failures unequivocally and simply. The core idea is to run the base case of TAA on most pixels and then, rather than attempting to combat its failures with heuristics, output a conservative segmentation mask of where it will fail, and why. We then replace the complex heuristics of TAA at failure pixels with robust alternatives, adapting to the image content.
We implemented the ATAA algorithm in Unreal Engine 4 and gathered results using Windows 10 v1803, Microsoft DXR, the NVIDIA RTX enabled 398.11 driver, and an NVIDIA Titan V GPU. To demonstrate the image quality achievable with ATAA, Figure 3 shows a comparison of ATAA and other common antialiasing algorithms used in games, zoomed to challenging areas of the scene.
The No AA row demonstrates the baseline aliasing that is expected from a single raster sample per pixel. The FXAA and TAA rows are the standard implementations available in UE4. SSAA 4x is 4× supersampling. We show the segmentation mask and three variations of ATAA with 2, 4, and 8 rays per pixel. Since the drawbacks of standard TAA are difficult to capture in still images, and all images in Figure 3 come from a stable converged frame, the supplemental video provides a more faithful comparison between standard TAA and ATAA in practice, including motion artifacts.
On an NVIDIA Titan V GPU at 1920×1080 resolution, ATAA runs in 18.4ms at 8× supersampling, 9.3ms at 4× supersampling, and 4.6ms at 2× supersampling for the image in Figure 1. This includes the creation of the standard TAA result, our segmentation mask, and adaptive ray tracing (including 1 shadow ray per light per primary ray). For the view shown in Figure 3, 107,881 pixels are selected for adaptive ray tracing, representing 5.2% of the total image resolution.
The specific number of rays identified for antialiasing varies per frame according to the segmentation mask. In addition, the FXAA pass adds as much as 0.75ms when the whole frame is new, but in practice scales linearly down to 0 as fewer of the pixels are identified for FXAA in the mask. Under typical camera motion fewer than 5% of pixels are selected for FXAA. Our ATAA solution integrated successfully operates within the 33 millisecond frame budget for a typical UE4 frame across all settings. Operating within a total frame budget of 16ms, while also ray tracing 1spp shadows at screen resolution, is possible with the 2× and 4× ATAA variants. As DXR is an experimental feature of Windows 10 v1083, we are optimistic that performance will improve as the runtime and driver receive important release optimizations.
The best known solution for offline rendering is adaptive supersampling. This was previously impractical for rasterization renderers in the context of complex materials and scenes because there was no way to efficiently rasterize sparse pixels. Even the most efficient GPU ray tracers required duplicated shaders and scene data. While DXR solves the technical challenge of combining rasterization and ray tracing, applying ray tracing to solve aliasing by supersampling was nontrivial: knowing which pixels to supersample when given only 1spp input, and reducing the cost to something that scales are not solved by naively ray tracing.
We have demonstrated a practical solution to this problem; so practical that it runs within a commercial game engine, operates in real-time even on first-generation real-time ray tracing commodity hardware and software and connects to the full shader pipeline.
Where film renderers choose pixels to adaptively supersample by first casting many rays per pixel, we instead amortize that cost over many frames by leveraging TAA’s history buffer to detect aliasing. We further identify large, transient regions of aliasing due to disocclusions and employ post process FXAA there rather than expending rays. This hybrid strategy leverages the advantages of the most sophisticated real-time antialiasing strategies but avoids their limitations. By feeding our supersampled results back into the TAA buffer, we also increase the probability that those pixels will not trigger supersampling on subsequent frames, further reducing cost.