ray tracing in a weekend
I have been distracted with a few things, mostly playing around with WebGL. I was pulled down the ShaderToy rabbit hole and have been playing around with all kinds of ideas. Most notably, I implemented the Ray Tracing in One Weekend project in a fragment shader, which you will see below. I learned quite a bit about WebGL, passing data to shaders, and pseudo-random number generation in shaders. The below example uses a fixed canvas size of 256x256, stretched with CSS. There are 73 balls placed randomly in the scene each time that the shader is compiled, which happens every page load. All of the objects are written as constant structs into the shader, and the main loop is unrolled. The compiled shader is logged to the console. Each ray is allowed to bounce 50 times. Also, this appears to be a path tracer (to my understanding), since we are taking random rays when we bounce, instead of the exact reflection. I implemented some basic WebGL abstractions and the progressive rendering using some of the logic in evanw's webgl-path-tracing.
I also found sschoenholz's WebGL-Raytracer which does some cool texture packing to pass the scene information to the shader.
All-in-all, I learned quite a bit about WebGL, raytracing, and path tracing which makes me interested in doing more. I am not interested in trying to add anymore complex features to my existing python implementation of the Ray Tracer Challenge, so I think it is time for a rewrite in a lower-level language.