Ray tracer — written in Mere

This image is rendered live in your browser by a ray tracer written in Mere, compiled to WebAssembly. Three spheres on a ground sphere, a directional light, Lambertian + specular shading, hard shadows, and one mirror bounce — the same program as examples/raytrace.mere, which produces a byte-identical image on the interpreter and the C backend.

rendering…

What this page exercises

  1. Pixels reach the canvas through two extern fns added for this page — dom_canvas_fill_style and dom_canvas_fill_rect (contrib/dom) — the first pixel output surface in the frontend FFI.
  2. Every float on the Wasm backend is boxed (an i32 pointer to a heap f64), so this 96×54 render allocates about 26 MB from the bump arena — roughly 5 KB per pixel. That measured tax, and the fixed 64 MB memory it runs inside, are written up honestly in the devlog; a bigger canvas is what the memory-growth work is waiting on.
  3. The status line shows an Adler-style checksum of the quantized pixels. It matches the native backends exactly — the same cross-backend-parity discipline as the test suite, visible on a page.