This document explains the render pass of the path tracer. Basically, the structure inspired by the NVIDIA Falcor's PathTracerNRD.
The overall structure looks like the below.
Radiance is decomposed into several components and each component is denoised respectively.
Each component will be explained in the following section.
A path whose first reflection is diffuse reflection belongs to here. (BSDF example : diffuse, roughplastic)
A path whose first reflection is specular reflection belongs to here. (BSDF example : roughplastic, roughconductor)
A path whose first reflection is delta-reflection belongs to here. (BSDF example : plastic, conductor, dielectric)
A path whose first reflection is delta-transmission and experiences delta-transmission only (total internal reflection is an exception) belongs to here. (BSDF example : dielectric)
A path whose first reflection is delta-transmission and experiences both delta-reflection and delta-transmission belongs to here. (BSDF example : dielectric)
The overall RELAX implementation refers from the original code. My RELAX implementation composes of three components.
- Temporal accumulation
- Disocclusion fix
- A-Trous wavelet filtering
At temporal accumulation step, we check consistency from motion vector and accumulate value if it is determined to be consistent. At disocclusion fix step, we fix just disoccluded (history length is smaller than 4) pixels. At A-Trous wavelet filtering step, we apply spatial filtering to produce more stable image.
The motion vector is used for fetching corresponding previous pixel. It could be easily calculated as below.
// Reprojection
float4 projCoord = mul(float4(position, 1.0f), g_frameData.previousProjView);
projCoord /= projCoord.w;
float2 prevPixel = float2(projCoord.x, -projCoord.y);
prevPixel = (prevPixel + 1) * 0.5;
The motion vector used for delta-reflection / transmission is different.
In the case of delta-reflecion, motion vector can be calculated analytically.
In the case of delta-reflecion, motion vector cannot be calculated analytically. We thus exploit the heuristics like below.