Physically-based render engine based on Vulkan API and Nvidia RTX.
This is a sandbox for self-education. Two different rendering methods have been implemented:
- Path Tracing - simple backwards Monte Carlo path tracing
- Hybrid Rendering - classical rasterization with ray queries
Both of them use a physically-based lighting model and there is an ability to switch between them in runtime.
- Free camera control
- GLTF scene loading
- HDR environment maps
- Directional light detection
- Point lights visualization
- Runtime shaders reloading
Path tracing is based on the Vulkan ray tracing pipeline, which is provided by VK_KHR_ray_tracing_pipeline
extension.
Currently, path tracing doesn't have any runtime denosing, there is just a simple result accumulation when camera the doesn't move.
Hybrid rendering uses classical g-buffer approach. G-buffer consists of folowing set of textures:
R10G10B10A2unorm
- normalsR11G11B10sfloat
- emissionR8G8B8A8unorm
- albedo + occlusionR8G8unorm
- roughness + metallicD32sfloat
- reverse depth
World space positions are restored from the depth, which is reversed to keep a precision in whole range of values.
Scene lighting executes in compute shader and in general represents typical PBR. Lighting consists of direct light: lighting from directional and point light sources, and indirect light. For direct lighting there are simple hard shadows that are calculated using ray queries. Indirect lighting aka global illumination uses preconvolved IBL textures and set of captured light probes that form a light volume.
Light volume is generated according to the following steps:
- Detecting optimal positions for light probes depending on scene geometry
- Capturing a probe from each position into a cupemap using a path tracing method
- Converting probe cubemaps into an array of 3rd order spherical harmonics
- Generating a tetrahedral mesh from probes point cloud
During runtime, the irradiance of the specific point is calculated by detecting the tetrahedron, inside which this point is located, and interpolating this tetrahedron's 4 light probes using barycentric coordinates. Specular part of indirect lighting is obtained by renormalizing IBL specular value using the light volume's irraidance.
Light volume can be visualized.