Source Code

You can get the code from here.


Any graphics programmer would, at some point, take a look at the fantastic Ray Tracing in One Weekend book and get motivated enough to roll out their own version. So…I did the same! However, mine took a little more than a “weekend” because I decided to implement it on GPU (DirectX 12, Vulkan) and also add features such as physically-based atmospheric scattering. Here are some figures:

Different Times of the Day

Infinite bounces cause infinite reflections!

Simulating the colors of the sky with atmospheric scattering

Conclusion

To wrap this up, let’s look at an issue I encountered while implementing the path tracer. Yeah, it was the good old NaN attacking the poor pixels.😔 You know, we never start with shiny pixels…Anyways, the culprit was normalizing some zero vectors. So, always be careful with that because division by zero is right around the corner!


Future Work

  • Filmic Tonemapping
  • BRDF Importance Sampling
  • Multiple Importance Sampling (MIS)
  • Using BVH as the acceleration structure
  • Supporting triangle intersection
  • Supporting different BxDF models
  • Using Blue Noise for jittering rays (stratified sampling)

References