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:



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
- The Forge
- Ray Tracing in One Weekend
- Coding Adventure: Ray Tracing
- Simulating the Colors of the Sky
- Casual Shadertoy Path Tracing 1: Basic Camera, Diffuse, Emissive
- A Framework for the Experimental Comparison of Solar and Skydive Illumination, Joseph T. Kider Jr et al., Cornell University 2014.