DCCXXV.DEV

Marco Antonio Pérez Neira

Español es

Ray Tracing in One Weekend, in Odin

I’d been wanting to learn Odin for a while. Reading the documentation and doing simple exercises felt a bit boring and unnecessary, especially for a programming language that follows a paradigm that I’m already familiar with. Instead of doing that I searched for anything cool to build that needs the speed that a non garbage collected language has and ended up with Ray Tracing in One Weekend. It’s a short CC0 licensed book that teaches how to build a simple brute-force path tracer. I followed the concepts shown in the book and when I didn’t understand how to do something with the Odin syntax I just looked at the documentation, this made learning it quite fast while also being quite fun.

I’d recommend this to any programmer. Don’t let the “ray tracing” name put you off, the only math you need is high school level, and the book explains every formula it uses quite well. And honestly, I believe that if you write it in a language other than C++ it will be even better, otherwise you may fall into the trap of just copy and pasting the blocks of code to end a chapter faster and not actually understanding or learning anything.

Result

rtiow-final.png
The final scene: a big matte sphere and a metal sphere surrounded by hundreds of small random spheres The final scene from the book.

As previously mentioned the book is free online. My code is on GitHub.

Stats