A title for your blog

Ray Tracing in One Weekend

It’s been a weekend so what do you do? You implement a ray tracer of course.

Spheres

Ray Tracing in One Weekend

The article is really well done. It builds up from a red circle to the image above in easily digestible steps. I’m pretty sure there are a couple of bugs but the way the subject is presented makes it easy to reason your way past them. I highly recommend giving this a go.

It’s kind of crazy how this image came together. There’s a Sphere struct but no actual sphere “drawing” code. It’s entirely built from ray / sphere intersections.

The code in the article is written in C++. Early in my career I was a graphics programmer and we used C++. I never did any ray tracing though. C++ has changed a lot since those days so I considered using this as an opportunity to catch myself up with the changes.

Yeah, nah This is a Rust version The code mostly follows the authors code. I had to deviate in a few places to keep Rust’s compiler happy and changed a few things to make it more Rust like, eg. I used enums for the materials. I also used Rayon to get multithreading.

Threads!

Update 29 April 2025

Here’s an excellent ray tracing video I stumbled upon just after publishing this post. It goes through the same stuff as the article but with visuals that show how each enhancement changes the output. The code in the video is C# and HLSL (High Level Shader Language).

Coding Adventure: Ray Tracing

#rust