A hobby real-time Direct3D 12 path tracer. Mainly developed for learning and experimenting with the latest research in real-time rendering.
To achieve real-time frame rates, this renderer utilizes recent developments such as hardware-accelerated ray tracing (DXR), advanced sampling (ReSTIR), denoising, and smart upscaling (AMD FSR2).
![Sponza](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/8.png?raw=true)
Subway Station based on the NYC R46 subway, rendered by ZetaRay. (Scene by Alex Murias.)
- ReSTIR DI for many-light sampling from emissive meshes and sky [4]. Sampling efficiency is increased by
- Power sampling using the alias method
- A world-space voxel grid with stochastic light reservoirs per voxel [5]
- Indirect lighting methods include:
- Ray differentials for texture MIP selection
- Physically-based BSDF with roughness, metallic mask, normal, and emissive maps
- Single scattering sky and atmosphere [2, 3]
- Render graph for automatic resource barrier placement and multi-threaded GPU command list recording and submission (more details below)
- AMD FSR2 upscaling
- Temporal anti-aliasing (TAA)
- Auto exposure using luminance histogram
- glTF scene loading with the metalness-roughness workflow. Following extensions are also supported:
- KHR_materials_emissive_strength
- KHR_materials_ior
- KHR_materials_transmission
Modern graphics APIs such as Vulkan and Direct3D 12 require resource barriers to be placed manually by the programmer. These barriers control synchronization, memory visibility, and additionally for textures, resource layout. As program complexity grows, manual placement can lead to issues such as:
- Becoming highly error-prone and limiting extensibility and prototyping.
- GPU command buffers can be recorded in multiple threads; correct usage and prevention of data-race issues may be hard to achieve.
Furthermore, using multiple command buffers requires a correct submission order—e.g., command list A writes to a resource that is read by command list B, so A has to be submitted before B.
A render graph can help with all of the above; by analyzing resource dependencies, a directed acyclic graph (DAG) is formed from which submission order is derived and barriers are automatically placed. A visualization is shown below.
- GPU with hardware-accelerated ray tracing support (NVIDIA RTX 2000 series or later, AMD RX 6000 series or later). Tested on RTX 3070 desktop and RTX 3060 laptop.
- Windows 10 1909 or later (required by Agility SDK).
- Visual Studio 2019 or later. Builds with both MSVC and ClangCL toolsets.
- CMake 3.21 or later.
Standard CMake build. Make a build directory somewhere you like, then call CMake from inside that directory and point it to (./CMakeLists
) in the top-level project directory (./build
is preferred as it's included in .gitignore
).
The main sample application (Samples/ZetaLab/
) works by loading a glTF scene and then proceeding to rendering that scene while exposing various settings through the UI window.
Note that glTF scenes need to be preprocessed first by generating mipmaps and converting textures to DDS format. A command-line utility app (Tools/BCnCompressglTF
) is provided for that purpose. It can be used as follows:
> cd bin
> .\BCnCompressglTF <path-to-gltf>
The outputs are:
- The converted glTF scene file in the same directory with a
_zeta
suffix (e.g.,myscene.gltf
->myscene_zeta.gltf
) - The compressed textures in the
<path-to-gltf-directory>/compressed
directory.
For convenience, a preprocessed Cornell Box scene is provided (Assets/CornellBox/cornell9.gltf
). After building the project, you can run it as follows:
> cd bin
> .\ZetaLab ..\Assets\CornellBox\cornell9.gltf
Currently, unicode paths are not supported. Support is planned for a future release.
![Subway Station](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/12.png?raw=true)
Subway Station. (Scene by Alex Murias.)
![Classroom](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/2.png?raw=true)
(Modified) Blender Classroom. (Original Scene by Christophe Seux.)
![Country Kitchen](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/3.png?raw=true)
Country Kitchen. (Scene by Jay-Artist.)
![Bistro](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/5.png?raw=true)
Amazon Lumberyard Bistro. (Scene from Open Research Content Archive (ORCA).)
![Dining Room](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/11.png?raw=true)
Dining Room. (Scene by MaTTeSr.)
![San Miguel](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/7.png?raw=true)
San Miguel 2.0. (Scene from Morgan McGuire's Computer Graphics Archive.)
![San Miguel](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/4.jpg?raw=true)
San Miguel 2.0. (Scene from Morgan McGuire's Computer Graphics Archive.)
![Junk Shop](https://github.com/alipbcs/ZetaRay/raw/master/Assets/Images/9.png?raw=true)
Modified Blender 2.81 Splash Screen. (Original scene by Alex Treviño, hair model by bbb59149.)
[1] Y. Ouyang, S. Liu, M. Kettunen, M. Pharr and J. Pantaleoni, "ReSTIR GI: Path Resampling for Real-Time Path Tracing," Computer Graphics Forum, 2021.
[2] S. Hillaire, "A Scalable and Production Ready Sky and Atmosphere Rendering Technique," Computer Graphics Forum, 2020.
[3] MinimalAtmosphere, https://github.com/Fewes/MinimalAtmosphere
[4] B. Bitterli, C. Wyman, M. Pharr, P. Shirley, A. Lefohn and W. Jarosz, "Spatiotemporal reservoir resampling for real-time ray tracing with dynamic direct lighting," ACM Transactions on Graphics, 2020.
[5] J. Boksansky, P. Jukarainen, and C. Wyman, "Rendering Many Lights With Grid-Based Reservoirs," in Ray Tracing Gems 2, 2021.
[6] D. Lin, M. Kettunen, B. Bitterli, J. Pantaleoni, C. Yuksel and C. Wyman, "Generalized Resampled Importance Sampling: Foundations of ReSTIR," ACM Transactions on Graphics, 2022.
- AMD FSR 2
- AMD FidelityFX Denoiser
- cgltf
- Dear ImGui
- doctest
- FastDelegate
- ImPlot
- imnodes
- json
- moodycamel::ConcurrentQueue
- stb
- xxHash
MIT license—see LICENSE
for more details.