Replace the SVG core and backdrop with one shader that traces each pixel through Schwarzschild spacetime. The shadow, the arch of the far side of the disk, the second image and the Einstein ring come from the physics rather than artwork. The disk is a thin disk seen from a low angle, about five times the shadow's radius, with Doppler beaming and a filtered, cloud-like texture. - Sky: a procedural galaxy baked once into a cubemap. Point sources are small, few and brightness-capped so they never rival the orbit markers, which now carry a dark backing disc and outline. - Quality: tiers from high to still, a startup calibration cached per canvas size, an fps cap, and an idle sleep. A locked realistic map draws nothing. - Integration: the canvas follows the galaxy frame through Big Screen, draws in Motion's post-render step, takes the disk clock and capture absorption from the galaxy loop, and falls back to the SVG core without WebGL2. - Radar view: a toolbar toggle switches to a radar look that spreads outward from the hole as a wave, with a sweep on its own clock. The choice is remembered per browser; reduced motion switches at once and holds the sweep. - Tests for the geodesics, quality governor, look spring and layout, plus a standalone preview page (web/blackhole-proto.html) for tuning the look. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
75 lines
11 KiB
Markdown
75 lines
11 KiB
Markdown
# Tessera orbital vault
|
|
|
|
The persistent viewport maps backup jobs and recovery points. The black hole represents the vault. Stars represent orbits, and moons represent the latest snapshots of the selected orbit.
|
|
|
|
## Viewport and consoles
|
|
|
|
- **Flowing** animates the projected orbits and the black hole's accretion disk. Pause or resume from the map toolbar. The map coasts to a visual stop, then reveals labels and moons in **Locked** mode, starting with the selected orbit. Resuming reverses that reveal. Selecting an orbit also locks the map. Reduced motion locks it immediately.
|
|
- Select a star or use the orbit register. The register prioritizes failed and active jobs and supports the up/down arrow keys. The inspector includes the capture action and full snapshot history.
|
|
- The first three recovery points of the selected orbit appear as moons when the map has room. Select a moon or history entry to review the snapshot and start a restore. Escape closes the console. Restore countdown and polling continue if the console closes.
|
|
- Hub connectivity is separate from backup health. Capture targets the named orbit. An incoming meteor represents a confirmed new snapshot. The source flares, the meteor spirals inward, and the core brightens and spins up before the new recovery point flashes. A failed capture pulses its source marker and shows text feedback. Rehearsals show text feedback.
|
|
- The map shows up to 55 overview orbits and reserves one slot for inspecting an orbit beyond that limit. The register provides access to every orbit. On narrow screens the map, register, and inspector stack vertically.
|
|
- **Big Screen** expands the map and keeps summary counts, motion controls, and a floating navigation dock. The map and dock spring into position within the current browser viewport. Use **Exit big screen** or Escape to return to the workspace.
|
|
- Drag the active navbar item sideways and release to open the destination. The regular navbar uses text and a sliding underline. The Big Screen dock uses labeled icons and a liquid highlight.
|
|
- The navbar stays available above the side panel so you can switch directly between consoles. In the regular workspace it becomes a floating text dock in the same top position. Big Screen keeps its icon dock at the bottom.
|
|
- Use **Search**, **⌘K**, or **Ctrl+K** from the vault, a console, or Big Screen. An empty field shows navigation shortcuts. Type to find destinations, orbits by name, ID, or provider, and snapshots by orbit name, ID, or displayed capture date. Search uses the summaries already loaded by the vault. Use the arrow keys and Enter, or select a result with a pointer. Escape closes search and returns focus to its button.
|
|
|
|
## Data and rendering
|
|
|
|
- The map preserves each orbit's assigned slot across polling updates. Layout and snapshot grouping live in `web/src/lib/galaxyLayout.ts`.
|
|
- Snapshot summaries carry `orbit_id`. When connected to an older hub, the UI groups by name only if the name is unique.
|
|
- Successful capture preserves HTTP 204 and supplies `X-Tessera-Snapshot-Id` when it retained a new snapshot. Automatic decay applies to that orbit's history.
|
|
- The orbits, markers, moons and selection are SVG on one animation clock. The black hole and the sky behind it are a single WebGL2 shader in `web/src/lib/blackhole/`. The clock pauses when the tab is hidden. Labels are laid out in screen coordinates.
|
|
|
|
## Black hole renderer
|
|
|
|
- Each pixel is a light ray traced through Schwarzschild spacetime (`geodesic.ts`, mirrored in the GLSL in `shaders.ts`). Rays that fall in are black, rays that cross the disk plane pick up Doppler-beamed disk light, and rays that escape sample the sky. The shadow, the arch of the far side of the disk, the second image and the Einstein ring all come from that, not from artwork. Far from the hole the integrator is skipped for the weak-field deflection. The thin ring hugging the shadow is real: it is light that skimmed the photon sphere. It stays on by default, and `rimCut` can fade it out.
|
|
- The proportions follow reference imagery of a thin disk seen from a low angle: the disk reaches about 26 M, roughly five times the shadow's radius, the camera sits 8° above the disk plane, the disk is optically thick near the hole and thins toward its rim, and its brightness falls steeply outward. In the app the shadow is 34 scene units across its radius, so the disk ends just past the first orbit ring. The disk plane is not the orbit plane: the orbits keep their own 0.68 tilt.
|
|
- The disk's texture is filtered by how many pixels each feature covers: noise octaves too fine to resolve collapse to their mean and melt into a smooth glow, so thin lines cannot alias into moire. Light bent a long way round the hole is squeezed onto fewer pixels, so it is filtered harder. The gas shears with differential rotation, and the whole pattern flows faster near the hole.
|
|
- The sky must never rival the orbit markers drawn over it. Point sources in the bake (stars and distant galaxies) are small, few, and capped in brightness (`POINT_CAP`), and every marker has a soft dark backing disc and a dark outline, so it stays readable over any haze. Treat both as a contract: a sky change that adds bright features near the orbits breaks clickability.
|
|
- The sky is baked once into a cubemap at load and sampled per pixel. It is a procedural galaxy with a bulge, dust lanes, nebulae, distant galaxies and stars.
|
|
- The canvas sits under the whole scene panel and follows `.galaxy-frame` through its bounding rectangle, so the hole stays centred on the orbits while the frame springs between the workspace and Big Screen. Drawing happens in Motion's post-render step so it never lags the frame's transform.
|
|
- The galaxy loop publishes its disk clock and the capture absorption to the renderer through a shared signal, so Flowing, coasting and capture spin-up drive the disk. A locked map renders once and sleeps.
|
|
- Quality adapts to the device. A few synchronised frames are timed at startup and after a resize, and the tier steps down until the median fits the frame budget: `high`, `medium`, `low`, `minimal`, then `still`, which freezes ambient motion. Ambient drawing is capped at 30 fps or lower. Tiers and the governor live in `quality.ts`.
|
|
- Without WebGL2, or after a lost context, the scene falls back to the SVG core and backdrop.
|
|
- **Radar view** in the map toolbar switches between the realistic and radar looks. The choice is remembered per browser. Without WebGL2 the button is hidden. The radar sweep runs on its own clock rather than the scene's, so it keeps turning on a locked map. Reduced motion switches looks at once and holds the sweep still and evenly lit, and the still quality tier does the same. A page that loads with the radar look applies it at once, with no wave. While the sweep runs the map redraws at the tier's frame-rate cap, so radar costs more battery than a locked realistic map, which draws nothing.
|
|
- The radar look draws range rings every 6 M, a bearing scale at 30 M just outside the disk, a crosshair and a rotating sweep head whose phosphor fades behind it. The lensed grid only shows outside about 20 M, so it never crowds the disk. The disk is drawn as contour bands equal in log brightness, and the long dim outer disk stays faint so the inner contours carry the weight.
|
|
- A realistic and a stylized radar look share the same trace. The radar look arrives as a wave spreading outward from the hole: each pixel picks its look from its distance to a spring-driven front, with a thin leading edge (mint going to radar, amber coming back). `look.ts` holds the spring and queues a request made mid-wave rather than reversing it. `web/blackhole-proto.html` is a standalone page for tuning the look; Vite serves it in development and the build ignores it. Add `?throttle=N` to emulate a GPU N times slower.
|
|
|
|
|
|
## Animation guideline
|
|
|
|
- Use the installed Framer Motion API from `motion/react`. Declarative `motion` components inherit the physics spring from `MotionConfig` in `web/src/main.tsx`. Use `uiSpring` for direct controls, `gentleSpring` for reveal and layout travel, and `ambientSpring` for scene effects. The tokens in `web/src/lib/motion.ts` define stiffness, damping, mass, and rest thresholds.
|
|
- Keep the element, its React key, and its MotionValues stable while a target can change. Update the scalar `animate` target, call `animate(value, nextTarget, uiSpring)` on the same MotionValue, or call `.set(nextTarget)` on a `useSpring` value. Motion automatically replaces the active animation and inherits the live value and velocity. Leave `from`, `velocity`, and fixed timing options unset for these retargets. For colors and other compound styles, spring a numeric mix amount or progress value and derive the visual property from it.
|
|
- Keep `AnimatePresence` mounted and use a stable child key so a reopening element can reverse its exit. Make an exiting overlay inert and release its hit area immediately. Track direct manipulation one-to-one and seed the spring with release velocity when handing control over from an external gesture.
|
|
- Keep CSS state changes immediate. Use Motion springs for visual transitions, including hover and loading feedback. Reserve repeating springs for ambient indicators and give them a static state under reduced motion. For continuous simulation, keep the path on its existing clock and spring its speed or progress. A new event can start a distinct path at its own origin.
|
|
- Use a single progress value for a staged effect. Derive the capture flare, flight, absorption, and recovery-point flash from the scene clock. If the snapshot list is still refreshing, let the impact finish and hold the flash until its confirmed snapshot arrives.
|
|
- Measure the destination frame on a mode change or resize. Spring the map's center and size from its current visual rectangle, and recompute the collision layout once the frame settles.
|
|
- Honor live changes to `prefers-reduced-motion`. The app applies declarative targets immediately. Imperative effects must stop and jump to the appropriate static state themselves. Verify reversals before settling, the final target, and reduced motion in a browser.
|
|
|
|
## Local verification
|
|
|
|
Build the web UI before building the hub, which embeds the generated assets.
|
|
|
|
```sh
|
|
cd web
|
|
npm ci
|
|
npm run typecheck
|
|
npm test
|
|
npm run build
|
|
cd ..
|
|
cargo test --workspace --locked
|
|
cargo build --locked -p tessera-hub
|
|
```
|
|
|
|
To preview a populated scene, start the hub with `TESSERA_SEED_DEMO=1` and a fresh temporary `TESSERA_DATA_DIR`. Open the vault and select an orbit with snapshots to review the locked layout.
|
|
|
|
The optional `web/scripts/capture-galaxy.mjs` helper uses a local Playwright and Chromium installation. It saves Flowing and Locked screenshots in the system temporary directory by default. To exercise 55 orbits and simulated successful and failed captures against a running web build, use the browser fixture. It measures median and p95 frame intervals with Chromium CPU throttling and checks reversal, capture feedback, resizing, and reduced motion.
|
|
|
|
```sh
|
|
TESSERA_GALAXY_FIXTURE=1 CPU_THROTTLE=4 FRAME_P95_MAX_MS=33.4 \
|
|
TESSERA_URL=http://127.0.0.1:5173 node web/scripts/capture-galaxy.mjs
|
|
```
|
|
|
|
Set `VIEWPORT_WIDTH=3840 VIEWPORT_HEIGHT=2160` for a 4K viewport. Set `VERIFY_ANIMATION=0` to record a fixture baseline on older builds. If Playwright or Chromium is installed outside the web workspace, point `PLAYWRIGHT_MODULE` and `CHROMIUM_PATH` at those installations.
|