This is a Gleam rewrite of the raytracer described in the Ray Tracing in One Weekend book. It covers the first 10 chapters, up to metal materials.
I made this to demonstrate my work on extending the Gleam Compiler, providing a new backend to compile Gleam to WebAssembly (GitHub repository). Both versions are compiled from the same Gleam source. Depending on the target, JavaScript or WebAssembly implementations are used for some operations (f64 square root, absolute value, negation).
As of mid-2025, this does not work in Safari because they don't support all WebAssembly features used here.
It should work with a recent version of Firefox or Chrome.