Sep 11, 2026 AI copy

Fathom, run simulations on web or desktop

The stack I keep rebuilding

Fathom is a framework for an application stack I keep re-creating: a GPU simulation with a panel of controls beside it.

I prefer to do this stuff in Rust, with Vulkan or wgpu, so I can push my simulations to peak performance. Every time I've started in a more accessible stack, like Python or the web, I've been disappointed: I end up rebuilding it anyway to get the performance or scale I want.

But there's always a tension, because the second I want to share my work with someone, I wish I'd built it on the web.

The gravity sketch in the browser: a sun with thousands of bodies streaming around it, and a panel of sliders down the right
Fig. 1 — The gravity example running in a browser tab. 8,192 bodies pulling on every other body, exactly, at 60 fps. The panel is egui, not HTML.

One crate, two targets

Fathom solves this. With WebAssembly and wgpu, the same crate builds for desktop and for the web. Desktop in my experience is drastically faster, so I can develop at high particle counts and fast frame rates, and still put up a demo anyone can open.

Try the gravity sketch → (needs WebGPU: Chrome or Edge, or Safari 26.)

A ring and a line drawn over the simulation, showing where a new body will start and the velocity it will have
Fig. 2 — Right-drag to aim a body. The ring is the size it'll be drawn at; the line is its velocity.
A heavy body just after launch, its trail curving in towards the sun
Fig. 3 — Throw something heavy at the sun and watch the swarm decide where it belongs now.

It uses egui, which is my favourite GUI platform for graphics applications. The one downside is that the web build doesn't get to use any of the easy-to-make web GUI elements: the whole interface is drawn into a canvas. But that's a small tradeoff for how much convenience you get in return.

Writing an app

Writing an app is one Rust crate implementing one trait: setup, update, draw, and whichever input callbacks you care about. Declare your parameters once and the panel builds itself:

fathom_core::params! {
    G      => ParamDef::float("g", "Gravity", 1.0, 0.0, 4.0).group("Physics"),
    TRAILS => ParamDef::toggle("trails", "Trails", true).group("Render"),
}

Try it out: clone the repo, point your favourite agent at it, and say "build me a boids simulation in fathom" or something.

All writing