# PIPELINE — asset generation (Lane D)

Everything generates **free and local** on the m3ultra box via MODELBEAST; fal.ai is a paid,
gated fallback. Verified live 2026-07-16: `m3ultra@100.89.131.57` (tailnet, key auth),
`~/Documents/MODELBEAST/server/operators/` = `flux_local` (FLUX.2-klein-4B text→image on MPS,
~6 s/img, weights cached), `mflux_image_edit` (img2img/inpaint), `sf3d` (image→GLB, seconds,
draft quality), `trellis_mac` (TRELLIS image→GLB `1024_cascade`, ~3–8 min, quality),
`seedvr2_upscale`. Venvs: `~/Documents/MODELBEAST/venvs/{mflux,rmbg,sf3d}`.

Run pipeline scripts **on the m3ultra box** (clone this repo there) or drive over ssh the
PROCITY way — copy the working patterns from `~/Documents/PROCITY/pipeline/` (`gen_skins.py
--local` drives `flux_local/run.py` directly, no server, one GPU job at a time; `gen_props.py`
chains concept→trellis; `gen_audio.py` is the procedural audio precedent; `normalize.py` is
the Blender house-law enforcer; `glb_stat.py` the dependency-free GLB parser). Don't reinvent
these — port them.

## Textures (round 1)

1. `pipeline/gen_textures.py --dry-run` lists the pack (prompts live in the script, style
   stems from ART_BIBLE). `--local` → flux_local → `pipeline/.genraw/` at 1024².
2. **Tile check:** script renders each result wrap-offset by 50% into a contact sheet —
   seams are instantly visible. Fix seams by mirror-tiling or `mflux_image_edit` inpaint
   (≤2 attempts, then pick a different prompt).
3. **Normals:** `pipeline/derive_maps.py` — grayscale → height (blur pyramid) → Sobel normal
   map, plus WebP conversion (≤1024, quality ~82). Pure numpy/PIL, no model.
4. `--harvest` → `web/assets/gen/*.webp` + entries in `web/assets/manifest.json`
   (`build_manifest.py`), thumbs contact sheet → `docs/shots/laneD/`.
5. **Eyeball in-engine** (boot with `?dbg=1`, check tiling scale on the stub tube) before
   committing. Delete rejects from `.genraw/` — committed junk is forever.

## Meshes (round 2+, after concept sign-off)

concept (flux_local, ART_BIBLE stem) → **sf3d draft** (seconds — iterate the concept until
the silhouette reads) → **trellis_mac** final → `normalize.py` (Blender: metres, +Y up,
origin, decimate to ≤5k tris — TRELLIS outputs run 25–77k, always decimate — WebP ≤1024,
no Draco) → thumbnail → manifest. **Eyeball every thumbnail.**

Known TRELLIS weaknesses (PROCITY scars): transparent/glassy surfaces, thin wires/fins →
don't burn attempts; straight to the fal list.

## fal.ai fallback (the only money in the project)

Rules: **≤2 local attempts** per asset, then it goes on `pipeline/FAL_LIST.md` with the
concept image attached — **John personally approves and runs the batch** (key is his; never
committed, never in env on shared boxes). Cost ~10¢/gen billed 30¢ (MeshGod law). Expected
fal candidates: tapeworm head (long thin body), anything translucent. Check the
3GOD depot (`digalot.fyi/3god`) + `~/Documents/3D=models/` first — never regenerate what
exists.

## Audio (round 1 proof, round 2 full pack)

Procedural synthesis in numpy → WAV → ffmpeg OGG/Opus + M4A/AAC dual-ship (the PROCITY
`gen_audio.py` approach — $0, deterministic, seamless loops, parody-safe). GUTS pack:
biome ambience beds (wet cavernous drones, muffled heartbeat — tempo maps to danger, E's
hook), sfx (pellet, torpedo, squelch hits, boost, gate, pickup chime, alarm), boss stingers.
Beds `loudnorm` −16 LUFS, sfx peak-normalized, budget ≤10 MB shipped. Verification =
spectrogram sheet + numeric loop-seam check into `docs/shots/laneD/`; final ear-check is
John's.

## Licensing

Everything generated here is ours (🟢 web-ok). Any sourced mesh must be Sketchfab CC0/CC-BY
or CGTrader royalty-free; **no ActorCore in web builds** (house licensing zones). No humanoid
characters planned, so the Mixamo fleet rule shouldn't apply — if a humanoid ever appears,
use the character_kit base meshes, never a new rig.

## Artifacts

Git-ignored (regenerable): `pipeline/.genraw/`, `pipeline/.genprops/`, `pipeline/.genaudio/`,
`pipeline/_normalized/`. Committed: scripts, prompt/batch JSONs, `FAL_LIST.md`,
`web/assets/**` shipped files, `docs/shots/laneD/` evidence.

| step | cost |
|---|---|
| textures, normals, audio, drafts, TRELLIS meshes | **free** (local MPS) |
| fal.ai fallback meshes | ~30¢/asset, gated on John, expected ≤$3 total |
