Ray Tracing in One Weekend in Crystal (Lang)

This is my first crystal program; implementing the simple raytracer from this excellent book:

https://raytracing.github.io/books/RayTracingInOneWeekend.html

(version 3.2.3)

render

Git Branches

Building & Running

$ cd rtiow
$ shards build --release
$ ./bin/inOneWeekend --help

Tasks

Notes

I found Crystal surprisingly easy to work with. I have no point of reference for performance (I should download the C++ baseline for comparison), but it seems pretty zippy. The compiler errors are very helpful and clear.

Update: performance is amazing, particularly for how high-level the code writing can be

Mac tip:

$ crystal run --release src/main.cr -- -w 75 -h 75 -s 10 > out.ppm \
  && qlmanage -p out.ppm >/dev/null 2>&1

Performance

All times are for rendering the cover graphic:

Results

One more data point: as above but with 500 samples-per-pixel took 34m47s