A 3D model pipeline, pushed by Fable 5.2

agent
Claude Code 2.1.322
model
claude-fable-5-2
harness
Claude Code
started
2026-11-10 10:32 UTC
took
148 min · 442 turns

user

+0:00

Your brief is in [redacted: private path]. Read it in full and carry it out.

agent

+0:02
  • Read[redacted: private path]

    input

    {
      "file_path": "[redacted: private path]"
    }

    result, 33 lines

    1	You are running as Fable 5.2 (claude-fable-5-2) at effort high, in a citadel thread of your own. The owner, severian (they/them), asked to see what Fable 5.2 would do with one of their lines of work, lowmarch, and to see one visual artifact you can make with what the project already has. The project's own session runs on a different model and is not to be touched; you are a separate, parallel look.
    2	
    3	## What lowmarch is
    4	A code-built anime character pipeline for a tactics game: VRoid bases reshaped in code, costumes, armour and hair generated in code, drawn by the project's own renderers (a painted three.js renderer is the target; the pixel renderer is abandoned). On 11-08 the owner decided to restart with one character from scratch, to find a faster, better way of working together; they haven't started yet.
    5	
    6	Read, in this order:
    7	1. `docs/handbook.md` in your worktree (entry point: each rule marked earned or guessed; guessed rules don't bind the restart)
    8	2. `[redacted: private path]` (the 11-08 reflection; the box at the top is the restart plan)
    9	3. `[redacted: private path]` (state, how to run things; numpy is in the user site, so run python3 without -I)
    10	4. `docs/portrait-guide.md`, `docs/vroid.md`, and whatever else in the repo you judge useful.
    11	
    12	## Your workspace
    13	- Your current folder is the git worktree `~/Projects/lowmarch-fable52` (branch `fable52`, made for you from master a97f25f). Work only here; you may commit here. Never touch [redacted: private path] (master), the `lowmarch-bench` worktrees, or any other repo.
    14	- Data lives in `[redacted: private path]/`: read it, don't modify it.
    15	- Output folder: `[redacted: private path]/fable52-lowmarch/` (the owner opens it at http://[redacted: tailnet ip][redacted: private review link]/fable52-lowmarch/).
    16	- Licences: the Yin/Yang rigs are personal-use study material (keep them out of the visual); FE8 references are study only, never traced or shown; VRoid CC0 bodies and the AvatarSample faces are fine for renders.
    17	
    18	## Rules
    19	- Headless only: no windows on the owner's desktop. Never run anything that drives Windows programs (no tools/winvroid, no powershell.exe, cmd.exe or anything under /mnt/c). Browser rendering via headless Chromium only (Playwright is at `[redacted: private path]`; page-side code compiled by tsx can throw "__name is not defined", so keep page-side code as plain .js evaluated as text). Blender only with `-b`.
    20	- Don't install packages. Don't run the full test suite (a test run once ate 36 GB); targeted checks only.
    21	- Nothing runs [redacted: server name]; no ssh. No network uploads, no publishing anywhere. Never push.
    22	- Edit files only in your worktree and your output folder. Never push.
    23	- Don't contact other sessions except the lead, and don't use `led`, `cw` or `tracker` for this; it's an experiment, not tracked work.
    24	
    25	## Deliverable
    26	One self-contained HTML page, `index.html` in your output folder, with its images (or a short clip) beside it. The owner finds wordy interfaces tiring: organise, don't narrate; short labelled sections, plain words, no em dashes. At the top: "Fable 5.2 (claude-fable-5-2), effort high" and the date.
    27	1. **Your read of this line of work:** what's working, what isn't, what you'd keep and drop, and what you would do differently in the restart. Give opinions plainly; disagree with the reflection page where you do.
    28	2. **What you'd do next** if you ran the restart's first session: a short, concrete sequence.
    29	3. **The one visual:** a single visual artifact made with what the project already has (its tools, kits, renderers, models, data). Your choice of what it is; pick the thing that best shows what you'd do with this work. Show it large, then say in a few lines how it was made (the commands, wall time) and what you'd change next.
    30	Keep it to one visual; don't build a gallery. Aim to be done in roughly 90 minutes of work.
    31	
    32	When done, send the citadel lead (session "projects-86", tab personal/citadel-lead-2) a message with SendMessage: the page URL, a 5-line summary, and any commits on your branch. If something only the owner can decide blocks you, ask the lead the same way rather than guessing.
    33	
  • Read~/Projects/lowmarch-fable52/docs/handbook.md

    input

    {
      "file_path": "~/Projects/lowmarch-fable52/docs/handbook.md"
    }

    result, 227 lines

    1	# Lowmarch handbook
    2	
    3	For whoever picks this up cold. Read this first; everything else is detail it links to.
    4	Written 2026-11-08 by the lowmarch session, at the owner's request, with no owner review yet.
    5	
    6	## Where things stand
    7	
    8	- **What it is:** anime characters built in code for a tactics game. The owner named Unicorn Overlord as the style on
    9	  10-08; lately they compare against the Yin and Yang rigs. They can't model or draw, and review pictures.
    10	- **The owner is restarting** with one character, from scratch, to work out a faster, better process. They start it.
    11	  Don't build character work before then. The plan is the box at the top of
    12	  `[redacted: private path]`; the retro below that box is background.
    13	- **What exists:** 14 bare T-posed bodies with VRoid faces and hair, 14 expressions each, a painted renderer
    14	  (`review/vroid-02/index.html`). No dressed character on these bodies, no game frame, no game code.
    15	- **Review pages:** cast expressions [redacted: private link], hair research
    16	  [redacted: private link]. Artifacts belong to the account that made them; if you can't
    17	  update one, ask the lead (personal/citadel-lead-2).
    18	- **More detail:** `docs/map.md` (what's current or stale, where big files sit), `docs/todos-2026-11-08.md` (open
    19	  todos sorted), `[redacted: private path]` (history).
    20	
    21	## Earned and guessed
    22	
    23	Every rule below carries a mark, so old rules can't quietly bind the restart.
    24	
    25	- **Earned:** the owner saw it and said so, or a failure was measured and the fix held.
    26	- **Guessed:** I reasoned it, took it from study, or only my own checks passed it. It binds nobody.
    27	
    28	An earned rule can still be overturned, as long as someone says so out loud. "On old bases" means earned on work now retired.
    29	
    30	## Reading the owner's feedback
    31	
    32	- **Cohesion is about the whole, not a part.** "There has to be cohesion in it" (10-31) arrived about lashes, and I made
    33	  it a lash rule. The same complaint runs all month: "how the features sit on the face" (10-07), "pieces look floating"
    34	  (10-08), "head surgery" (10-10), "doesn't fit her body" (10-12). Read it as: this doesn't belong to this person.
    35	- **"Hard to explain" means stop naming causes.** "I can't explain it" (10-30) got "I think I can name the something off"
    36	  from me, then a build. Make options that vary what might be wrong, and let them point.
    37	- **They see more than they can say, and they're usually right.** Asked to check thin arms and thighs, the survey data
    38	  agreed (lesson 27). Take a marked-up screenshot literally: the orange nape line was correct (lesson 14).
    39	- **Images are data.** "Cursed", "scar", "surgery" say what it feels like, not what the mesh did.
    40	- **Sort praise by size.** Whole-thing verdicts: Saber (10-08), the bodies "look perfect" (10-12). "I like the shadows
    41	  now" is a part. "I guess that works for now" (10-12) isn't approval. "Go for your list" is delegation, not agreement.
    42	- **"Where next?" and "I wonder how else" are requests for a map** and for how far this goes. Answer plainly, including
    43	  "I don't know if this route gets there". I didn't, and I said "the shading layers are what close the gap" (10-30). Don't.
    44	- **Pivots are usually theirs.** If they're doubting the base, something's been wrong for a while. Say it first next time.
    45	- **"I'm lost" (10-30) and "I just need the sheets" (10-31)** mean fewer words. Skip ledger numbers during review.
    46	- **Money:** they've offered to buy tools (10-30), and declined a cost they hadn't noticed (11-02). Free path first, money
    47	  in line one, nothing spent without a fresh go.
    48	
    49	## Showing options fast
    50	
    51	The ladder, cheapest first. Stay as low as you can, and only build the owner's pick properly.
    52	
    53	| Change | Tool | Cost |
    54	|---|---|---|
    55	| Camera, colours, rough blocks on a stand-in | `tools/session/frame.py` | 3 options in 5 s (measured 11-08; 6 s cold, 3 s warm on 11-09) |
    56	| Painted renderer's page only | `tools/shots/arm_shoot.py`, on a copy of the site | 8 s a body (measured 11-08) |
    57	| A face or expression | `tools/shots/variant_build.py`, then shoot | roughly 1 min a body (older note, not re-measured) |
    58	| Any file in cage's cache key (below) | `python3 -I tools/cage.py` | about 10 min for all 14 (10-31) |
    59	
    60	**First session:**
    61	
    62	```bash
    63	S=$(python3 tools/session/rows.py new first --ref PICTURE) # the session folder
    64	python3 tools/session/frame.py --info arm_f_slender        # height and landmarks, for placing blocks
    65	cp tools/session/smoke_spec.json $S/frame.json             # then edit camera and options to match the picture
    66	python3 tools/session/frame.py $S/frame.json $S/r1         # one PNG per option
    67	python3 tools/session/rows.py add "Big shapes" $S/r1/*.png --note "under 100 words"
    68	cw view $S/latest.png                                      # the row, beside their picture
    69	python3 tools/session/rows.py answer "B, shorter hair"     # timed; rows.py log prints the rounds
    70	```
    71	
    72	Publish with the Artifact tool from the same path each time, so the link stays put. Use `$S/index_noref.html` unless the
    73	owner has said a private page may hold their picture (see "Things that don't bend"). `--blind` shuffles a row's labels.
    74	
    75	**The spec** (`tools/session/smoke_spec.json` is a working example, and a test, not a design):
    76	
    77	- `figure`: a built armory body. It's a stand-in; `look.hide: ["hair"]` drops its hair.
    78	- `frame`: `w`, `h`, `ground_y` (where the feet stand), `horizon`, `background`, `ground`, and `camera`: `kind` (`ortho` or
    79	  `persp`), `fov`, `yaw`, `pitch`, `figure_h` (share of the frame's height), `figure_x`.
    80	- `look`, overridden per option: `skin`, `shade`, `hair`, `hair_shade`, `cloth`, `cloth_shade`, `ink`, `outline` (metres),
    81	  `threshold`, `light`, `features` (flat eyes and lines), `hide`.
    82	- `options[].blocks`: `ball`, `tube` (points, radii, `flat`) and `loft` (rings), in metres from a landmark in `at`.
    83	  +x is the model's left, +y up, +z front.
    84	
    85	`tools/session/smoke.sh` tests the kit end to end in about 7 s (9 s cold after a restart, 11-09). It needs the built armory site and network for three.js.
    86	The frame page is flat two-tone on purpose. It isn't the game's look, so don't judge finish on it.
    87	
    88	## How to run
    89	
    90	"Ran" means run on 11-08 at master `c4f1015`. numpy is in user site-packages, so `-I` works for `cage.py` but breaks
    91	`lash_check.py`.
    92	
    93	| Command | What it does | Status |
    94	|---|---|---|
    95	| `python3 -I tools/cage.py [NAME...]` | builds armory bodies, cached | ran, one body, cached |
    96	| `LOWMARCH_SITE=armory python3 review/vroid-02/build.py` | builds the armory into `review/out/armory/site/` | not re-run; built 10-31 |
    97	| `python3 tools/lash_check.py [NAME...]` | open lash against closed lids, on meshes | ran, one body, 8 s |
    98	| `ROWS=0 python3 tools/shots/arm_shoot.py SITE OUT NAME...` | shoots a site copy, headless | ran, one body, 8 s |
    99	| `tools/shots/all14.sh OUT` | 6 expressions on all 14 bodies | copied, not re-run; wipes OUT first |
    100	| `python3 tools/regress.py NAME [TAG]` | geometry diff against a published version | not re-run |
    101	| `python3 tools/winvroid/winvroid.py bases\|samples` | drives VRoid Studio on Windows | blocked until the owner allows V.dll (#1105); takes over the PC, needs their go |
    102	
    103	- **Cage's cache key** hashes `cage.py, fit.py, proportions.py, makehuman.py, anthro.py, heads.py, vroid_portrait.py,
    104	  collide.py`. Touching any of them rebuilds every body. `export_glb.py` isn't in the key, but its changes need the GLBs rebuilt.
    105	- **Browsers:** headless only. Headed windows pop up on the owner's desktop.
    106	- **Data** lives outside the repo, in `[redacted: private path]/`. Paths are in `docs/map.md`.
    107	- **The skeleton trap:** the bind pose holds the arms down while the mesh is T-posed (lesson 26). Arm bones' world
    108	  positions don't mark the visible arm. `frame.py --info` reports arms from the skin instead.
    109	
    110	## The rules
    111	
    112	Each links to its lesson in `docs/portrait-guide.md` (L12 is lesson 12).
    113	
    114	### Working with the owner
    115	
    116	| Rule | Mark | Basis |
    117	|---|---|---|
    118	| Ask "is this good?" of a whole character, not a part | Earned | Saber 10-08, bodies 10-12; parts get only local praise |
    119	| Put a reference beside ours | Earned | "there's no muscle bulge" 10-09, L19 |
    120	| Blind rows for close calls | Earned | Sharpest verdict of the month, 10-30 |
    121	| Check the view the owner will see | Earned | L12; wrong renderer on 10-30 |
    122	| A fix that moves another part is a regression until compared | Earned | L13, L28 |
    123	| Study first, on anything new | Earned | Chin shadow took 3 builds before research (L33 to L35); sleeves and Saber jumped with study first |
    124	| Tuned on one face means tuned on one face: check the rest before calling a range done | Earned | Mouths broke on the other 12 (L40) |
    125	| Judge only in the game frame | Guessed | Retro; never tried |
    126	| Rough blocks before detail | Guessed | Retro; never tried |
    127	| One change a row, 3 or 4 options, under 100 words | Guessed | Retro; never tried |
    128	| Two rounds with no visible change: stop and say so | Guessed | Retro; never tried |
    129	
    130	### Bases and bodies
    131	
    132	| Rule | Mark | Basis |
    133	|---|---|---|
    134	| VRoid whole, shaped by a MakeHuman cage, own head kept | Earned | "it looks perfect" 10-12, L25 |
    135	| Head grafts don't pass | Earned | "surgery" 10-10, L17, L25 |
    136	| Read flesh against survey percentiles at the body's height and waist | Earned | Matched the owner's eye, L27 |
    137	| Ranges measured on armoured figures don't fit bare bodies | Earned | L24, L27 |
    138	| Tie a hand to body height | Earned | L28 |
    139	| Don't force ratios from 2D art onto a 3D face | Earned | "too sharp" 10-12, L30 |
    140	| A VRoid face as built is good enough | Guessed | The verdict was only "I guess that works for now" |
    141	| No better shippable base than VRoid exists | Guessed | Research 11-08; candidates not all tried |
    142	
    143	### Faces
    144	
    145	| Rule | Mark | Basis |
    146	|---|---|---|
    147	| Shadow made by bending mesh normals reads as a scar | Earned | 10-30, L33, L34 |
    148	| Chin shadow cast from the jaw in screen space | Earned | "I like the shadows now" 10-30, L35 |
    149	| Proxy face normals for a clean edge | Earned | Kept 10-30, L32 |
    150	| One lash size per character, open and closed | Earned | Owner's rule 10-31, L38. A sample of cohesion, not the whole of it |
    151	| A shut lid is one solid stroke | Earned | "the eyes look good now" 10-31, L38 |
    152	| Mouth inside from VRoid's texture, anime palette | Earned | Blind pick 10-30, L39 |
    153	| One-sided shapes for a smug look | Earned | Blind pick 10-30, L39 |
    154	| Age takes more than lines | Earned | "hardly reflect old men" 10-08; never solved, #768 |
    155	| 15% lash limit, split-line check | Guessed | My number, L38 |
    156	| Shading line at the head's middle, front stays lit | Guessed | My choice, L32. At 35° the far side reads flat. Test this first |
    157	| Force shadow on the far side of the face | Guessed | L03 on a retired mannequin; research agrees, never tried here |
    158	| Brows drawn through the bangs | Guessed | The owner doubted it: "not sure if eyebrows are supposed to show up on top of hair" (10-30) |
    159	| Hold the mouth 2 mm off the chin; teeth only above 8 to 11 mm | Guessed | L40, no verdict |
    160	| One expression list for every face | Guessed | Research says per character; the open mouths look alike |
    161	| Flat eye plane, per-angle tables | Guessed | L03. Arc System Works calls a tilted flat eye a mistake |
    162	| FE8 house style: purple ink, tone rules | Guessed | From the pixel era, now abandoned |
    163	
    164	### Hair
    165	
    166	| Rule | Mark | Basis |
    167	|---|---|---|
    168	| Few clumps of different widths, not even points | Earned | "seven pointed bangs" 10-08, L14 |
    169	| Nape level with the bottom of the earlobe | Earned | Owner's orange line, L14 |
    170	| Sample-style hair beat the kit's locks | Earned | 10-08, #735 |
    171	| Hair must not sink into the body | Earned | 10-13. The fix (L31) passed only my replay, not the owner's eye |
    172	| Dark layer under the locks closes gaps | Guessed | Proposed 10-31, not built |
    173	| Hair keeps its own normals | Guessed | My eye, L32. Studios copy from simple shapes, so retest |
    174	| Back, then sides, then front | Guessed | My 10-31 report; no source confirms it |
    175	
    176	### Clothes and armour
    177	
    178	| Rule | Mark | Basis |
    179	|---|---|---|
    180	| Fit by rays to what's underneath; nothing floats | Earned, old bases | "floating" 10-08, then Aldric, L07 |
    181	| An under-layer next to skin isn't skin-toned | Earned, old bases | 10-08, L10 |
    182	| Loose sleeves; no muscle through cloth | Earned, old bases | 10-09, L19 |
    183	| Check with arms out; cast waist rings on the torso only | Earned, old bases | L12, L13 |
    184	| Layered skirts share weights | Earned, old bases | Owner spotted the underskirt, L13 |
    185	| Long skirts posed, not simulated | Earned, old bases | Every free-cloth variant broke, L11; the owner never judged it in motion |
    186	| Garment offsets in millimetres | Guessed | L07, tuned on old bases |
    187	| Folds as ripples built into the garment | Guessed | L19. Studios place folds by hand for a pose |
    188	
    189	### Rendering
    190	
    191	| Rule | Mark | Basis |
    192	|---|---|---|
    193	| The painted renderer is the target; pixels are abandoned | Earned | Owner 10-30 |
    194	| Flattice waits until scenes have a camera | Earned | Owner 10-30 |
    195	| A colour ramp per skin tone | Earned | Owner asked for the range; L36 |
    196	| Orthographic cameras everywhere | Guessed | My default; the owner never chose it. Their picture decides |
    197	| Headlight from the upper left, near-white default skin | Guessed | Never chosen |
    198	| Paint numbers measured off Unicorn Overlord (L10) | Guessed | Taken from paintings; the reference has since moved |
    199	
    200	## Things that don't bend
    201	
    202	These are facts or standing instructions, not lessons.
    203	
    204	- **Yin and Yang rigs:** personal-use licence. Study only, never ship.
    205	- **References:** never traced, shipped or committed (`docs/study.md`). The same doc also keeps them off published pages.
    206	  I wrote that clause and it's guessed; the owner hasn't ruled on a private page. The retro's box says "your picture on
    207	  the left", so ask them. Until then, the published sheet leaves it out.
    208	- **VRoid licence:** read by hand on 11-09, in `docs/vroid.md` ("Licence, read 2026-11-09", #1443). Baked characters in a
    209	  sold game, public pages and renders are allowed, no credit needed. A player-facing creator needs pixiv's licence. Our
    210	  exports' `Redistribution_Prohibited` fields were set at our export and don't bind us. Open: unedited A to Z textures in
    211	  a paid game. The owner decides what ships.
    212	- **Blender:** nothing gets installed into it without the owner's go. A trial plan is enough.
    213	- **The repo has no remote.** The owner hasn't decided, so don't add one. Commit locally.
    214	- **Writing:** docs terse, no em dashes. Pages the owner may share carry no employer names. Public write-ups call this
    215	  "a 3D model pipeline".
    216	- **Contact** for anything outside lowmarch: personal/citadel-lead-2.
    217	
    218	## What I'd watch for
    219	
    220	These are my own weak spots, from the retro.
    221	
    222	- I judge my own pictures badly. Treat my checks as a floor, not a verdict.
    223	- I reach for a cause and a build when the honest answer is "show me which".
    224	- I write a checker after the owner catches a fault, and it tends to measure the part, not the whole.
    225	- Lessons I've written don't stop me repeating a mistake. L03 said to force shade on the far side of the face, and L32
    226	  undid it without noticing. Read the marks above before relying on a lesson.
    227	
  • Bashls -la [redacted: private path]/ [redacted: private path]/ | head -80; wc -c [redacted: private path] [redacted: private path]; ls ~/Projects/lowmarch-fable52 ~/Projects/lowmarch-fable52/docsno result

    command

    ls -la [redacted: private path]/ [redacted: private path]/ | head -80; wc -c [redacted: private path] [redacted: private path]; ls ~/Projects/lowmarch-fable52 ~/Projects/lowmarch-fable52/docs

agent

+0:05

[redacted: listing of a private folder]

  • Bashcd [redacted: private path]/ && python3 - <<'E'no result

    command

    cd [redacted: private path]/ && python3 - <<'E'
    import re,html
    s=open('lowmarch.html').read()
    s=re.sub(r'(?s)<style.*?</style>','',s)
    s=re.sub(r'(?s)<script.*?</script>','',s)
    s=re.sub(r'src="data:[^"]{200,}"','src="DATA"',s)
    s=re.sub(r'<(br|/p|/div|/li|/h\d|/tr|/section)[^>]*>','\n',s)
    s=re.sub(r'<img[^>]*alt="([^"]*)"[^>]*>',r'[IMG: \1]',s)
    s=re.sub(r'<[^>]+>','',s)
    s=html.unescape(s)
    s=re.sub(r'\n\s*\n+','\n',s)
    print(len(s)); print(s[:30000])
    E
  • Read[redacted: private path]no result

    input

    {
      "file_path": "[redacted: private path]"
    }

agent

+0:10

[redacted: private notes read: a reflection page and a handoff file]

  • Bashcd ~/Projects/lowmarch-fable52 && cat docs/map.md && ls tools tools/session tools/shots review review/* | head -150 && wc -l docs/*.md tools/*.py | tail -60

    command

    cd ~/Projects/lowmarch-fable52 && cat docs/map.md && ls tools tools/session tools/shots review review/* | head -150 && wc -l docs/*.md tools/*.py | tail -60

    result, 203 lines

    # Map of the repo
    
    What's current, what's stale, where the big files are. Checked 2026-11-08 at `c4f1015`. Nothing was moved or deleted.
    "Live" means the armory build or the first-session kit reaches it. Reach was read from imports, including the
    `__import__` calls in `outfit.py`, not from running every path.
    
    ## Docs
    
    | File | Status |
    |---|---|
    | `handbook.md` | **Start here** |
    | `map.md`, `todos-2026-11-08.md` | Current; suggestions only |
    | `portrait-guide.md` | Detail log, 40 lessons. True when written, some since contradicted; marks are in the handbook |
    | `vroid.md` | Current. Says 54 expression shapes at the top; the files carry 57 (2.14) and 56 (older). Licence: see #1443 |
    | `anthro.md` | Current for bodies |
    | `proportions.md` | Bodies current; face ratios are reported, not held, since lesson 30 |
    | `makehuman.md` | Current: references for the cage |
    | `study.md` | Current; one clause is guessed (handbook, Things that don't bend) |
    | `quaternius.md` | Stale: a spike that lost (lesson 21) |
    
    ## Tools
    
    **First-session kit (new):** `tools/session/` (`frame.py`, `rows.py`, `smoke.sh`, `smoke_spec.json`), `review/frame/index.html`.
    
    **Render scripts (copied in 11-08 from `[redacted: private path]/kit`, which still has the originals):** `tools/shots/`:
    `arm_shoot.py` (ran 11-08), `variant_build.py`, `all14.sh`, `all14_sheet.py`, `expr_build_tiles.py`, `expr_page.html`. Only
    `all14.sh` changed, to find its own folder.
    
    | Status | Files |
    |---|---|
    | Live: the armory | `cage`, `heads`, `fit`, `proportions`, `anthro`, `makehuman`, `collide`, `vroid_portrait`, `vrm`, `export_glb`, `poses`, `rig`, `fitting`; `review/vroid-02/build.py`, `sheets.py`, `index.html`; `art/cast/cast.py`, `expressions.txt` |
    | Live checks | `lash_check`, `lash_shots`, `checks`, `regress`, `review/vroid-02/snapshot.py` (keeps the baseline `regress` reads), `review/vroid-02/duel_check.py` (build imports `chars_for` from it), `hair_check` (standalone, nothing imports it) |
    | Kept for later: costumes and motion on old bases, reached from the build | `outfit`, `plates`, `gear`, `mobs`, `hair`, `clips`, `duel`, `terrain`, `saber_study` (benchmark, not for the game). Not unused: the armory's inspection shorts come from `mobs.underwear` and the hair texture from `hair` |
    | Spike that lost, still imported by the build | `mass`, `quaternius` |
    | Pixel era, abandoned; still imported | `head3d`, `pix`, `vecpix`, `study` |
    | Blocked | `tools/winvroid` (V.dll, #1105) |
    | Looks dead: nothing imports it | `features.py`, `compare.py` (study side-by-sides) |
    | Looks dead: old one-off tests, nothing imports them | `review/vroid-02/`: `battle_test`, `closeup_test`, `costume_test`, `fit_test`, `pose_test`, `mouths` |
    | Stale pages | `review/rowan-01/`, `art/portraits/rowan*`, `art/templates/`, `review/vroid-02/base_spike_notes.html`, `mh_workshop_notes.html` |
    
    `vroid_portrait.py` is named for the abandoned pixel renderer, but the build still uses its `Portrait` class. Don't edit it
    lightly: it's in cage's cache key, and so are the other cache-key files listed in the handbook.
    
    **Scripts that live outside the repo:**
    
    - `[redacted: private path]/kit/`: the benchmark's kit, including `front_sheet.py`, `build_expr.sh`, `blind_sheet.py`, `terra_review.sh`.
    - `[redacted: private path]/trials/*/scripts` and loose scripts there, such as `patch_lens_flattice.py` (a perspective lens for the painted page). Copy one in if it's needed again.
    
    ## Big files
    
    The repo's tracked files are small: `.git` is 5 MB. Everything below is outside git.
    
    | Where | Size | What |
    |---|---|---|
    | `[redacted: private path]/vroid/lowmarch_bodies` | 14 GB | Built bodies and heads; holds cage's cache (`fits.json`). The bulk of everything |
    | `[redacted: private path]/vroid/samples_2_14` | 466 MB | The 26 VRoid samples |
    | `[redacted: private path]/makehuman` | 1.7 GB | MakeHuman data |
    | `[redacted: private path]/trials` | 1.9 GB | Sheets and shots; `combined-2026-10-31` is 1.8 GB |
    | `[redacted: private path]/tools` | 1.5 GB | Portable Blender 4.5, tar included. Unused since the spike |
    | `[redacted: private path]/winvroid` | 803 MB | VRoid driver data |
    | `[redacted: private path]/refs3d`, `study`, `quaternius`, `blender-base-meshes`, `refs`, `anthro` | 1.2 GB together | Study and spike data. References stay out of the repo |
    | `[redacted: private path]/sessions` | new | First-session folders from `rows.py` |
    | `[redacted: private path]/work` | 4.9 GB | Benchmark builds; `e` is 3 GB. Transcripts and judging keep the benchmark's record |
    | `review/out/` (git-ignored) | 1.1 GB | `versions` 410 MB, `vroid-02` 249, `base-spike` 206, `armory` 115, `mh-workshop` 89, `frozen` 14 |
    | `[redacted: private path]` | | Blender 5.2.3, unused by the pipeline |
    
    If space is ever needed, the safest candidates to discuss are the Blender 4.5 tar, `review/out/versions` and
    `review/out/base-spike`. Nothing has been removed. Ask first, and check `[redacted: private path]/README.md`: the
    benchmark's raw material is being kept for a blog post (#1141).
    review:
    frame
    rowan-01
    vroid-02
    
    review/frame:
    index.html
    
    review/rowan-01:
    index.html
    palette.json
    rowan_blink.png
    rowan.png
    rowan_talk1.png
    rowan_talk2.png
    rowan_value.png
    stage1_blockin.png
    stage2_face.png
    
    review/vroid-02:
    armory_notes.html
    base_spike_notes.html
    battle_test.py
    build.py
    closeup_test.py
    costume_test.py
    duel_check.py
    fit_test.py
    index.html
    mh_workshop_notes.html
    mouths.py
    pose_test.py
    sheets.py
    snapshot.py
    
    tools:
    anthro.py
    cage.py
    checks.py
    clips.py
    collide.py
    compare.py
    duel.py
    export_glb.py
    features.py
    fit.py
    fitting.py
    gear.py
    hair_check.py
    hair.py
    head3d.py
    heads.py
    lash_check.py
    lash_shots.py
    makehuman.py
    mass.py
    mobs.py
    outfit.py
    pix.py
    plates.py
    poses.py
    proportions.py
    quaternius.py
    regress.py
    rig.py
    saber_study.py
    session
    shots
    study.py
    terrain.py
    vecpix.py
    vrm.py
    vroid_portrait.py
    winvroid
    
    tools/session:
    frame.py
    rows.py
    smoke.sh
    smoke_spec.json
    
    tools/shots:
    all14.sh
    all14_sheet.py
    arm_shoot.py
    expr_build_tiles.py
    expr_page.html
    variant_build.py
       136 docs/anthro.md
       226 docs/handbook.md
        33 docs/makehuman.md
        69 docs/map.md
      1442 docs/portrait-guide.md
       221 docs/proportions.md
        49 docs/quaternius.md
        14 docs/study.md
        65 docs/todos-2026-11-08.md
       271 docs/vroid.md
       611 tools/anthro.py
       888 tools/cage.py
       300 tools/checks.py
       139 tools/clips.py
       271 tools/collide.py
        61 tools/compare.py
       140 tools/duel.py
       567 tools/export_glb.py
       152 tools/features.py
       327 tools/fit.py
       322 tools/fitting.py
       984 tools/gear.py
       219 tools/hair_check.py
       318 tools/hair.py
       458 tools/head3d.py
       661 tools/heads.py
       186 tools/lash_check.py
       121 tools/lash_shots.py
       935 tools/makehuman.py
       291 tools/mass.py
       311 tools/mobs.py
      1272 tools/outfit.py
       302 tools/pix.py
       487 tools/plates.py
       115 tools/poses.py
       331 tools/proportions.py
       207 tools/quaternius.py
       118 tools/regress.py
       190 tools/rig.py
       541 tools/saber_study.py
       127 tools/study.py
        77 tools/terrain.py
       269 tools/vecpix.py
       274 tools/vrm.py
      1407 tools/vroid_portrait.py
     16505 total
  • Bashcd ~/Projects/lowmarch-fable52 && ls art art/cast && wc -l art/cast/* review/vroid-02/*.py review/vroid-02/index.html review/frame/index.html tools/session/* tools/shots/* && sed -n 1,140p review/vroid-02/build.py

    command

    cd ~/Projects/lowmarch-fable52 && ls art art/cast && wc -l art/cast/* review/vroid-02/*.py review/vroid-02/index.html review/frame/index.html tools/session/* tools/shots/* && sed -n 1,140p review/vroid-02/build.py

    result, 173 lines

    art:
    cast
    portraits
    templates
    
    art/cast:
    cast.py
    expressions.txt
       464 art/cast/cast.py
        17 art/cast/expressions.txt
        29 review/vroid-02/battle_test.py
       391 review/vroid-02/build.py
        32 review/vroid-02/closeup_test.py
        58 review/vroid-02/costume_test.py
        59 review/vroid-02/duel_check.py
        40 review/vroid-02/fit_test.py
        39 review/vroid-02/mouths.py
        33 review/vroid-02/pose_test.py
        88 review/vroid-02/sheets.py
        24 review/vroid-02/snapshot.py
      1737 review/vroid-02/index.html
       226 review/frame/index.html
        77 tools/session/frame.py
       172 tools/session/rows.py
        41 tools/session/smoke.sh
       105 tools/session/smoke_spec.json
        34 tools/shots/all14.sh
        39 tools/shots/all14_sheet.py
        39 tools/shots/arm_shoot.py
        44 tools/shots/expr_build_tiles.py
       229 tools/shots/expr_page.html
        53 tools/shots/variant_build.py
      4070 total
    """Build the model-viewer review page for the cast on stage, and their duel.
    
      python3 review/vroid-02/build.py              every character, the ground and the page
      python3 review/vroid-02/build.py elaine       just Elaine (the others stay as last built)
    
    Writes to review/out/vroid-02/site/:
      <name>.glb.json     each character, skinned, in the reference (bust) pose, with animation clips:
                          idle, attack, clash (the two-character sword bind) and apose (arms out, for
                          checking a costume where hanging arms would hide it). Artifact hosting serves
                          .json but not .glb, so the model is base64-wrapped.
      plains.glb.json     the battle ground (static)
      camera.json         per character: the cameras for both views plus what the live renderer needs
                          (palette roles, lights, colliders, cloth grids); the duel's stage camera and
                          where each fighter stands
      checks.json         per character: the automatic checks (tools/checks.py) over every keyframe: arms
                          through the body, and garments showing through plate
    and review/out/vroid-02/geom/<name>.npz (every piece as built), which tools/regress.py compares with the
    last published version (snapshot.py) after each build.
    then copies index.html next to them. The duel's poses are cached (they take about a minute to
    solve) and re-solved when the rig, the duel or the cast entries change.
    """
    import base64
    import hashlib
    import json
    import os
    import pickle
    import shutil
    import sys
    from concurrent.futures import ProcessPoolExecutor
    
    import numpy as np
    
    HERE = os.path.dirname(os.path.abspath(__file__))
    ROOT = os.path.dirname(os.path.dirname(HERE))
    sys.path[:0] = [os.path.join(ROOT, "tools"), os.path.join(ROOT, "art", "cast"), HERE]
    import vroid_portrait as vp  # noqa: E402
    import poses as P  # noqa: E402
    import terrain  # noqa: E402
    import export_glb  # noqa: E402
    import clips  # noqa: E402
    import duel  # noqa: E402
    import checks  # noqa: E402
    from duel_check import chars_for  # noqa: E402
    from cast import CAST  # noqa: E402
    
    VROID = os.environ.get("LOWMARCH_VROID", os.path.expanduser("[redacted: private path]/vroid"))
    # which review page: the cast viewer (vroid-02), or a workshop page on a smaller roster (its own artifact)
    SITE = os.environ.get("LOWMARCH_SITE", "vroid-02")
    WORKSHOPS = {
        "mh-workshop": dict(
            title="Body workshop", eyebrow="Lowmarch · MakeHuman bodies, VRoid heads",
            roster=["mob_mh_youth", "mob_mh_veteran", "mob_mh_brute", "mob_mh_f_youth", "mob_mh_f_veteran", "mob_mh_f_strong"],
            notes=os.path.join(HERE, "mh_workshop_notes.html")),
        # the armory: bodies to assemble characters from, T-posed and bare (no clips, no checks): VRoid's base shaped by
        # MakeHuman references (art/cast/cast.py ARMORY), which are built but never shown
        "armory": dict(
            title="Armory", eyebrow="Lowmarch · VRoid bodies shaped by MakeHuman, T-posed for inspection",
            roster=[n for n in CAST if n.startswith("arm_")], armory=True,
            notes=os.path.join(HERE, "armory_notes.html")),
        "base-spike": dict(
            title="Base spike", eyebrow="Lowmarch · which base model: MakeHuman, VRoid heads, Quaternius",
            roster=[n for n in CAST if n.startswith("spk_")],
            notes=os.path.join(HERE, "base_spike_notes.html")),
    }
    WORKSHOP_ONLY = {n for w in WORKSHOPS.values() for n in w["roster"]} - {"mob_mh_youth", "mob_mh_veteran", "mob_mh_brute"}
    OUT = os.path.join(ROOT, "review", "out", SITE, "site")
    CACHE = os.path.join(ROOT, "review", "out", "vroid-02", "cache")
    GEOM = os.path.join(ROOT, "review", "out", "vroid-02", "geom")          # per-piece geometry of the last build
    ORDER = {"player": "aldric", "opponent": "elaine"}
    # the armory's skin picker (cast.SKINS): people light to deep, then fantasy
    SKIN_PICKER = [("People", [("porcelain", "Porcelain"), ("ivory", "Ivory"), ("peach", "Peach"), ("sand", "Sand"),
                               ("honey", "Honey"), ("olive_mid", "Olive"), ("amber", "Amber"), ("caramel", "Caramel"),
                               ("chestnut", "Chestnut"), ("umber", "Umber"), ("mahogany", "Mahogany"), ("ebony", "Ebony")]),
                   ("Fantasy", [("drow_ash", "Dark elf, ash"), ("drow_slate", "Dark elf, slate"), ("ashen", "Ashen"),
                                ("orc", "Orc"), ("orc_deep", "Orc, deep"), ("sea", "Sea"), ("infernal", "Infernal")])]
    LABELS = {"aldric": "Aldric", "elaine": "Elaine", "saber": "Saber (study)"}     # saber: a benchmark, not for the game
    MOBS = [k for k in CAST if k.startswith("mob_") and k not in WORKSHOP_ONLY]   # common enemies: built, stood in the lineup
    # MakeHuman-based units stand first, next to the VRoid soldier they are compared with
    MOBS = sorted(MOBS, key=lambda k: (0 if k == "mob_soldier" else 1 if CAST[k].get("mh") else 2))
    LABELS.update({k: CAST[k].get("label", k[4:].title()) for k in MOBS})
    if SITE in WORKSHOPS:                                   # a workshop page: only its roster, in its order, no duel
        MOBS = list(WORKSHOPS[SITE]["roster"])
        LABELS = {k: CAST[k].get("label", k[4:].title()) for k in MOBS}
    # arms raised 35 degrees from the T-pose: shows the waist, the sides and the armpits
    APOSE = P.merge(P.BUST, {"J_Bip_L_UpperArm": P.rot((0, 0, 1), -37), "J_Bip_R_UpperArm": P.rot((0, 0, 1), 37),
                             "J_Bip_L_Shoulder": P.rot((0, 0, 1), -6), "J_Bip_R_Shoulder": P.rot((0, 0, 1), 6)})
    
    
    def costume_of(c):
        """The cast entry's costume, plus kit hair (hair_style) and facial hair (beard: a style, or
        (style, length)) if it has them."""
        import outfit
        import hair
        base = outfit.COSTUMES[c.get("costume") or "lord"]
        extra = []
        if c.get("hair_style"):
            extra.append(lambda fit: getattr(hair, c["hair_style"])(fit))
        if c.get("beard"):
            style, length = (c["beard"], 0.0) if isinstance(c["beard"], str) else c["beard"]
            extra.append(lambda fit: hair.beard(fit, style, length=length))
        if not extra:
            return base
        return lambda fit: base(fit) + [pc for f in extra for pc in f(fit)]
    
    
    def model_path(name, c):
        """A VRoid model under LOWMARCH_VROID, or a converted MakeHuman or Quaternius body, or a reshaped VRoid one
        (tools/makehuman.py, tools/quaternius.py, tools/mass.py, tools/cage.py, run first with `python3 -I`: they
        read downloaded data)."""
        if c.get("mass"):
            import mass
            p = mass.path_for(name, c["mass"])
            if not os.path.exists(p):
                raise SystemExit(f"{name}: no massed VRoid body; run python3 -I tools/mass.py first")
            return p
        if c.get("cage"):
            import cage
            p = cage.path_for(name, c["cage"])
            if not os.path.exists(p):
                raise SystemExit(f"{name}: no cage body; run python3 -I tools/cage.py first")
            return p
        if c.get("qt"):
            import quaternius
            p = quaternius.path_for(name, c["qt"])
            if not os.path.exists(p):
                raise SystemExit(f"{name}: no converted Quaternius body; run python3 -I tools/quaternius.py first")
            return p
        if not c.get("mh"):
            return os.path.join(VROID, c["model"])
        import makehuman
        p = makehuman.path_for(name, c["mh"])
        if not os.path.exists(p):
            raise SystemExit(f"{name}: no converted MakeHuman body; run python3 -I tools/makehuman.py first")
        return p
    
    
    def arm_room(name, c, need=0.006, most=16):
        """The smallest outward arm angle (degrees, shape["arm_out"]) at which the hanging arms clear the
        body by `need` in the reference pose and the idle: broad bodies otherwise sink their arms into
        their sides. MakeHuman bodies only for now (the VRoid cast was posed by hand)."""
  • Bashcd ~/Projects/lowmarch-fable52 && sed -n 140,391p review/vroid-02/build.py

    command

    cd ~/Projects/lowmarch-fable52 && sed -n 140,391p review/vroid-02/build.py

    result, 252 lines

        their sides. MakeHuman bodies only for now (the VRoid cast was posed by hand)."""
        import checks
        from vrm import VRM
        v = VRM(model_path(name, c))
        limbs = [f"{s}_{a}" for s in "LR" for a in ("UpperArm", "LowerArm")]
        for deg in range(0, most + 1, 2):
            b = checks.Body(v, dict(c["shape"], arm_out=float(deg)))
            if min(b.worst(pose, limbs) for pose in (P.BUST, P.BATTLE_IDLE)) >= need:
                return float(deg)
        return float(most)
    
    
    ARMORY = bool(WORKSHOPS.get(SITE, {}).get("armory"))   # T-posed and bare: the reference pose is the T-pose
    
    
    def portrait(name, view):
        c = CAST[name]
        if (c.get("mh") or c.get("qt") or c.get("mass") or c.get("cage")) and "arm_out" not in c["shape"] and not ARMORY:
            c["shape"]["arm_out"] = arm_room(name, c)
        return vp.Portrait(model_path(name, c), shape=c["shape"],
                           hair_from=os.path.join(VROID, c["hair"]) if c.get("hair") else None,
                           costume=costume_of(c), pose={} if ARMORY else vp.BUST_POSE, hair_trim=c.get("hair_trim"),
                           world=terrain.plains() if view == "battle" else None), c
    
    
    def springs(v):
        """The model's spring bones (VRM 0.x secondaryAnimation: VRoid's women's base has its breasts', a hairstyle its
        hair's, tools/heads.py): each group's root bones, settings and collision spheres (on a bone, offset in its own
        frame, before the export's turn), for the viewer's physics."""
        sa = v.j.get("extensions", {}).get("VRM", {}).get("secondaryAnimation", {})
        nodes = v.j["nodes"]
        spheres = [[dict(bone=nodes[cg["node"]]["name"], offset=[c["offset"]["x"], c["offset"]["y"], c["offset"]["z"]],
                         radius=c["radius"]) for c in cg.get("colliders", [])] for cg in sa.get("colliderGroups", [])]
        out = []
        for g in sa.get("boneGroups", []):
            gd = g.get("gravityDir", {"x": 0, "y": -1, "z": 0})
            out.append(dict(bones=[nodes[b]["name"] for b in g["bones"]], stiffness=g.get("stiffiness", 1.0),
                            gravity=g.get("gravityPower", 0.0), gravity_dir=[gd["x"], gd["y"], gd["z"]],
                            drag=g.get("dragForce", 0.4), radius=g.get("hitRadius", 0.02), comment=g.get("comment", ""),
                            colliders=[c for k in g.get("colliderGroups", []) if k < len(spheres) for c in spheres[k]]))
        return out
    
    
    def wrap_json(path):
        json.dump({"glb": base64.b64encode(open(path, "rb").read()).decode()}, open(path + ".json", "w"))
        os.remove(path)
    
    
    def character(args):
        """The rigged character (reference pose) with its clips, its cameras, the live renderer's data and
        its checks."""
        name, clash = args
        p, c = portrait(name, "bust")
        p.paint = c.get("paint")
        pal = dict(vp.PALETTE, **c["colors"])
        cam_bust, cam_battle = p.frame("bust"), p.frame("battle")
        if ARMORY:                                          # nothing moves: every clip holds the T-pose
            cl = {k: [(0.0, {}), (1.0, {})] for k in ("idle", "attack", "apose")}
        else:
            cl = clips.clips(p.v, c["shape"], c.get("stance", "sword"))
            if clash:
                cl["clash"] = clash
            cl["apose"] = [(0.0, APOSE), (1.0, APOSE)]
        path = f"{OUT}/{name}.glb"
        size = export_glb.export_skinned(p, pal, path, clips=cl)
        wrap_json(path)
        save_geometry(name, p)
        if ARMORY:                                          # the armory's checks are proportions (tools/proportions.py)
            return dict(name=name, size=size, cams=dict(bust=cam_bust, battle=cam_battle),
                        info=dict(export_glb.scene_info(p, pal), springs=springs(p.v)), checks=proportion_checks(name, c))
        body = checks.Body(p.v, c["shape"])
        keyed = {k: v for k, v in cl.items() if k != "apose"}
        head, bad, touch = checks.report(name, keyed, body)
        layers = checks.layer_report(name, keyed, checks.Layers(p, body))
        return dict(name=name, size=size, cams=dict(bust=cam_bust, battle=cam_battle), info=export_glb.scene_info(p, pal),
                    checks=dict(summary=head, through=bad, touching=touch, layers=layers))
    
    
    def save_geometry(name, p):
        """Every piece's vertices as built (reference pose), for tools/regress.py to compare builds."""
        os.makedirs(GEOM, exist_ok=True)
        arrays, seen = {}, {}
        for q in p.prims:
            key = q["material"]
            seen[key] = seen.get(key, 0) + 1
            if seen[key] > 1:
                key = f"{key}#{seen[key]}"
            arrays[key] = q["pos"][np.unique(q["tri"])].astype(np.float32) if len(q["tri"]) else q["pos"].astype(np.float32)
        np.savez_compressed(os.path.join(GEOM, f"{name}.npz"), **arrays)
    
    
    def _fit_of(c):
        """The fit a body was made to (its own, or its cage reference's): the ratios it skips (the heavy targets'
        widths were measured on armour), ranges of its own, its figure."""
        spec = c.get("mh") or {}
        ref = (c.get("cage") or {}).get("ref")
        if isinstance(ref, str):
            spec = CAST[ref].get("mh", {})
        elif isinstance(ref, (list, tuple)):
            spec = ref[1]
        return spec.get("fit", {})
    
    
    def _nth(p):
        n = int(round(p))
        return f"{n}{'th' if 10 <= n % 100 <= 20 else {1: 'st', 2: 'nd', 3: 'rd'}.get(n % 10, 'th')}"
    
    
    def proportion_checks(name, c):
        """The model file against its archetype's targets (docs/proportions.md): a summary, and a line per ratio
        outside its range (fails first); then its girths against real people of its height and waist
        (tools/anthro.py), a line for each past the 5th or 95th percentile."""
        import anthro
        import proportions as PR
        path = model_path(name, c)
        m = PR.measure(path)
        arch = c.get("archetype") or PR.best_archetype(m, c.get("sex"))
        t = PR.targets(arch, c.get("sex"))
        want = _fit_of(c)
        t.update({k: tuple(r) for k, r in want.get("ranges", {}).items()})
        t.update({k: tuple(r) for k, r in c.get("ranges", {}).items()})       # the body's own (cast.py CHECK_RANGES)
        head = (c.get("cage") or {}).get("face") or {}
        face = head.get("fit", {}).get("archetype") or head.get("archetype")
        if face:                                            # its face is judged by its face's archetype (tools/heads.py)
            for k in ("eye_frac", "eye_open_CE", "iris_gap_CE", "face_w_CE"):
                t.pop(k, None)
                if k in PR.TARGETS[face]:
                    t[k] = PR.TARGETS[face][k]
        # a face left as VRoid built it (no fit, 2026-10-13) has its ratios against the study's paintings reported, not
        # judged: held to them, faces were stretched and read too sharp from the side
        reported = ("H_CE", "eye_frac", "eye_open_CE", "iris_gap_CE", "face_w_CE") if head and "fit" not in head else ()
        for k in want.get("skip", ()):
            t.pop(k, None)
        for k in ("hand", "foot"):                          # judged against real hands and feet below instead
            if want.get("anthro") and f"{k}_p" not in want.get("skip", ()):
                t.pop(f"{k}_CE", None)
        rows, faces = [], []
        for k, rng in t.items():
            v = m.get(k)
            verdict = PR.judge(v, rng)
            if verdict in ("warn", "FAIL") and k in reported:
                faces.append(dict(verdict="face", text=f"{PR.RATIOS.get(k, k)}: {v:.2f}, the study's {rng[0]:g} to {rng[1]:g}"))
            elif verdict in ("warn", "FAIL"):
                rows.append(dict(verdict=verdict, text=f"{PR.RATIOS.get(k, k)}: {v:.2f}, target {rng[0]:g} to {rng[1]:g}"
                                 + (" (fail)" if verdict == "FAIL" else " (near)")))
        rows.sort(key=lambda r: r["verdict"] != "FAIL")
        n_fail = sum(r["verdict"] == "FAIL" for r in rows)
        judged = [k for k in t if m.get(k) is not None and k not in reported]
        summary = (f"{name}: {arch}, {len(judged) - len(rows)} of {len(judged)} ratios in range"
                   + (f", {n_fail} out" if n_fail else "") + (f", {len(rows) - n_fail} near" if len(rows) > n_fail else ""))
        a = anthro.assess(path, c.get("sex"), name.endswith("_old"))
        am = a.pop("_m")
        who = f"{'women' if c.get('sex') == 'f' else 'men'} {am['stature'] / 100:.2f} m tall with a {am['waist']:.0f} cm waist"
        real = []
        for k, (v, med, pct) in a.items():
            if k == "build":
                continue
            if np.isfinite(pct) and not 5 <= pct <= 95:
                real.append(dict(verdict="real", text=f"Real bodies: {anthro.MEASURES[k][3]}: {v:.1f} cm, the {_nth(pct)} percentile"
                                                      f" of {who} (their median {med:.1f})"))
        rows += real + faces
        if real:
            summary += f"; {len(real)} girths past the 5th to 95th percentile of real bodies"
        m.update({f"real_{k}": v[0] for k, v in a.items()})
        m.update({f"real_{k}_pct": v[2] for k, v in a.items()})
        clean = {k: (None if v is None or not np.isfinite(v) else round(float(v), 4)) for k, v in m.items()
                 if isinstance(v, (int, float, np.floating))}           # JSON has no NaN
        return dict(summary=summary, through=[], touching=[], layers=None, props=rows, measures=clean)
    
    
    def scenery(name):
        p, c = portrait(name, "battle")
        path = f"{OUT}/plains.glb"
        size = export_glb.export(p, dict(vp.PALETTE, **c["colors"]), path, only_world=True)
        wrap_json(path)
        return size
    
    
    def duel_cached():
        """The clash clip for both fighters, solved once per change to what it depends on."""
        src = "".join(open(os.path.join(ROOT, "tools", f)).read() for f in ("duel.py", "rig.py", "checks.py", "poses.py"))
        key = hashlib.sha1((src + repr([CAST[n] for n in ORDER.values()])).encode()).hexdigest()[:16]
        path = os.path.join(CACHE, f"duel_{key}.pkl")
        if os.path.exists(path):
            return pickle.load(open(path, "rb"))
        print("solving the duel (about a minute)...", flush=True)
        res = duel.duel_clips(chars_for(ORDER.values()), ORDER)
        os.makedirs(CACHE, exist_ok=True)
        pickle.dump(res, open(path, "wb"))
        return res
    
    
    def as_list(o):
        return o.tolist() if isinstance(o, np.ndarray) else o
    
    
    if __name__ == "__main__":
        names = sys.argv[1:] or list(LABELS)
        os.makedirs(OUT, exist_ok=True)
        ws = WORKSHOPS.get(SITE)
        clash, place = ({}, {}) if ws else duel_cached()
        cam_path, chk_path = f"{OUT}/camera.json", f"{OUT}/checks.json"
        old = json.load(open(cam_path)) if os.path.exists(cam_path) and sys.argv[1:] else {}
        old_chk = json.load(open(chk_path)) if os.path.exists(chk_path) and sys.argv[1:] else {}
        with ProcessPoolExecutor(4) as ex:
            fc = [ex.submit(character, (n, clash.get(n))) for n in names]
            fs = ex.submit(scenery, names[0]) if not sys.argv[1:] or not os.path.exists(f"{OUT}/plains.glb.json") else None
            built = {r["name"]: r for r in (f.result() for f in fc)}
            if fs:
                print(f"plains.glb {fs.result() / 1e6:.2f} MB")
        for n, r in built.items():
            print(f"{n}.glb {r['size'] / 1e6:.1f} MB")
            print("  " + r["checks"]["summary"])
            if r["checks"]["layers"]:
                print("  " + r["checks"]["layers"]["summary"])
            for item in r["checks"].get("props", []):
                print("    " + {"FAIL": "! ", "real": "· "}.get(item["verdict"], "~ ") + item["text"])
            for item in r["checks"]["through"]:
                print("    ! " + item["text"])
        prev = {c["name"]: c for c in old.get("characters", [])}
        entries = []
        for n in LABELS:                                    # keep the cast order; unbuilt characters as they were
            if n in built:
                r = built[n]
                entries.append(dict(name=n, label=LABELS[n], info=r["info"], cams=r["cams"],
                                    **({"group": CAST[n]["group"]} if CAST[n].get("group") else {})))
            elif n in prev:                                 # as last built, with the cast's current label and group
                e = {k: v for k, v in prev[n].items() if k != "group"}
                e["label"] = LABELS[n]
                if CAST[n].get("group"):
                    e["group"] = CAST[n]["group"]
                entries.append(e)
        cam_battle = entries[0]["cams"]["battle"]
        duel_cam = dict(cam_battle, pivot_px=[cam_battle["w"] // 2, cam_battle["pivot_px"][1]])
        out = dict(characters=entries, duel=dict(order=ORDER, place=place, cam=duel_cam, clip="clash"),
                   lineup=dict(order=[] if ARMORY else [n for n in MOBS if any(e["name"] == n for e in entries)], spacing=0.95))
        if ws:                                              # the page's title and notes; no duel view
            out["page"] = dict(title=ws["title"], eyebrow=ws["eyebrow"], notes=open(ws["notes"]).read(), duel=False,
                               armory=bool(ws.get("armory")))
            if ws.get("armory"):                            # the skin picker: every tone of the range, with its ramp
                import cast
                out["page"]["skins"] = [dict(name=n, label=lab, group=grp, ramp=export_glb.skin_ramp(cast.SKINS[n]))
                                        for grp, tones in SKIN_PICKER for n, lab in tones]
        json.dump(out, open(cam_path, "w"), indent=1, default=as_list)
        chk = dict(old_chk, **{n: r["checks"] for n, r in built.items()})
        json.dump(chk, open(chk_path, "w"), indent=1)
        shutil.copy(os.path.join(HERE, "index.html"), OUT)
        import regress                                      # what changed since the last published version
        for n in built:
            for line in regress.report(n):
                print(line)
        print("->", OUT)
  • Bashcd ~/Projects/lowmarch-fable52 && cat art/cast/cast.py

    command

    cd ~/Projects/lowmarch-fable52 && cat art/cast/cast.py

    result, 31 lines

    <persisted-output>
    Output too large (36.6KB). Full output saved to: [redacted: private path]/tool-results/bfwhuyq9z.txt
    
    Preview (first 2KB):
    """Lowmarch test cast on the VRoid base: model, hair donor, shape controls and colours.
    
    Models live outside the repo (see docs/vroid.md); paths are relative to LOWMARCH_VROID.
    Palette chars: hair A-E (dark->light), eyes r s t (dark->light), coat K L M P (dark->light).
    """
    # common enemies share an army palette: the enemy's dark red cloth, worn leather, dull steel
    MOB_COLORS = dict(A="#2a2420", B="#4a3a30", C="#6e5644", D="#92785e", E="#b89c7e",
                      r="#2a1a12", s="#5a4630", t="#8a7050", K="#3a1418", L="#5e2026", M="#7e2a30", P="#a84848")
    MOB_PAINT = dict(signature="#7b3026", doublet="#3a3330", heraldry="#d8cfc0", leather="#5a3e2a", boot="#3e2c22",
                     glove="#4a3426", steel="#9aa0aa", gold="#a88a4a", hair="#4a3a2e", motif="#d8cfc0",
                     padding="#8a7a62", cloth="#4a4038", wood=dict(kind="leather", base="#6a4a30"),
                     mail=dict(kind="steel", base="#8a909a"), fur=dict(kind="leather", base="#6a5444"), linen="#b8ad94",
                     grain=dict(signature=0.03, padding=0.03, fur=0.10))
    
    # generic units vary in hair, eyes and skin (palette letters: hair A-E dark to light, eyes r s t)
    HAIRS = {"brown": ("#2a1d14", "#4a3424", "#6e5038", "#94704e", "#c09a74"),
             "black": ("#141418", "#24242c", "#383844", "#50505e", "#76768a"),
             "blond": ("#6b4a1e", "#a8782e", "#d4a648", "#ecd07a", "#fbf0c0"),
             "red": ("#3a140c", "#6a2414", "#9a3a1e", "#c45a30", "#e8905a"),
             "grey": ("#3a3a3e", "#5e5e64", "#85858c", "#aeaeb4", "#d8d8dc"),
             "auburn": ("#2e1610", "#52281a", "#7a3e26", "#a05a3a", "#c88a62"),
             "blue": ("#1d2a52", "#2c4a8a", "#3f74c0", "#63a3e0", "#a6d8f6")}
    EYES = {"brown": ("#2a1a12", "#5a3a1c", "#9a7040"), "blue": ("#1a2a4a", "#3a6ab0", "#8ac0ec"),
            "green": ("#12321e", "#2e8a4e", "#9edcae"), "grey": ("#2a2e34", "#5a6470", "#a0aab4"),
            "amber": ("#3a2410", "#8a5a20", "#d8a050")}
    ...
    </persisted-output>