Implementing a denoiser
To make the output of our reflection pass usable for lighting computations, we need to pass it through a denoiser. We have implemented an algorithm called SVGF, which has been developed to reconstruct color data for path tracing.
SVGF consists of three main passes:
- First, we compute the integrated color and moments for luminance. This is the temporal step of the algorithm. We combine the data from the previous frame with the result of the current frame.
- Next, we compute an estimate for variance. This is done using the first and second moment values we computed in the first step.
- Finally, we perform five passes of a wavelet filter. This is the spatial step of the algorithm. At each iteration, we apply a 5x5 filter to reduce the remaining noise as much as possible.
Now that you have an idea of the main algorithm, we can proceed with the code details. We start by computing the moments for the current frame:
float u_1 = luminance( reflections_color...