Ray Tracing Demo

Your browser doesn't support canvas?

Use w a s d to pan the camera

Move your mouse on the camera to look around

Space to fly up, Shift to descend

How it works

Raytracing is done with WebAssembly in Rust. After creating a Vector in memory corresponding to the 32 bit rgba pixel values, the wasm code returns a pointer to JavaScript that gets read into an ImageData and drawn on a canvas for every frame.

The code is adapted for Rust + Webassembly from Ray Tracing in one Weekend.

Settings