Week 10: Denoising
- Karinne Lorig
- Jul 25, 2019
- 2 min read
In addition to some minor bug fixing, the subject of this week's work has been bringing a denoising algorithm into the Ray Tracer. The main stumbling point for integrating ray and path tracing into modern games is the amount of computational power it takes to actually simulate all the rays needed to render a good image. This is particularly expensive in the case of any ray tracer that uses more than one ray per pixel, which is necessary to get effects like soft shadows, anti-aliasing, or more than a couple bounces per ray. Denoising algorithms allow the program to limit the number of rays fired while still ending up with a satisfactory image by removing the pixelated, noisy quality that usually comes with not having enough rays.
At the moment, there's a lot of research going into different types of denoising algorithms, as it's become apparent that for the foreseeable future, real-time ray tracing requires some form of denoising to get high-quality results at a decent frame rate. The simplest type is temporal accumulation, in which the output of previous frames are used to inform the output of the current frame. This essentially allows the program to amortize the cost of all the rays it needs to output over multiple frames, rather than having to fire all of them at once. I chose to implement this type of denoising while slightly varying where in each pixel the ray was fired. This gave me anti-aliasing, which can be seen below.


That said though, temporal accumulation has some significant drawbacks. While it's simple enough to tell the program that if the camera moves in a given frame, the accumulation buffer is dirty and it should be immediately be overwritten with the output of the current frame, the same can't be said of objects or lights within the scene moving, which leaves after-images in the frame, like in this armchair's shadow:

This can be addressed by lowering the number of frames into the past the program holds on to, but that ultimately means you're working with the results of fewer rays, which decreases the quality of the results, or by finding other ways to raise the frame rate, which would cause the artifacts to disappear faster, minimizing their visual impact.
Outside of that, the week consisted primarily of fixing a few bugs from last week in how the program handled planes with only one face (namely, if the closest hit shader returned a face whose normal was facing away from the camera, it essentially shaded the face backwards) as well as how it checked for shadows with directional light. Both of those have been corrected, as can be seen in this image, compared with the same image last week.


Comentários