Skip to content

NRD sample and sandbox, demonstrating path tracing and denoising best practices

Notifications You must be signed in to change notification settings

NVIDIA-RTX/NRD-Sample

Repository files navigation

NRD SAMPLE

All-in-one repository including all relevant pieces to see NRD (NVIDIA Real-time Denoisers) in action. The sample is cross-platform, it's based on NRI (NVIDIA Rendering Interface) to bring cross-GraphicsAPI support.

NRD sample is a land for high performance path tracing for games. Some features to highlight:

  • minimalistic path tracer utilizing Trace Ray Inline
  • HALF resolution (checkerboard), FULL resolution and FULL resolution tracing with PROBABILISTIC diffuse / specular selection at the primary hit
  • NRD denoising, including occlusion-only and spherical harmonics (spherical gaussians) modes
  • overhead-free multi-bounce propagation (even in case of a single bounce) based on reusing the previously denoised frame
  • SHARC radiance cache
  • reference accumulation
  • several rays per pixel and bounces
  • realistic glass with multi-bounce reflections and refractions
  • mip level calculation
  • curvature estimation
  • native integration of DLSS-SR and DLSS-RR via NGX API (not StreamLine)

BUILD INSTRUCTIONS

  • Install Cmake 3.16+
  • Install on
    • Windows: latest WindowsSDK and VulkanSDK
    • Linux (x86-64): latest VulkanSDK, libx11-dev, libxrandr-dev, libwayland-dev
    • Linux (aarch64): find a precompiled binary for DXC, libx11-dev, libxrandr-dev, libwayland-dev
  • Build (variant 1) - using Git and CMake explicitly
    • Clone project and init submodules
    • Generate and build project using CMake
  • Build (variant 2) - by running scripts:
    • Run 1-Deploy
    • Run 2-Build

CMAKE OPTIONS

  • USE_MINIMAL_DATA=OFF - download minimal resource package (90MB)
  • DISABLE_SHADER_COMPILATION=OFF - disable compilation of shaders (shaders can be built on other platform)
  • DXC_CUSTOM_PATH=custom/path/to/dxc - custom path to DXC (will be used if VulkanSDK is not found)

HOW TO RUN

  • Run 3-Run NRD sample script and answer the cmdline questions to set the runtime parameters
  • If Smart Command Line Arguments extension for Visual Studio is installed, all command line arguments will be loaded into corresponding window
  • The executables can be found in _Bin. The executable loads resources from _Data, therefore please run the samples with working directory set to the project root folder (needed pieces of the command line can be found in 3-Run NRD sample script)

REQUIREMENTS

Any ray tracing compatible GPU.

USAGE

  • Right mouse button + W/S/A/D - move camera
  • Mouse scroll - accelerate / decelerate
  • F1 - toggle "gDebug" (can be useful for debugging and experiments)
  • F2 - go to next test (only if TESTS section is unfolded)
  • F3 - toggle emission
  • Tab - UI toggle
  • Space - animation toggle
  • PgUp/PgDown - switch between denoisers

By default NRD is used in common mode. But it can also be used in occlusion-only (including directional) and SH (spherical harmonics) modes in the sample. To change the behavior NRD_MODE macro needs to be changed from NORMAL to OCCLUSION, SH or DIRECTIONAL_OCCLUSION in Shared.hlsli.

Notes:

  • RELAX doesn't support AO / SO denoising. If RELAX is the current denoiser, ambient term will be flat, but energy correct.