Skip to content

feat(milky-way): draw the far galaxy as six baked pictures with a crossfade to its slabs - #1591

Merged
apresmoi merged 2 commits into
mainfrom
feat/milky-way-far-planes
Oct 23, 2026
Merged

apresmoi merged 2 commits into
mainfrom
feat/milky-way-far-planes

Conversation

@apresmoi

@apresmoi apresmoi commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Change

From afar the Milky Way drew its whole 13/13/7 slab bank, up to 33 full-screen layers, even when it was a small disc on the Local Group page. Now, below a projected diameter of 270 CSS px, six baked picture layers draw it; above 300 px the slabs return unchanged.

  • Top: a normal and a bright picture fixed in the galaxy frame, mixed by the fitted gain table, so the face-on brightness matches the slabs at every tilt.
  • Side: one vertical plane turning about the galaxy's axis. It crossfades the nearest two of 16 baked azimuth views, 22.5° apart. Two fixed side pictures crossed as an X; one turning plane does not.
  • Exchange: a 250 ms crossfade. The slabs sit under the pictures and only the pictures' opacity moves. The outgoing presentation leaves the document when the fade ends, after any coast. The pictures take over only once decoded (or after 3 s).
  • Coasting: only transforms and opacity change. The side plane keeps its two drawn views and clamps their mix, tracking which boundary the camera crossed.
  • Drawing: each side layer shows one atlas view as the background of a box one view wide. A 16-view image slid inside a clipping box was rastered whole at about 8× and flickered on every drag in Chromium.
  • Shared projection: the volume camera transform, axis weights, merged-copy opacity and side-plane rotation move unchanged from the renderer to @cssearth/engine, so the bake fits the pictures with the runtime's own code without depending on the renderer. A rebake reproduces every picture byte for byte.
  • Close up: the slab runtime is unchanged. Its roots mount directly into the host as on main, and stay off the document until selected.

The bake is the opt-in --far-planes step; the default replay and all 33 slab PNGs are unchanged. See the Milky Way README.

Prepared assets

  • Baked the object (slice-galaxy.mts … --reuse=… --far-planes).
  • Published the bytes (node packages/bake/cli/publish-runtime-assets.mts --object=milky-way-volume); check-assets-published finds all 62 keys live.
  • Committed the refreshed inventory.json, and no baked files.

The new files are b30-far-planes/side.png (501,543 bytes), side-high.png (627,691), z.png (252,412) and z-high.png (251,729), plus the refreshed volume.json.

Evidence and limits

Light: compositing the mounted pictures matches the decoded slab bank within the 5% total-light limit at all 65 test views (azimuth 0°–90° every 7.5°, five elevations), worst 0.313%. Three low-elevation checks at 45° are worst 0.701%. Per-pixel error reaches 10.4% (27.8% at low elevation); no per-pixel limit is asserted. In the browser, the galaxy's light across a vertical orbit matched the slabs within about 1%.

Phone (Galaxy S23, Chrome, dev server): a hand-driven zoom and drag through the exchange and back was traced with the jankmonster categories. It had no tile-memory shortfall and no frame with missing content (3,325 frames). Its longest frame was 272 ms, when the slabs joined. A session without the crossfade had one of 136 ms.

Guarantees with tests that fail when removed:

  • a single turning side plane;
  • the side view drawn as one box;
  • no view change during a coast;
  • continuous mix across a boundary, including skipped frames and half turns;
  • slabs off the document until selected;
  • hysteresis;
  • the decode gate and its timeout;
  • republish on readiness;
  • the crossfade, with the outgoing presentation waiting out a coast.

Clean: pnpm typecheck, eslint on the touched packages, check-no-hashes, check-prepared-delivery, check-no-variables, check-color-spelling, and the renderer, objects and bake tests for these files.

Known: after a coast across more than one 22.5° side view, the next pair of views appears when the camera stops.

@apresmoi
apresmoi merged commit c494a06 into main Oct 23, 2026
25 checks passed
@apresmoi
apresmoi deleted the feat/milky-way-far-planes branch October 23, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant