HOW IT WORKSWHY THESE SCENES ARE NOT THREE.JS
Every place on this site is one HTML file. No engine, no models, no textures, no sound files. The browser is handed a description of the world written as maths and draws it itself, sixty times a second if it can.
THE NUMBERS
| Scene | Raw | Gzipped | fps, medium, M1 Max |
|---|---|---|---|
| Lisbon Docks | 32.7 KB | 11.8 KB | 26 to 28 |
| Estoril Golf | 31.2 KB | 11.7 KB | 18 to 21 |
| Casino Estoril | 34.1 KB | 12.5 KB | 21 to 24 |
| Abyss Walrus | 29.6 KB | 11.2 KB | 14 |
| three.js library alone, v0.170 | 692 KB | 171 KB |
One scene is roughly the size of a single phone photo thumbnail. The four together are a fifth of the three.js library before it has drawn anything.
WHAT IS DIFFERENT
- No geometry. Three.js draws triangles, so every ship, pine, lamp and person is a mesh someone modelled, exported, loaded and shipped. Here nothing is a mesh. The world is a function: give it any point in space and it answers how far away the nearest surface is. For each pixel the GPU walks a ray through that function until it lands on something. The liner, the colonnade, the palms and the terrain are formulas, not files.
- Zero assets. Cobbles, wood grain, clouds, water, stars and dew are noise functions. The harbour horn, the gulls, the dawn chorus and the casino band are built live from oscillators and filtered noise. There is nothing to download, host, license or lose.
- Detail at any distance. A mesh has a fixed polygon budget. A formula is exact however close you stand. Walk up to the quay stones and they still hold. The 274 people in the visa line are drawn by one small formula on flat cards, so they cost the same as four.
- Edits are numbers. Making the casino two storeys taller, moving the sun, lengthening the pool or adding a third fountain is one value in the file. No re export, no asset pipeline.
- Nothing to depend on. Three.js is a library with versions, deprecations and breaking changes. These files use only what the browser ships natively: WebGPU and its shader language, WGSL. Open the file in ten years and it should still run.
- No garbage. After startup the frame loop allocates nothing. One 96 byte block of camera data goes to the GPU per frame and three draw passes run. No scene graph, no per object matrices, no JavaScript objects churning.
HOW A FRAME IS DRAWN
Pass one, the world. A single triangle covers the screen. For every pixel a ray is marched through the distance function, between 64 and 140 steps depending on quality. Where it lands, the surface is shaded by the scene's lights, the sky, fog and, on water or wet stone, a second shorter march for the reflection. The depth of that hit is written out so later passes can sit behind or in front of it.
Pass two, the life. People, gulls, swallows, drizzle, smoke, mist, fountain spray, moths and lamp halos are instanced flat cards. No vertex buffers at all: each card's corners and position are computed in the vertex shader from its instance number and the clock. Silhouettes are cut out by formula in the fragment shader and depth tested against the world.
Pass three, the picture. The high dynamic range result is tone mapped with a film curve, vignetted and given a little grain, then presented.
WHAT THREE.JS IS BETTER AT
Loading real scanned or modelled assets, big teams, physics, text, UI, and raw speed on complex scenes. Rasterising triangles is cheaper per pixel than marching rays, which is why these run at twenty to thirty frames a second on a laptop instead of sixty. The trade is simple: three.js renders what you bring, this renders what you describe.
For a series bible that trade is the point. Each place is a few hundred lines of description you can walk through, and the whole world lives in a folder smaller than one photograph.