Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

3D fighters

Status: shipped behind the Cargo feature model3d, on by default. Rollback: remove model3d from default in the root Cargo.toml; the game then draws the 2D donor sprites and hides the 3D category.

Principle

The simulation stays 2D. Hitboxes, physics, state machine and rollback never read the model. A 3D fighter is a UMF fighter (assets/chars3d/<id>.json, usually extends a native kit) whose drawing is replaced by a GLB model, so a 3D fighter fights a 2D one with the same rules. Light mode (lite::scale() < 1) falls back to the 2D sprites.

Pipeline

  1. Model::from_glb parses a .glb (own parser over serde_json, PNG textures through png): nodes, skins, meshes, materials, animations.
  2. StateMap (JSON) maps native anim names (anims) or MUGEN state ranges (states) to a clip, loop flag and speed.
  3. The pose is a pure function of anim_no/anim_elapsed (or stateno/statetime), skinned on the CPU, so it is rollback safe.
  4. Model::project uses an orthographic camera on the fight plane, flat Lambert shading and back-to-front triangles, drawn through ume_shell::quad::draw_mesh batched by texture. No GPU pipeline change.

In the game

  • src/model3d.rs is the facade (draw, draw_fit, is_3d, portrait); src/model3d/specs.rs lists the models.
  • Fight: one line in render.rs. Select, versus and results panels: draw_fit inside draw_char_fit. Tiles and loading use portrait.
  • The select screen has a 3D category.
  • The awakened form swaps to the second model (Ichigo: Hollow Total).
  • src/model3d/aura.rs draws the 3D-only effects: the AfterImage trail as additive tinted copies of the current frame (crimson Shunpo, gold Sonido in Hollow form) and a reiatsu barrier in front of the fighter in guard states (120-155) that flashes on guard hit (150-155).

Asset tools

tools/retarget (Python, stdlib only):

  • retarget.py <clips dir> <source.glb> <out.glb> <rig> bakes the clips listed in clips.json onto a rig from rigs.json.
  • autorig.py <mesh.glb> <clips dir> <out.glb> fits a skeleton and skin weights to an unrigged mesh.
  • keyposes.py <in.glb> <out.glb> <rig> bakes the hand-keyed clips of keyposes.json (Bankai stance, three-hit sword string, Getsuga wind-up, charge and release, Juujishou cross, Shunpo, Cero, guard, pointing win pose). A pose sets hips offset, torso/chest/head yaw-pitch-roll and limb directions as [azimuth, elevation] in character space (0 = toward the rival, +90 = his left); bladeR is solved by blade_solve.py into the wrist rotation that aims Zangetsu, and keys_<rig> overrides a clip for one rig (the Hollow fires Cero from the horns). Feet stay on the floor automatically. Re-run on both GLBs after editing; the script is idempotent.
  • Contact sheet of clips: cargo run --release -p ume-model3d --example clip_sheet -- <model.glb> <out.png> Clip1,Clip2 <frames>.
  • Portrait: cargo run -p ume-model3d --example portrait -- <model.glb> <states.json> <out.png>.
  • Voices: tools/voices/generate.py <id> adds the fighter to voices.bank and keeps the other banks.

3D stage: Airport

airport3d ("3D Airport — Sunset") is a live 3D backdrop behind the same model3d feature, so dropping the feature removes the stage with no other change.

  • assets/model3d/airport.glb (128 KB) is generated by python3 tools/airport/build.py <out.glb> (stdlib only): airliners, terminal with jet bridges, control tower, runway, hills, clouds and sun. No third party art; vertex colors per material, emissiveFactor marks unlit lights and the sun.
  • Clip ambient (40 s loop): one jet lands on the far runway, one taxis across the apron, a baggage tug crosses the stand.
  • Model::project_scene (crates/model3d/src/perspective.rs) is the perspective projector: near-plane clip, flat Lambert, per-vertex distance fog, gradient sky. It feeds the same z-buffer Raster used by the fighters.
  • src/model3d/airport.rs renders 480x270 (320x180 in lite mode) at 30 Hz into one texture that fills the stage rect; the 2D parallax scroll of illustrated stages still applies. Lite "backdrop off" shows a still of the same scene.
  • Measure: cargo run --release -p ume-model3d --example airport -- assets/model3d/airport.glb out.png 480 270 1.

Ichigo moves

Jumps: D, U or U, U super jump (also in the air), two air jumps, three air dashes. Specials: Getsuga Tenshou (~D, DF, F, x), charged Getsuga (~D, DB, B, y, hold y; 45 ticks for the max wave), Shunpo (~D, DB, B, b, Sonido trail in Hollow form), Shunpo Rush, Hollow Cero (~D, DB, B, a, hold a; 40 ticks for the big beam), Getsuga Juujishou, Kuro Getsuga, Hollow Rampage; Hollow Total adds Cero Oscuras. Charges use the holdRelease move field (see UMF character).

Credits

See assets/model3d/ATTRIBUTION.md.