CUDA Pathtracer
Interactive CUDA pathtracer that implements a variety of rendering techniques.
Features
- Wavefront rendering, see Laine et al. 2013
- Multiple BVH types
- Standard binary SAH-based BVH
- SBVH (Spatial BVH), see Stich et al. 2009. This BVH is able to split across triangles.
- BVH4 (Quaternary BVH). The BVH4 is a four-way BVH that is constructed by iteratively collapsing the Nodes of a binary BVH. The collapsing procedure was implemented as described in Wald et al. 2008.
- BVH8 (Compressed Wide BVH), see Ylitie et al. 2017. Eight-way BVH that is constructed by collapsing a binary BVH. Each BVH Node is compressed so that it takes up only 80 bytes per node. The implementation incudes the Dynamic Fetch Heurisic as well as Triangle Postponing (see paper). The BVH8 outperforms all other BVH types.
- BVH Optimization. The SAH cost of binary BVH's can be optimized using a method by Bittner et al. 2012.
- All BVH types use Dynamic Ray Fetching to reduce divergence among threads, see Aila et al. 2009
- Two Level Acceleration Structures
- BVH's are split into two parts, at the world level (TLAS) and at the model level (BLAS). This allows dynamic scenes with moving Meshes as well as Mesh instancing where multiple meshes with different transforms share the same underlying triangle/BVH data.
- SVGF (Spatio-Temporal Variance Guided Filter), see Schied et al. Denoising filter that allows for noise-free images at interactive framerates. Also includes a TAA pass.
- Participating Media (homogeneous)
- Intuitive, artist friendly parameters: Instead of the usual σa and σs parameters the more intuitive
C
(multiscatter albedo) andmfp
(mean free path) parameters are provided. The σa and σs parameters are then solved for using Van de Hulst albedo inversion. (See Hitchhikers Guide to Multiple Scattering) - Multiple Importance Sampling* (MIS): Sample scattering distance for each wavelength using MIS (see Wrenninge et al.)
- Intuitive, artist friendly parameters: Instead of the usual σa and σs parameters the more intuitive
- Importance Sampling
- Next Event Estimation (NEE): Shadow rays are explicitly aimed at light sources to reduce variance.
- Multiple Importance Sampling (MIS): Explicit light sampling (NEE) is combined with standard BRDF sampling using MIS to get the best of both.
- Cosine weighted direction sampling for diffuse bounces.
- Microfacet sampling as described in Heitz 2018
- Mipmapping: Textures are sampled using mipmapping. Mipmap sampling is done using ray cones (see Möller et al. 2012, Möller et al. 2019). Primary rays perform anisotropic sampling, subsequent bounces use isotropic sampling.
- PMJ02 Sampling: The low discrepency sampler by Cristensen et al. 2019. Sequences are decorrelated using Cranley-Patterson rotations with blue noise.
- Hot Reloading: When F5 is pressed the CUDA module is recompiled from source to allow for interactive debugging and development.
- PBR Material types
- Diffuse (Lambertian)
- Plastic (Specular on top of diffuse)
- (Rough) Dielectric
- (Rough) Conductor
- Energy Preservation: Kulla-Conty approximation for multi-scattering is implemented for Dielectrics and Conductors such that they pass a furnace test.
- Mitsuba XML Scene support: A custom Mitsuba XML parser is included to load scene files. Custom loaders for OBJ and PLY files are available.
Screenshots
SVGF: Raw output of the pathtracer on the left and the filtered result on the right.
Kulla Conty Multiscatter for dielectrics comparison: at the top single scatter, at the bottom multiscatter approximation.
For more screenshots, see the Screenshots folder
Usage
Camera can be controlled with WASD for movement and the arrow keys for orientation. Shift and space do vertical movement.
Various configurable options are available as command line arguments. Use command line option --help
to see an up to date list.
Dependencies
All dependecies (headers, libs, and dlls) except CUDA 11.0 are included in the repository.
The project requires that the CUDA_PATH
system variable is set to the path where the CUDA SDK is installed.