← The Firmamentlary.mcmenamin.netWIA
How the Firmament works
A story told by scrolling: an island comes up out of the dark, one cabin is raised, a fire is lit, a community grows around it, and the camera pulls back to show what it was the first piece of.
The Firmament is the hidden page of this site. On the landing page, the Pleiades sit just off Aldebaran's shoulder in the sky; that small cluster is the way in. What it opens is the island from WIA's front page, built from nothing in three dimensions while you scroll, and ending on the line the landing page opens with: empires take time.
The eight chapters
| Chapter | What happens |
|---|---|
| I. Nothing yet | Sky, the moon, the Milky Way. Nothing else. |
| II. The land | The island rises out of the dark, turning. Grass and firs come up on it. |
| III. The first roof | One figure walks in. A cabin is laid a course of logs at a time, then roofed. Its lamp goes on. |
| IV. The fire | A fire is lit outside the door. Others arrive and stand at it. |
| V. The water | Stones, a pond filling, reeds, a stream, and a waterfall over the island's edge. |
| VI. More roofs | Two more cabins go up and are lit. |
| VII. The community | A dock, a fenced garden, paths from every door to the fire, lanterns along them. |
| VIII. The empire | The camera pulls far back. Eight more islands light up, joined by lines of light into the constellation Taurus, with the home island where Aldebaran is. |
The people are figures in long coats seen against the light. They are not anyone in particular, and the page never counts them.
How it is made
- StoryScrolling moves one number from 0 to 7. Everything in the scene is a function of that number.
- SurfacesNothing is downloaded. Every texture is painted in the browser when the page opens.
- LightA shadow-casting moon, lamps brighter than white, then bloom, depth of field and grain.
Story. The page is eight tall sections over a fixed canvas. How far you have scrolled becomes a number, T, between 0 and 7. Every log, lamp, figure, plank and path is registered with the moment it starts and the moment it is finished, and each frame it is told how far along it is. That is why the story can be scrubbed: scroll back and the cabins come apart log by log, in order. The camera has one position per chapter and glides between the two nearest; narrow screens stand further back so the subject stays whole.
Surfaces. The scene is built with Three.js, and it loads no images or models. Bark, log ends, shingles, stonework, rock strata, turf, soil, planks, the worn paths, the lit window panes, the moon, and the normal map that makes the water ripple are each a small function that paints a canvas. The island's surface is a height field, and the same function that shapes it is used to stand every tree, figure and fence post on it. The grass is one small tuft drawn up to 26,000 times, with the wind applied on the graphics card. The water reflects the same sky you see, baked once into an environment map.
Light. The moon is a real directional light that casts shadows. Each cabin has a warm light outside its window, and the fire has one that flickers. Window panes, lanterns and flames are drawn brighter than white, so the bloom pass makes them glow without touching anything else. On strong machines a depth-of-field pass keeps the chapter's subject sharp and softens the rest, and a final pass adds grain, darker corners, and cooler shadows against the warm lamps.
Budget
| Level | Who gets it | What it includes |
|---|---|---|
| 3 | Desktops with 8 or more cores | Shadows, bloom, depth of field, grain, all the grass, up to 2x resolution. |
| 2 | Other desktops; phones with 6 or more cores | Shadows, bloom, half the grass, up to 1.5x resolution. |
| 1 | Other phones; data saver on | The scene alone, at 1x resolution. |
While it runs, the page counts slow frames. If more than half of the last eighty took longer than a thirtieth of a second, it gives one thing up: first depth of field and grain, then resolution, then bloom and shadows, thinning the grass as it goes. It never steps back up. The loop stops when the tab is hidden. Add ?fx=3 (or 2, or 1) to the address to hold a level by hand.
The script is about 580 kB, roughly 150 kB compressed, and is loaded only by this page.
Controls
| Do this | To |
|---|---|
| Scroll, or Space / ↓ | Move the story forward. Scroll up to undo it. |
| The dots on the right | Jump to a chapter. |
| Move the pointer | Shift the camera slightly. |
Each chapter has its own address, such as /firmament/#community.
When things are missing
With reduced motion switched on, the camera stops drifting and the scene follows the scrollbar exactly, with no easing. Without WebGL or without JavaScript, the canvas is removed and the eight chapters remain as a page to read.
Files
| File | What it holds |
|---|---|
firmament/main.js | The whole scene. Bundled with Three.js by scripts/build.mjs into dist/firmament/firmament.js. |
landing/firmament/index.html | The page and the chapter text. |
landing/firmament/firmament.css | The type over the scene, and the plain version of the page. |
landing/firmament/docs/index.html | This page. |
landing/index.html, landing/css/night.css | The hidden link (.sky-egg) on the landing page. |
To change the words, edit the sections in index.html. To change when something happens, find its act(start, end, ...) line in main.js and change the two numbers; chapter n is complete at T = n - 1. To move a camera, edit KEYS. Analytics records firmament_chapter the first time each chapter is reached, and a link_click named firmament when the hidden link is found.