Training and Predicting Visual Error for Real-Time Applications

João Libório Cardoso, Bernhard Kerbl, Lei Yang, Yury Uralsky, Michael WimmerarXiv 2023 · DOI

TL;DR

This paper introduces a lightweight convolutional neural network (CNN) that predicts complex visual error metrics (like FLIP or LPIPS) in real-time without requiring a reference image. By using readily available G-buffer data and reprojected information from previous frames, the system enables content-adaptive shading decisions—such as Variable Rate Shading (VRS)—achieving up to a 2x performance boost in rendering while maintaining high perceptual quality.

What Problem Does This Paper Address?

In modern real-time rendering, there is a constant tug-of-war between visual fidelity and performance. Techniques like Variable Rate Shading (VRS) allow GPUs to shade regions of the screen at lower resolutions to save time. However, the million-dollar question is: how do you decide which regions can be shaded coarsely without the user noticing?

Existing solutions usually rely on simple heuristics (like luminance gradients) or reprojected data from previous frames. These methods have two major flaws:

  1. The "Unseen" Problem: They fail in newly disoccluded regions (e.g., when a camera moves quickly around a corner) because there is no historical data to reproject.
  2. Metric Complexity: Sophisticated perceptual metrics that mimic human vision (like FLIP) are too computationally expensive to calculate at 60+ FPS and require a "ground truth" reference image that hasn't been rendered yet.

Methods

The authors propose a learning-based approach to predict these errors before the expensive shading pass occurs.

  • Compact CNN Architecture: The authors designed a 5-block CNN optimized for speed. It uses early max-pooling and grouped convolutions to maintain high parallelism, making it compatible with inference engines like NVIDIA TensorRT.
  • Input Selection: To keep the network lean, they identified a "sweet spot" of four input channels: a reprojection mask (seen vs. unseen), one channel of reprojected color, one channel of diffuse material color, and the Z-axis of view-space normals.
  • Reparameterization: Visual error data is notoriously unbalanced—most pixels have near-zero error, while a few have huge spikes. The authors introduced Clamped and Logistic Transforms to balance the training loss, ensuring the network learns to predict both subtle and obvious artifacts accurately.
  • Weber Correction Embedding: Instead of predicting raw error and then applying a "Just-Noticeable Difference" (JND) threshold at runtime, they bake the Weber-law-based correction (which accounts for how our eyes perceive error differently in bright vs. dark areas) directly into the network's target values.
Figure 2: Proposed network architecture for metric predic- tion. Each block 𝑖performs down-pooling at size Λ(𝑖).

Datasets

The authors developed an automated data capture pipeline using Blender and the Falcor rendering framework.

  • Training Data: 12,820 viewpoint pairs captured across 8 different scenes, including standard assets like Amazon Bistro and UE4 Suntemple.
  • Evaluation: The network was tested on scenes it had never seen during training, such as Emerald Square and Sibenik Cathedral, to prove its ability to generalize.

Key Insights and Ideas

  • G-Buffers are the Hero for Unseen Regions: While reprojected color is the strongest predictor for areas the camera has already seen, G-buffer data (normals and diffuse color) allows the network to make "educated guesses" about error in brand-new regions.
  • Metric Agnostic Training: The architecture doesn't care which metric it's predicting. It can be trained to mimic PSNR, FLIP, or LPIPS, effectively acting as a real-time "proxy" for these slow algorithms.
  • VRS Extrapolation: To avoid predicting every possible shading rate (1x2, 2x1, 4x4, etc.), the authors found they could predict just a few and use a constant scaling factor ($k=2.13$) to accurately extrapolate the rest.

Key Results

  • High Accuracy: The models account for 70%–90% of the variance ($R^2$) across different metrics and scenes.
  • Massive Speedup: Inference takes approximately 2ms on an NVIDIA RTX 2080 Ti. This is roughly 96x faster than computing the FLIP metric directly on the GPU.
  • Rendering Gains: In a content-adaptive VRS pipeline, the approach achieved up to 2.16x speedup during fast camera motion compared to state-of-the-art methods, primarily because it could aggressively down-shade "unseen" regions that it predicted would have low perceptual error.
Proposed rendering mode selection pipeline.

Limitations and Future Work

  • Temporal Lag: Because the network relies on reprojected color, sudden lighting changes (like a flashlight turning on) might only be reflected in the error prediction with a one-frame delay.
  • Hallucinations: Imprecise reprojection can sometimes cause the network to "hallucinate" duplicates of thin objects.
  • Inference Overhead: The ~2.3ms cost of the neural network means this technique is most beneficial for "heavy" shaders (e.g., ray-traced effects or complex PBR) where the shading savings significantly outweigh the inference cost.
  • Future Directions: The authors suggest exploring more sophisticated scene feature encodings (like light source positions) to eliminate the reliance on reprojection entirely.

Summary updated

BibTeX
@misc{cardoso2023training,
  author = {João Libório Cardoso and Bernhard Kerbl and Lei Yang and Yury Uralsky and Michael Wimmer},
  title = {{Training and Predicting Visual Error for Real-Time Applications}},
  year = {2023},
  eprint = {2310.09125},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.09125},
}
Figure