Skip to content

NVIDIAGameWorks/RTX-Path-Tracing

Repository files navigation

RTX Path Tracing v1.3.0

Title

Overview

RTX Path Tracing is a code sample that strives to embody years of ray tracing and neural graphics research and experience. It is intended as a starting point for a path tracer integration, as a reference for various integrated SDKs, and/or for learning and experimentation.

The base path tracing implementation derives from NVIDIA’s Falcor Research Path Tracer, ported to approachable C++/HLSL Donut framework.

GTC presentation How to Build a Real-time Path Tracer provides a high level introduction to most of the features.

Features

  • DirectX 12 and Vulkan back-ends
  • Reference and real-time modes
  • Simple BSDF model that is easy to extend
  • Simple asset pipeline based on glTF 2.0 (support for a subset of glTF extensions including animation)
  • NEE/visibility rays and importance sampling for environment maps with MIS
  • Basic volumes and nested dielectrics with priority
  • RayCone for texture MIP selection
  • Basic analytic lights (directional, spot, point)
  • RTXDI integration for ReSTIR DI (light importance sampling) and and ReSTIR GI (indirect lighting)
  • OMM integration for fast ray traced alpha testing
  • NRD ReLAX and ReBLUR denoiser integration with up to 3-layer path space decomposition (Stable Planes)
  • Reference mode 'photo-mode screenshot' with basic OptiX denoiser integration
  • Basic TAA, tone mapping, etc.
  • Streamline + DLSS integration

Requirements

  • Windows 10 20H1 (version 2004-10.0.19041) or newer
  • DXR Capable GPU
  • GeForce Game Ready Driver 531.18 or newer
  • DirectX 12 or Vulkan API
  • DirectX Raytracing 1.1 API, or higher
  • Visual Studio 2019 or later with Windows 10 SDK version 10.0.20348.0 or later

Known Issues

  • Enabling Vulkan support requires a couple of manual steps, see below
  • SER support on Vulkan is currently work in progress
  • Using SER with DLSS3 Frame Generation is known to cause crashes in certain conditions in drivers older than version 536.99
  • Running Vulkan on AMD GPUs may trigger a TDR during TLAS building in scenes with null TLAS instances
  • We recommend using NVIDIA Nsight Graphics graphics for frame capture and analysis. If using other GPU performance tuning and debugging tools such as PIX on Windows, it is advisable to disable NVRHI_WITH_NVAPI and STREAMLINE_INTEGRATION variables in CMake to avoid compatibility issues. Please note: disabling these settings results in lower performance and missing features.

Folder Structure

/bin default CMake folder for binaries and compiled shaders
/build default CMake folder for build files
/donut code for a custom version of the Donut framework
/donut/nvrhi code for the NVRHI rendering API layer (a git submodule)
/external external libraries and SDKs, including NRD, RTXDI, and OMM
/media models, textures, scene files
/tools optional command line tools (denoiser, texture compressor, etc)
/RTXPT RTX Path Tracing core; Sample.cpp/.h/.hlsl contain entry points
/RTXPT/PathTracer Core path tracing shaders

Build

At the moment, only Windows builds are supported. We are going to add Linux support in the future.

  1. Clone the repository with all submodules recursively:

    git clone --recursive https://github.com/NVIDIAGameWorks/RTX-Path-Tracing.git

  2. Use CMake to configure the build and generate the project files.

    cd Path-Tracing-SDK
    cmake CMakeLists.txt -B ./build
    

    Use -G "some tested VS version" if specific Visual Studio or other environment version required. Make sure the x64 platform is used.

  3. Build the solution generated by CMake in the ./build/ folder.

    In example, if using Visual Studio, open the generated solution build/RTXPathTracing.sln and build it.

  4. Select and run the RTXPT project. Binaries get built to the bin folder. Media is loaded from media folder.

    If making a binary build, the media and tools folders can be placed into bin next to executable and packed up together (i.e. the sample app will search for both media/ and ../media/).

Building Vulkan

Due to interaction with various included libraries, Vulkan support is not enabled by default and needs a couple of additional tweaks on the user side; please find the recommended steps below:

  • Install Vulkan SDK (we tested with 1.3.246.1 but others will work)
  • Set DONUT_WITH_VULKAN and NVRHI_WITH_VULKAN CMake variables to ON
  • Disable STREAMLINE_INTEGRATION (set CMake variable to OFF)
  • Clear CMake cache (if applicable) to make sure the correct dxc.exe path (from Vulkan SDK) is set for SPIRV compilation

User Interface

Once the application is running, most of the SDK features can be accessed via the UI window on the left hand side and drop-down controls in the top-center.

UI

Camera can be moved using W/S/A/D keys and rotated by dragging with the left mouse cursor.

Command Line

  • --scene loads a specific .scene.json file; example: --scene programmer-art.scene.json
  • --width and --height to set the window size; example: --width 3840 --height 2160
  • --fullscreen to start in full screen mode; example: --width 3840 --height 2160 --fullscreen
  • --adapter to run on a specific GPU in multi GPU environments using a substring match; example: --adapter A3000 will select an adapter with the full name NVIDIA RTX A3000 Laptop GPU
  • --debug to enable the graphics API debug layer or runtime, and the NVRHI validation layer.

Developer Documentation

We are working on more detailed SDK developer documentation - watch this space!

Contact

RTX Path Tracing is under active development. Please report any issues directly through GitHub issue tracker, and for any information, suggestions or general requests please feel free to contact us at [email protected]!

Thanks

Many thanks to the developers of the following open-source libraries or projects that make this project possible:

Citation

If you use RTX Path Tracing in a research project leading to a publication, please cite the project. The BibTex entry is

@online{RTXPT,
   title   = {{{NVIDIA}}\textregistered{} {RTX Path Tracing}},
   author  = {{NVIDIA}},
   year    = 2023,
   url     = {https://github.com/NVIDIAGameWorks/RTX-Path-Tracing},
   urldate = {2024-01-26},
}

License

See LICENSE.txt

This project includes NVAPI software. All uses of NVAPI software are governed by the license terms specified here: https://github.com/NVIDIA/nvapi/blob/main/License.txt.