Skip to content

Source code for the paper "ReSTIR Subsurface Scattering for Real-Time Path Tracing" (HPG 2024)

License

Notifications You must be signed in to change notification settings

MircoWerner/ReSTIR-SSS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReSTIR Subsurface Scattering for Real-Time Path Tracing (ReSTIR SSS)

Introduction

This repository contains the source code for the HPG 2024 paper:

ReSTIR Subsurface Scattering for Real-Time Path Tracing
Mirco Werner, Vincent Schüßler, and Carsten Dachsbacher

Abstract Subsurface scattering is an important visual cue and in real-time rendering it is often approximated using screen-space algorithms. Path tracing with the diffusion approximation can easily overcome the limitations of these algorithms, but increases image noise. We improve its efficiency by applying reservoir-based spatio-temporal importance resampling (ReSTIR) to subsurface light transport paths. For this, we adopt BSSRDF importance sampling for generating candidates. Further, spatiotemporal reuse requires shifting paths between domains. We observe that different image regions benefit most from either reconnecting through the translucent object (reconnection shift), or one vertex later (delayed reconnection shift). We first introduce a local subsurface scattering specific criterion for a hybrid shift that deterministically selects one of the two shifts for a path. Due to the locality, it cannot always choose the most efficient shift, e.g. near shadow boundaries. Therefore, we additionally propose a novel sequential shift to combine multiple shift mappings: We execute subsequent resampling passes, each one using a different shift, which does not require to deterministically choose a shift for a path. Instead, resampling can pick the most successful shift implicitly. Our method achieves real-time performance and significantly reduces noise and denoising artifacts in regions with visible subsurface scattering compared to standard path tracing with equal render time.

Structure of the Repository

ReSTIRSSS/resources/shaders/main/ contains the GLSL shaders for ReSTIR SSS.

Our sequential shift strategy uses probabilistic inversion to draw new random numbers before applying random replay when shifting a path with delayed reconnection (see paper Sec. 4.3 for details). We also demonstrate the possibility to use probabilistic inversion in ReSTIR in general to use both path and primary sample space shifts for a certain sample by implementing it in a surface reflection case with a path of length 3 (see supplemental document Sec. 3 for details). This demonstration can be enabled in restirsss_defines using the RESTIRSSS_PROBINVERSETEST_L3PATH macro. Also see probinversetest.

Requirements

Other dependencies are included as submodules in VkRaven/lib/.

Running the Code

Tested on Linux with GCC 14.1.1 and NVIDIA RTX 3070 GPU.

Windows is not officially supported, however, we get it to run using MinGW and disabling OptiX support in the CMake configuration.

Clone and Build

git clone --recursive [email protected]:MircoWerner/ReSTIR-SSS.git
cd ReSTIR-SSS/ReSTIRSSS
mkdir build
cd build
cmake ..
make

Download Assets

See ReSTIR SSS Assets repository for more details.

cd ReSTIR-SSS/ReSTIRSSS/resources
git clone [email protected]:MircoWerner/ReSTIR-SSS-Assets.git assets
cd assets/asiandragon
tar -xf dragon.tar.xz # unpack large file

Run

cd ReSTIR-SSS/ReSTIRSSS/build
./restirsss ajax
  • The provided scenes can be found in ReSTIRSSS/resources/scenes/: ajax, ajaxmanylights, asiandragon, lteorb, flattest.
  • Use --preset ... to select the initial rendering mode. This can also be changed during runtime in the UI.
  • Use --evaluate ... to start the automatic evaluation to generate renderings (to measure errors) or timings as shown in the paper. The video option generates the frames for our short video.
Usage: restirsss [--help] [--version] [--preset VAR] [--evaluate VAR] scene

Positional arguments:
  scene          name of the scene (in resources/scenes/<name>.xml) [required]

Optional arguments:
  -h, --help     shows help message and exits 
  -v, --version  prints version information and exits 
  --preset       pathtracing, hybrid, sequential [default: "hybrid"]
  --evaluate     renderings, timing, video 

Controls

  • WASD to move the camera
  • Space or E to move the camera up
  • Shift or Q to move the camera down
  • Hold Ctrl to move faster
  • Hold Right Mouse Button to look around
  • Esc to close the application

Acknowledgements

We would like to thank the creators and authors of the used assets and libraries:

About

Source code for the paper "ReSTIR Subsurface Scattering for Real-Time Path Tracing" (HPG 2024)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published