Skip to content

player(starfield): X-wing gliding into the nebula - #101

Open
eetu wants to merge 3 commits into
mainfrom
viz-starfield-xwing
Open

player(starfield): X-wing gliding into the nebula#101
eetu wants to merge 3 commits into
mainfrom
viz-starfield-xwing

Conversation

@eetu

@eetu eetu commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Embeds the LLM-modeled X-wing (a maquette export — software-projected triangles, no three.js) into the Starfield viz, which was always stubbed for it ("A 3D ship model will be brought in later").

  • Pose: baked once to a cached buffer at a rear-3/4 hero pose (rotX 0.5, rotY 0) — engines toward the camera, nose pointing up into the nebula glow, canopy on the spine. (Found empirically by rendering an orientation grid.)
  • Motion: stamped each frame at bottom-centre with a cheap 2D transform — a slow glide bob "forward" plus a low-frequency turbulence sway/bank that swells with the music energy, and a soft engine wash that breathes on the beat. Fades in on play, calms on stop.
  • Perf: no per-frame re-projection of the 3k+ triangles (baked bitmap + 2D transform) — friendly to the Pi.

Model at packages/player/src/models/xwing.js (verbatim maquette artifact, prettier-ignored; typed via xwing.d.ts). Shared Starfield, so both tracker + party get it.

typecheck 0/0, both apps build clean. (Verified the framing headlessly against the real nebula backdrop.)

@eetu
eetu force-pushed the viz-starfield-xwing branch from d4e16c0 to da53839 Compare July 8, 2026 14:00
eetu added 3 commits July 9, 2026 10:13
Adds the maquette X-wing (software-projected triangles, no three.js) as a
foreground element in the Starfield viz. It's baked once to a cached buffer at a
rear-3/4 hero pose (rotX 0.5, rotY 0 — engines toward the camera, nose up into
the glow, canopy on the spine), then stamped each frame at bottom-centre with a
cheap 2D transform: a slow glide bob plus a low-frequency turbulence sway/bank
that swells with the music, and a soft engine wash that breathes on the beat.
No per-frame re-projection (3k+ tris) — friendly to the Pi.

Model lives at packages/player/src/models/xwing.js (verbatim maquette export,
prettier-ignored; typed via xwing.d.ts).
The nose (the max-z end of the model, not the small z=-0.92 tail cone) was
pointing toward the camera. Rotating the hero pose 180° about Y (rotY 0 → π,
keeping rotX 0.5) points the nose up into the distance toward the nebula core —
we see the rear/engines, ship receding to centre. Fixes the nose-down grievance.
Replace the software triangle-painter maquette with a real 3D model, precompiled
from data/model.glb at author time and drawn live by a tiny WebGL renderer — no
three.js in the runtime bundle.

- scripts/gen-xwing.mjs: author-time extractor (run when the glb changes). Uses
  glTF-Transform as a DEV dependency — robust to any re-export (KHR_mesh_quantization,
  EXT_meshopt_compression, Draco, emissive-strength, interleaving). Bakes the node
  hierarchy into world space, merges every mesh, keys by a material table, and
  emits xwing.geometry.ts (base64 typed arrays, bundle-ready).
- xwing-render.ts: minimal WebGL renderer — one Lambert program with a depth
  buffer (glitch-free), per-vertex material colour + baked emissive engine glow.
  Intrinsic rotation (Rx·Ry·Rz, Z innermost) so rotZ rolls about the fuselage.
- Starfield: the ship holds a rear-3/4-from-above heading, nose up to the far
  nebula core, adrift on slow music-INDEPENDENT space eddies (lengthwise roll +
  all-axis tremor); near-orthographic telephoto so there's no perspective
  ballooning; eases near + still on pause. Drops the old maquette xwing.js/.d.ts.
@eetu
eetu force-pushed the viz-starfield-xwing branch from da53839 to 4fda698 Compare July 9, 2026 10:44
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