Wednesday, June 5, 2019

GPU path tracer, pt 2: spectral path tracing

I was quite unhappy with the performance of my previous GPU path tracer, so I started a new path tracer, this time forked off the work I did for my master's thesis research. Due to better architecture, newer hardware and an updated version of Optix Prime, I managed to improve the performance by almost tenfold over my previous work, at least in more complex scenes. A streamlined architecture where everything runs from a single kernel reduces the memory bandwidth use significantly, as I no longer need to load path data multiple times for a single path extension call. This means I can render images such as this one in less than an hour:
A scene with complex refractions and caustics, requiring 16 indirect bounces. 21 thousand samples per pixel are rendered in roughly 40 minutes, resulting in an almost noiseless image.

With the significant increase in performance, I wanted to try something I've always thought would be really cool, but never really ended up doing due to the images requiring massive amounts of samples to look good. Spectral path tracing means that paths carry 'photons' of a single wavelength, rather than some abstract distribution represented by an RGB color triplet. This allows effects such as diffraction at material interfaces, which results in the prism effect familiar from many high school physics classes:

Replicating this with a forward path tracer turned out to be quite difficult though. Finding a path that actually carries light through a prism turned out to be really unlikely for a collimated beam of light, so I had to resort to a slightly blurred version like this:
A conical light beam seen through a refractive prism. This took almost 1 million samples per pixel and 8 hours to render, and is still visibly noisy.

 Clearly forward path tracing is not the way to go for rendering coherent beams of light. Therefore I modified the path tracer to also support light tracing. While my implementation is not totally unbiased, it seems to only be off by some missing constant factor, thus letting me render nice pictures. A few good ones are shown below:
A collimated light source interacting with  two prisms.

A complex scene displaying caustics from multiple collimated light sources.

No comments:

Post a Comment