This repository contains the source for my experiments with a raymarching voxel renderer, global illumination, and Vulkan.
These screenshots show the types of images the renderer can currently produce under the best circumstances. I'm still in the process of implementing improved sampling and denoising algorithms, so it doesn't look great while moving around yet.
On a RTX 2070 Super, the raycasting shaders can cast ~200M Mrays/s, depending on geometry, which corresponds to around 20 fps when computing lighting for every pixel. I plan on making a optimization pass later to improve this. Some of the SVDAG papers I reference cited similar or better performance on GTX 680 GPUs, which means I still have a ways to go.
The main path-tracing pipeline is implemented as compute shaders (detailed below), while the UI is just rendered by a simple graphics pipeline.
- Primary Ray Intersection (
intersect.comp
) - Sample Reprojection (
reproject.comp
) - A-SVGF step 1: stratified sample replacement (TODO)
- Lighting
- Sample a bounce after the primary ray (
light_bounce.comp
) - Choose a random light source and generate rays from the first and second bounces (
light_bounce.comp
) - Check light occlusion for each of the light rays (
light_occlude.comp
) - Combine lighting information into a single image (
light_combine.comp
)
- Sample a bounce after the primary ray (
- A-SVGF step 2: generate alpha buffer (TODO)
- TAA: use reprojected information and alpha buffer to mix current frame and reprojected samples (partially implemented)
- Postprocessing: compute an autoexposure effect and map HDR light values to LDR.
- Render
As long as there is a Vulkan runtime on your system, all you should have to manually install is shaderc
, which is required for vulkano-shaders
to work.
After that, cargo build --release
should handle most of the work.
- Optimize raycasting and compute shaders
- Currently register file space seems to be an issue in some of the path tracing shaders.
- Improve cache efficiency (only so much one can do with trees/DAGs)
- Reproject second bounce lighting samples and other data for more light sample information.
- Fully Implement A-SVGF
- metropolis light transport for faster convergence
- maybe implement some form of (jank) DLSS
- Improve material capabilities
- BRDF sampling (replace diffuse-only materials)
- Transparent materials
- Modify raycasting termination conditions
- Integrate over
Here is list of papers and other resources I used while creating this system, sorted roughly by topic.
Voxels:
- Efficient Sparse Voxel Octrees
- High Resolution Sparse Voxel DAGs
- Interactively Modifying Compressed Sparse Voxel Representations
Lighting:
- Efficient BRDF Importance Sampling Using A Factored Representation
- A Data-Driven Reflectance Model
- Metropolis Light Transport
- A Practical Introduction to Metropolis LightTransport
Denoising: