Building ONTRACK series · part 2 of 2
How the particle runner was made
The runner on the ONTRACK home page is about 60,000 dots laid on a body mesh, and both the body and the stride were captured from a few seconds of race footage. Here's how it was built, with a prompt for making your own.
29 November 2026 · 11 min read
The runner on the ONTRACK home page is made of about 60,000 dots. There's no 3D character model behind it and nobody animated it. The body shape and the movement both come from about eight seconds of side-on video of an elite distance runner in a race, and a shader places every dot. A few people have asked how it works, so this is the write-up. At the bottom there's a prompt you can give to Claude if you want to build one yourself.
This is what you'd be making:
I built it with Claude Code over three days at the end of November. Claude wrote the code, shader included. The direction was mine: take the motion from real footage and stop inventing it, fit a whole body and not only the joints, dress him in race kit, make the stream behave like air resistance, give phones a video. The rest of my time went on judging it by eye, and then working out with Claude how to measure whatever looked off before anything got changed. The post goes through those decisions roughly in order, and each stage has a live version you can turn round and slow down.
The first version looked like a robot
The first runner was a jointed figure with rounded limbs, and its joint angles came from a formula. It moved, but it looked robotic. Claude read up on elite running gait and rebuilt the angles from published numbers, which was better and still obviously not a person.
I decided to stop inventing the motion and copy it from a real runner. MediaPipe's pose model finds 33 body landmarks in each video frame. A script takes the shoulder, elbow, hip, knee and ankle positions, measures the joint angles, and splits the clip into strides. It lines the strides up on two clear moments (the highest knee lift and the furthest the leg gets behind the body), keeps the strides that were filmed closest to side-on, and takes the median. Another step finds touchdown, which it defines as the leg being within 5 cm of its full reach, and calls that the start of the stride.
That looked a lot better straight away. Here are both: the same figure with the same limb lengths, and only the joint angles differ. The textbook one has all the right ingredients and still moves like a diagram.
Drag to turn
Only measurements are kept from the footage. The clip isn't on the site, and neither is anything that says who the runner is.
Joints weren't enough
Good angles on a jointed figure are still a jointed figure. What you notice in a real runner is the shoulders rotating against the hips, the trunk twisting, and the calf changing shape as the foot comes through. I wanted the whole body.
Meta's SAM 3D Body fits a full human body mesh to a single image. Claude ran it on every frame of the clip on my laptop. It needed a small patch to run on an Apple GPU, and after that it took about 0.6 seconds a frame on an M3 Max. We picked it partly for the licence, which allows commercial use. SMPL, the body model most research code uses, needs a paid licence for that.
One stride that loops
The page doesn't need eight seconds of mesh. It needs one stride that loops without a visible join. A bake script sorts every frame by where it falls in the stride, averages them into 32 frames, and smooths each vertex over the loop so the end meets the start. It pins the standing foot to the ground, cuts the mesh down to 3,440 vertices and stores the positions as 16-bit integers. The file the browser downloads is about 700 KB.
This is that file, next to the jointed figure it replaced. Turn them both round. The jointed figure only really works from the side, because angles measured in a side-on picture are all it has. The mesh has shoulders that turn against the hips.
Drag to turn
The fitted body also came out a bit stocky for a distance runner, so the bake pulls the limbs and trunk in towards the bone. The calves keep 78% of their thickness, and the joints keep their size.
Two problems came out of the bake. The first was that the runner didn't look elite, and the best I could say was that the legs weren't turning over fast enough. Claude's first idea was that the smoothing had removed the fast detail in the leg motion. It measured that, and it hadn't. The stride was playing back 15% too slowly. It's a small number and it changes him from a racer to someone on a steady run:
Drag to turn
The second was a shimmy in the body and a jitter in the left arm. This time it was the detail. The bake smooths each vertex's path over the stride by keeping its first six harmonics, and for most of the body harmonics 4 to 6 were noise from the mesh fit. The legs do move fast enough to need them. The trunk, head and arms don't, so those now keep only the first three. I reported jitter more than once in different words, and it was this every time.
Dots on a body
When the page loads, each particle is given a random point on one triangle of the mesh, and it keeps that point. The 32 frames go to the GPU as a texture with one column per vertex and one row per frame. The vertex shader looks up the three corners of its triangle in the two nearest frames, blends them, and puts the dot there. The CPU does no work per particle, which is the same trick as the five million GPS points page.
Here's the mesh, then dots on it, then the dots coloured by the kit rules described below. This viewer uses about a third of the dots and has none of the cloth, lighting or wind, so it's the bare version.
Drag to turn
The dots are drawn with additive blending, so where they overlap they get brighter. That's most of the look, and it has one awkward consequence, which is that you can't draw anything dark. Light only adds up. The black O on the vest needed its own pass with normal blending. The far arm also showed straight through the chest until we added a pass that writes the body's surface to the depth buffer first.
The kit is a set of rules on the body in its rest pose: between this height and that height is shorts, above that is vest, and so on. Each particle gets a cloth type, a distance to stand off the skin and a value for how loose it is, and the shader adds some lag and a flutter at the hems.
The stream of particles coming off the runner took a few goes. Letting random particles leave made it look like the body was leaking. What worked was treating it as air resistance. Particles leave from the downwind side, more of them leave where a limb is moving fast through the air, and each one gets a small tug before it goes. Moving the cursor through it stirs it, the same way as the smoke on the GPS page.
The head
People who saw the first version said the head looked like Voldemort, which was fair. It was bald, the particles carry no lighting, and the captured face is nearly flat. Drawing features on made it worse. Dark eye sockets looked like a skull, and a nose ridge with a brow line looked like a visor. What's there now is a short crop of hair, one soft light on a rounded head, and a smaller nose.
Phones
A phone can draw the runner live, but not smoothly, and nobody is going to stir particles with a finger on a home page. So below 768 pixels wide the page plays a recording instead. It's six strides, 3.84 seconds, recorded from the page itself in a capture mode where every repeating thing (the twinkle, the lane markings, the stream) fits the loop a whole number of times, so it repeats without a seam. It's about 9 MB. Compressing it harder smeared the dots.
Then I opened it on my own iPhone and got a still image. The phone was in Low Power Mode, and iOS won't autoplay video in that mode. The phone version now decodes the H.264 stream itself with WebCodecs and draws the frames to a canvas, and the video element is only the fallback.
The finish
The ending went through more versions than anything else. He broke the tape and crumbled into the track. He burst apart and re-formed as the logo. The wind carried him into the logo instead. Each of them felt like a gimmick by the next morning. In the current one, time slows to about a twelfth of normal speed as his chest reaches the tape, camera flashes go off around the stadium, the camera swings round him, and then he carries on running.
Make your own
If you want one, film a runner side-on with their whole body in the frame, at 50 or 60 frames a second if your phone will do it, and get their permission. Ten to twenty seconds with no cuts is plenty. Then give Claude Code something like the prompt below, with the parts in square brackets filled in.
It won't come out right the first time. Ours took dozens of rounds, and the list near the end of the prompt is the problems we hit, so yours should take fewer.
I want to build a particle runner for my website: a person running on the spot, drawn as tens of thousands of glowing dots. The body shape and the movement should both come from a real video clip, not from a hand-made 3D model or keyframes.
The clip is at [path]. It is [N] seconds long, side-on, whole body in frame, [fps] fps, and I have the right to use it because [I filmed it and the runner agreed]. My machine is [for example: a MacBook with an M-series chip, or a Linux box with an NVIDIA GPU]. The site uses [framework], and the runner goes [where on the site].
Work in stages. After each stage, show me something I can look at before you go on. I will judge it by eye and tell you what feels wrong. When I do, find a way to measure what I am describing before you change anything.
1. Pose. Run MediaPipe Pose Landmarker (the heavy model) over the clip. Render the skeleton over the footage so I can check the tracking.
2. Stride. From the landmarks, measure the joint angles and split the clip into strides. Keep the strides filmed closest to side-on and take the median. Set phase 0 at touchdown. Tell me the cadence you measured.
3. Body mesh. Fit a full body mesh to each frame with Meta's SAM 3D Body (github.com/facebookresearch/sam-3d-body). The checkpoint is gated on Hugging Face, so tell me when I need to request access. Use the person boxes from stage 1 so you need no separate detector. Check the licence of every model against my use, and tell me before you use one that needs a paid licence for commercial work.
4. Bake. Turn the per-frame meshes into one looping stride. Bin the frames by stride phase, average them, and smooth each vertex over the loop so the end meets the start. Keep the standing foot planted on the ground. Play it at the cadence from stage 2. Reduce it to about 3,500 vertices and 32 frames, store positions as int16, and write one binary file under 1 MB. Store each vertex's rest-pose position too.
5. Render. In three.js, sample about 60,000 points on the mesh surface: a triangle and barycentric weights for each, fixed at load. Upload the frames as a float texture and pose every particle in the vertex shader from a clock uniform, blending between the two nearest frames. No per-particle work on the CPU. Use additive blending, with a depth pre-pass so the far limbs do not show through the body.
6. Look. Clothing as rules on the rest pose (which particles are vest, shorts and shoes), with cloth lag and hem flutter. A stream of particles that the air strips off the downwind side of the body, more where a limb moves fast.
These went wrong for the people who wrote this prompt, so check for them:
- The motion looks slow or heavy. Compare the playback cadence with the measured cadence first.
- The trunk, head or arms shimmy or jitter. This is usually fitting noise in the high harmonics of the stride. Measure the harmonics for each body part, and keep the higher ones only for the legs.
- The feet slide. The ground must move at the speed the planted foot implies.
- The body leans sideways in every frame. A side-on clip cannot see sideways tilt, so do not trust it. Make the stride left-right symmetric, or choose a camera angle that hides the lean.
- The face looks like a skull. At this grain size, drawn features read badly. Soft light on a rounded head works better.
- Anything dark, such as a logo or hair, vanishes. Additive blending cannot draw dark, so dark parts need their own pass with normal blending.
- Phones struggle. Measure the frame rate on a real phone. If it is low, record a seamless loop from the page and play that on small screens. Test it with Low Power Mode on, because iOS blocks video autoplay in that mode.
Do not ship or show the source clip. Keep only measurements from it.
Building ONTRACK series
Part 2 of 2
- 01Why ONTRACK is moving to Rust, Swift and Kotlin
- 02How the particle runner was madeyou’re here