Feb. 18th, 2019
What Is This?
A ray tracer I made following along with the awesome book Ray Tracing in One Weekend.
You can use the sliders to control the size and super sampling amount. It's also setup to generate an animated camera if you increase the number of frames (however keep in mind that this will significantly increase the generation time!).
How Long Did It Take?
On and off for about 3 weeks - definitely not a single weekend :)
How Many Lines of Code?
What Did I Learn?
A TON! In addition to all that is included in the ray tracer itself (math, shading model, anti-aliasing, depth of field, etc.), I also used Web Workers for the first time in order to improve performance and split up the rendering into multiple threads.
I never implemented the glass material (refraction) because I didn't fully understand the math. I challenged myself to only implement things that I could explain to other people... I can't do that yet with the refraction math :)
I pre-generated a few examples to show how the quality changes (and generation time increases) depending on the "Samples Per Pixel" parameter.
512x256 Image @ 1 sample per pixel
Generation Time: 3 seconds
512x256 Image @ 10 samples per pixel
Generation Time: 10 seconds
512x256 Image @ 100 samples per pixel
Generation Time: 1 minute 30 seconds
512x256 Image @ 250 samples per pixel
Generation Time: 5 minutes
256x128 Animation @ 1 sample per pixel
Generation Time: 3 minutes 30 seconds
256x128 Animation @ 10 samples per pixel
Generation Time: 16 minutes
256x128 Animation @ 100 samples per pixel
Generation Time: 2 hours 12 minutes