MiniRT — WebAssembly Ray Tracer

A real-time ray tracer running entirely in the browser via WebAssembly. Originally built as a 42 school project, MiniRT has been compiled to WASM to bring GPU-accelerated ray tracing to the web without any plugins.

Features

  • Real-time Rendering — Interactive camera controls with smooth navigation
  • Multiple Scene Support — Pre-bundled scenes including Billiards, Snowman, Solar System, and more
  • Custom Scene Editor — Write and test your own .rt scene files directly in the browser
  • File Upload — Load external scene files with full validation
  • No Plugins — Pure WebAssembly, runs natively in any modern browser

Controls

InputAction
W A S DMove camera
MouseLook around
RStart high-quality render
ESCExit interactive mode

Try It Out

Launch the interactive demo: Open MiniRT


Technical Details

Architecture

The project consists of two main components:

  1. MiniRT Core — The original C ray tracer built with mlx_raylib (a minilibx/X11 compatible library)
  2. WebAssembly Build — Emscripten-compiled version running in the browser

Scene Format

MiniRT uses a simple text-based scene description format:

A <ratio> <R,G,B>              # Ambient light
C <x,y,z> <dx,dy,dz> <fov>     # Camera
L <x,y,z> <brightness> <R,G,B> # Point light

sp <x,y,z> <diameter> <R,G,B> # Sphere
pl <x,y,z> <nx,ny,nz> <R,G,B> # Plane
cy <x,y,z> <nx,ny,nz> <diameter> <height> <R,G,B> # Cylinder

Source Code