A 3D model pipeline, pushed by GPT-6-Astra
agent (cont.)
+1:05exec_commandsed -n '905,1060p' tools/vroid_portrait.py && sed -n '183,275p' tools/export_glb.py && sed -n '850,900p' tools/cage.py && sed -n '1,60p' art/cast/cast.py && sed -n '240,335p' art/cast/cast.py (+1 more)
command
sed -n '905,1060p' tools/vroid_portrait.py && sed -n '183,275p' tools/export_glb.py && sed -n '850,900p' tools/cage.py && sed -n '1,60p' art/cast/cast.py && sed -n '240,335p' art/cast/cast.py sed -n '218,316p' review/vroid-02/index.html && sed -n '517,550p' review/vroid-02/index.html && sed -n '1690,1735p' review/vroid-02/index.html && rg -n '^def (.*)|pose|reference|bone_pose' tools/clips.py | tail -50 && ls -l /usr/bin/chromium-browser
result, 8 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 10831) Total output lines: 2 {"chunk_id":"9b2298","wall_time_seconds":0.00000434,"exit_code":0,"original_token_count":7233,"output":"class Portrait:\n def __init__(self, path, morphs=None, pose=BUST_POSE, shape=None, hair_from=None, costume=None,\n mouth=\"curve\", world=None, ref_pose=BUST_POSE, hair_trim=None):\n \"\"\"mouth: how the closed mouth is drawn. 'texture' = VRoid's painted lip line, thickened;\n 'texture+lip' = that plus a lower-lip shade; 'drawn' = an FE8-style mouth between the\n projected mouth corners; 'none' = geometry only (the line disappears when closed).\"\"\"\n self.mouth = mouth\n self.v = VRM(path)\n sh = dict(NEUTRAL, **(shape or {}))\n mo = dict(sh[\"rest\"])\n for k_, w_ in (morphs or {}).items():\n mo[k_] = min(1.0, mo.get(k_, 0.0) + w_)\n if sh[\"fangs\"] < 1.0: # some faces' teeth have fangs (sample V's); 0 files them away\n mo[\"Fcl_HA_Short\"] = max(mo.get(\"Fcl_HA_Short\", 0.0), 1.0 - sh[\"fangs\"])\n # everything is built in the reference pose (arms down), then posed through the skeleton\n target_pose = bone_pose(self.v, sh, pose)\n pose = bone_pose(self.v, sh, ref_pose)\n mo, self.mouth_hold = hold_mouth(self.v, mo, pose)\n closure = eye_closure(mo)\n lines = None\n if max(closure.values()) > 0.05 or sh[\"lash\"] != 1.0: # the eyeline open, and how far a shut eye must close\n eyes = {k_: w_ for k_, w_ in mo.items() if \"EYE_\" not in k_ and \"ALL_\" not in k_}\n now = self.v.primitives(mo, pose)\n ln = [i_ for i_, p_ in enumerate(now) if \"FaceEyeline\" in p_[\"material\"]]\n if ln:\n prs = [self.v.primitives(eyes, pose)[ln[0]], now[ln[0]],\n self.v.primitives(dict(eyes, Fcl_EYE_Close=1.0), pose)[ln[0]]]\n eye = eye_lines(prs[0])\n # the character's one lash size: set on the open lash, which every closed lid is moved from\n lines = (ln[0], lash_size(prs[0][\"pos\"].copy(), prs[0][\"uv\"], eye, sh[\"lash\"]), eye, now)\n further = lid_gap(prs[1][\"pos\"], prs[2][\"pos\"], prs[0][\"pos\"], lines[2], prs[0][\"uv\"], prs[0][\"tri\"],\n self.v.material_texture(prs[0][\"mi\"]))\n mo = hide_closed_irises(mo, further if lines else None)\n self.pose_now = target_pose\n self.pose_ref = pose\n self.shape = sh\n self.prims = self.v.primitives(mo, pose)\n if lines: # a closing lid is the model's own open lash, moved\n k_, P_open, eye, now = lines\n p_ = self.prims[k_]\n keep_lash_weight(p_, P_open, p_[\"uv\"], eye, closure)\n lash_size(p_[\"pos\"], p_[\"uv\"], {s_: v_ for s_, v_ in eye.items() if closure[s_] <= 0.05}, sh[\"lash\"])\n keep_lash_fan(self.prims, now, k_, eye, closure)\n for side, (up, others, edge, _) in eye.items(): # a shut eye is one closed lid:\n if closure[side] < 0.9:\n continue\n if others: # its lower line goes,\n p_[\"tri\"] = p_[\"tri\"][~np.isin(p_[\"tri\"], np.concatenate(others)).all(1)]\n m = np.isin(p_[\"tri\"], up).all(1) # and its lash is drawn solid (export_glb.fill_lid):\n self.prims.append(dict(p_, tri=p_[\"tri\"][m], lid_fill=float(p_[\"uv\"][edge, 1].max())))\n p_[\"tri\"] = p_[\"tri\"][~m] # the open lash's pale streaks and hollows read as\n # shine beside an eye, but split a lid over skin\n if hair_from: # swap in another model's hair\n hv = VRM(hair_from)\n hp = hv.primitives(None, ref_pose)\n hroles = [role_of(p[\"material\"]) for p in hp]\n src = landmarks(hp, hroles)\n dst = landmarks(self.prims, [role_of(p[\"material\"]) for p in self.prims])\n k = (abs(dst[\"eyeR\"][0] - dst[\"eyeL\"][0]) / abs(src[\"eyeR\"][0] - src[\"eyeL\"][0])\n + (dst[\"eye_y\"] - dst[\"chin\"][1]) / (src[\"eye_y\"] - src[\"chin\"][1])) / 2\n c_src = (src[\"eyeL\"] + src[\"eyeR\"]) / 2\n c_dst = (dst[\"eyeL\"] + dst[\"eyeR\"]) / 2\n hair = [p for p in hp if \"_HAIR\" in p[\"material\"]]\n for p in hair:\n p[\"pos\"] = c_dst + (p[\"pos\"] - c_src) * k\n n_ = len(p[\"pos\"]) # rides our head bone from here on\n p[\"J\"], p[\"W\"], p[\"jnames\"] = np.zeros((n_, 4), np.int64), np.tile([1.0, 0, 0, 0], (n_, 1)), [\"J_Bip_C_Head\"]\n self.prims = [p for p in self.prims if \"_HAIR\" not in p[\"material\"]] + hair\n self._hair_v = hv\n if hair_trim: # drop hair pieces reaching past |x| = hair_trim (e.g. twin tails)\n self.prims = [p for p in self.prims if \"_HAIR\" not in p[\"material\"]\n or np.abs(p[\"pos\"][np.unique(p[\"tri\"]), 0]).max() <= hair_trim]\n self.roles = [p.get(\"role\") or role_of(p[\"material\"]) for p in self.prims]\n for side, c in eye_closure(mo).items(): # a shut eye shows no white (it can poke between the lids)\n if c < 0.9:\n continue\n for p, r in zip(self.prims, self.roles):\n if r == \"white\" and len(p[\"tri\"]):\n cx = p[\"pos\"][p[\"tri\"]].mean(1)[:, 0]\n p[\"tri\"] = p[\"tri\"][(cx < 0) != (side == \"L\")]\n self.lm = landmarks(self.prims, self.roles)\n if costume: # replace VRoid's clothes with ours\n import outfit\n fit = outfit.Fit(self.v, pose, self.prims, self.roles)\n import rig\n fit.grip = rig.grip_points(self.v, sh, ref_pose) # where each fist closes (weapons sit there)\n keep_ = [k for k, r in enumerate(self.roles) if r != \"cloth\"]\n self.prims = [self.prims[k] for k in keep_]\n self.roles = [self.roles[k] for k in keep_]\n costume = outfit.COSTUMES[costume] if isinstance(costume, str) else costume\n fit.keep_skin = () # a costume may leave skin bare (fit.keep_skin = bones)\n for pc in costume(fit):\n self.prims.append(pc)\n self.roles.append(pc[\"role\"])\n # body skin below the neck is always under clothes in a bust; drop it so it can't poke through\n cy = self.lm[\"chin\"][1]\n from vrm import bone_weight\n for p, r in zip(self.prims, self.roles):\n if r != \"body\":\n continue\n if costume: # keep head, neck and upper chest (the throat shows in the collar opening)\n wv = bone_weight(p, (\"Head\", \"Neck\", \"UpperChest\") + tuple(getattr(fit, \"keep_skin\", ())))\n p[\"tri\"] = p[\"tri\"][(wv[p[\"tri\"]] >= 0.5).all(1)]\n if getattr(fit, \"drop_skin\", None) is not None: # a costume may hide the skin it covers\n p[\"tri\"] = p[\"tri\"][~fit.drop_skin(p)[p[\"tri\"]].all(1)]\n else:\n T = p[\"pos\"][p[\"tri\"]]\n head = T[:, :, 1].min(1) > cy - 0.02\n neck = (T[:, :, 1].min(1) > cy - 0.14) & (np.abs(T[:, :, 0]).max(1) < 0.055)\n p[\"tri\"] = p[\"tri\"][head | neck]\n for pc in world or []: # scenery: does not turn with the character\n self.prims.append(pc)\n self.roles.append(pc[\"role\"])\n # framing uses the unshaped face at the base head size, so head-size changes still show\n self.span = (self.lm[\"eye_y\"] - self.lm[\"chin\"][1]) / sh[\"head\"]\n reshape(self.prims, self.roles, self.lm, sh)\n strip_blush(self.prims, self.roles, self.v, sh[\"blush\"])\n face_lines(self.prims, self.roles, self.v, sh[\"age_lines\"])\n lm_now = landmarks(self.prims, self.roles) # after the sculpt\n names, Wn = self.v.nodes_by_name(), self.v.node_world(pose)\n neck = (Wn[names[\"J_Bip_C_Neck\"]][:3, 3], Wn[names[\"J_Bip_C_Head\"]][:3, 3]) \\\n if \"J_Bip_C_Neck\" in names and \"J_Bip_C_Head\" in names else None\n face_normals(self.prims, self.roles, lm_now, sh[\"face_normals\"], sh[\"hair_normals\"], neck=neck)\n for pc, rl in shadow_cards(self.prims, self.roles, lm_now, sh[\"shadow_cards\"], neck):\n self.prims.append(pc)\n self.roles.append(rl)\n if pose is not target_pose and any(not np.allclose(pose.get(k_, np.eye(4)), target_pose.get(k_, np.eye(4)))\n for k_ in set(pose) | set(target_pose)):\n repose(self.v, [p for p in self.prims if not p.get(\"world\")], pose, target_pose)\n names = self.v.nodes_by_name()\n Wn = self.v.node_world()\n self.eye = (Wn[names[\"J_Adj_L_FaceEye\"]][:3, 3] + Wn[names[\"J_Adj_R_FaceEye\"]][:3, 3]) / 2\n self.chin_y = self.lm[\"chin\"][1]\n self.tex = {}\n for k, p in enumerate(self.prims):\n if self.roles[k] in (\"line\", \"brow\", \"iris\", \"highlight\", \"white\", \"hair\", \"mouth\"):\n src = self._hair_v if (hair_from and \"_HAIR\" in p[\"material\"]) else self.v\n t = src.material_texture(p[\"mi\"])\n if t is not None and self.roles[k] == \"line\":\n # VRoid's upper lid is a thick graded band over the iris; keep its dark core only\n t = t.copy()\n t[..., 3] = np.where(t[..., :3].mean(-1) < LID_CORE, t[..., 3], 0)\n if t is not None:\n self.tex[k] = t\n # painted face marks (lip line, nose) from the face texture, grown so they survive the vote\n from scipy.ndimage import binary_dilation, label\n self.marks = {}\n self.mouth_pts = None\n self.mouth_curve = None\n for k, p in enumerate(self.prims):\n if self.roles[k] != \"face\":\n continue\n t = self.v.material_texture(p[\"mi\"])\n if t is None:\n continue\n th, tw = t.shape[:2]\ndef scene_info(portrait, palette):\n \"\"\"Everything the browser's pixel renderer and cloth solver need besides the meshes: palette\n bands per role, the lights, body colliders, cloth grids and the mouth curve (model space,\n turned to face +z like the GLB).\"\"\"\n import vroid_portrait as vp\n from vrm import bone_weight\n hexp = lambda c: palette[c]\n bands = lambda tbl: [[thr if thr > -5 else -9, hexp(c)] for thr, c in tbl]\n roles = {\"face\": dict(mode=\"bands\", bands=bands(vp.SKIN_BANDS)),\n \"body\": dict(mode=\"bands\", bands=bands(vp.SKIN_BANDS), cap=hexp(\"4\")),\n \"shadow\": dict(mode=\"flat\", color=hexp(\"3\")),\n \"hair\": dict(mode=\"bands\", bands=bands(vp.HAIR_BANDS)),\n \"cloth\": dict(mode=\"bands\", bands=bands(vp.CLOTH_BANDS)),\n \"line\": dict(mode=\"flat\", color=hexp(\"o\")), \"brow\": dict(mode=\"flat\", color=hexp(\"A\")),\n \"mouth\": dict(mode=\"flat\", color=hexp(\"1\")), \"white\": dict(mode=\"flat\", color=hexp(\"w\")),\n \"highlight\": dict(mode=\"flat\", color=hexp(\"w\")),\n \"iris\": dict(mode=\"iris\", colors=[hexp(\"r\"), hexp(\"s\"), hexp(\"t\")], cuts=[0.25, 0.5])}\n for r, tbl in vp.MATERIALS.items():\n roles[r] = dict(mode=\"bands\", bands=bands(tbl), world=r in vp.WORLD_ROLES)\n names = portrait.v.nodes_by_name()\n W = portrait.v.node_world(portrait.pose_now)\n body = [p for p, r in zip(portrait.prims, portrait.roles) if r == \"body\"][0]\n caps = []\n for a, b in CAPSULES:\n if a not in names or b not in names:\n continue\n A, B = W[names[a]][:3, 3], W[names[b]][:3, 3]\n wv = bone_weight(body, (a,))\n pts = body[\"pos\"][wv > 0.5]\n if len(pts) < 8:\n continue\n ab = B - A\n t = np.clip(((pts - A) @ ab) / (ab @ ab), 0, 1)\n d = np.linalg.norm(pts - (A + t[:, None] * ab), axis=1)\n caps.append(dict(a=(A * FLIP).tolist(), b=(B * FLIP).tolist(), r=float(np.percentile(d, 70) + 0.012),\n bones=[a, b]))\n cloth = {}\n for p in portrait.prims:\n if p[\"material\"] in CLOTH and \"grid\" in p:\n trims, band, collide = CLOTH[p[\"material\"]]\n cloth[p[\"material\"]] = dict(u=int(p[\"grid\"][0]), v=int(p[\"grid\"][1]), trims=list(trims), band=band,\n collide=list(collide) if collide else None, closed=bool(p.get(\"closed\")),\n edges=\"hem\" if p[\"material\"] in CLOTH_HEM_ONLY else \"all\")\n curve = None\n if getattr(portrait, \"mouth_curve\", None) is not None:\n face = [p for p, r in zip(portrait.prims, portrait.roles) if r == \"face\"]\n allp = np.concatenate([p[\"pos\"] for p in face])\n alln = np.concatenate([p[\"nrm\"] for p in face])\n from scipy.spatial import cKDTree\n _, i = cKDTree(allp).query(portrait.mouth_curve)\n curve = ((portrait.mouth_curve + alln[i] * 0.0015) * FLIP).tolist()\n marks = None\n if getattr(portrait, \"marks\", None):\n m = next(iter(portrait.marks.values()))\n img = Image.fromarray(np.where(m == 1, 128, 0).astype(np.uint8), \"L\") # nose mark only; the mouth is a line\n b = io.BytesIO()\n img.save(b, \"PNG\", optimize=True)\n import base64\n marks = base64.b64encode(b.getvalue()).decode()\n # painted renderer: a material kind and one base colour per role; the shader builds the ramp\n pc = dict(signature=\"#7d1e2c\", doublet=\"#2a2d3d\", heraldry=\"#dfe2e8\", leather=\"#5f3e2b\", boot=\"#4a3326\", glove=\"#5f3e2b\",\n steel=\"#a6adbb\", gold=\"#b08b3f\", hair=hexp(\"C\"), trim=\"#b08b3f\")\n pc.update(getattr(portrait, \"paint\", None) or {})\n skin = dict(kind=\"skin\", base=pc.get(\"skin\") or \"#f8e1d5\") # light skin unless a tone is set\n skin[\"ramp\"] = skin_ramp(skin[\"base\"]) # its lit, shade and deep shade\n paint = {\"face\": dict(skin), \"body\": dict(skin), \"shadow\": dict(skin, shade=True), # shadow cards: skin in shade\n \"hair\": dict(kind=\"hair\", base=pc[\"hair\"]),\n \"coat\": dict(kind=\"cloth\", base=pc[\"signature\"]), \"cape\": dict(kind=\"cloth\", base=pc[\"signature\"]),\n \"signature\": dict(kind=\"cloth\", base=pc[\"signature\"]), \"doublet\": dict(kind=\"cloth\", base=pc[\"doublet\"]),\n \"cloth\": dict(kind=\"cloth\", base=pc[\"doublet\"]), \"heraldry\": dict(kind=\"cloth\", base=pc[\"heraldry\"]),\n \"leather\": dict(kind=\"leather\", base=pc[\"leather\"]), \"boot\": dict(kind=\"leather\", base=pc[\"boot\"]),\n \"glove\": dict(kind=\"leather\", base=pc[\"glove\"]), \"metal\": dict(kind=\"steel\", base=pc[\"steel\"]),\n \"steel\": dict(kind=\"steel\", base=pc[\"steel\"]), \"gold\": dict(kind=\"gold\", base=pc[\"gold\"]),\n \"grass\": dict(kind=\"world\", base=\"#5a7a3a\"), \"dirt\": dict(kind=\"world\", base=\"#6a4a32\"),\n \"stone\": dict(kind=\"world\", base=\"#7c7a86\"),\n \"motif\": dict(kind=\"cloth\", base=pc.get(\"motif\", \"#3a44a0\"))} # decal paint on steel (tools/plates.py)\n for role, val in pc.items(): # extra roles a cast entry names (cloth unless it says)\n if role not in paint and isinstance(val, str) and val.startswith(\"#\"):\n paint[role] = dict(kind=\"cloth\", base=val)\n elif role not in paint and isinstance(val, dict) and \"base\" in val:\n paint[role] = dict(kind=val.get(\"kind\", \"cloth\"), base=val[\"base\"])\n for role, g in (pc.get(\"grain\") or {}).items(): # optional per-role brush grain (big flat cloth mottles)\n if role in paint:\n paint[role][\"grain\"] = g\n return dict(roles=roles, light=vp.LIGHT.tolist(), sun=vp.SUN.tolist(), capsules=caps, cloth=cloth, face_marks=marks,\n paint=paint,\n mouth_curve=curve, mouth_bone=\"J_Bip_C_Head\", ink=dict(o=hexp(\"o\"), skin=hexp(\"1\"), hair=hexp(\"A\")),\n skin=[hexp(c) for c in \"12345\"], depth_gap=0.012)\n\n\n# ---- skinned export: one rigged character + animation clips --------------------------------------------------------\nF4 = np.diag([-1.0, 1.0, -1.0, 1.0])\n\n if \"fit\" not in spec:\n return spec\n import fit\n k = _key(spec, hair=False) # the hair's collision (collide.py) never moves the body\n try:\n cache = json.load(open(CACHE))\n except (OSError, ValueError):\n cache = {}\n if k not in cache:\n s, _ = fit.fit(spec, log, probe=probe, controls=CONTROLS, head_step=False, rescale=False)\n try:\n cache = json.load(open(CACHE))\n except (OSError, ValueError):\n cache = {}\n cache[k] = s\n os.makedirs(OUT, exist_ok=True)\n tmp = CACHE + f\".{os.getpid()}\"\n json.dump(cache, open(tmp, \"w\"), indent=1, sort_keys=True)\n os.replace(tmp, CACHE)\n return cache[k]\n\n\ndef path_for(name, spec):\n return os.path.join(OUT, f\"{name}_{_key(spec)}.vrm\")\n\n\ndef ensure(name, spec, log=None):\n p = path_for(name, spec)\n if not os.path.exists(p):\n write(p, *build(fitted(copy.deepcopy(spec), log)))\n return p\n\n\nif __name__ == \"__main__\":\n sys.path[:0] = [os.path.join(os.path.dirname(HERE), \"art\", \"cast\")]\n from cast import CAST\n todo = sys.argv[1:] or [n for n, c in CAST.items() if c.get(\"cage\")]\n for name in todo:\n print(name, ensure(name, CAST[name][\"cage\"], print))\n\"\"\"Lowmarch test cast on the VRoid base: model, hair donor, shape controls and colours.\n\nModels live outside the repo (see docs/vroid.md); paths are relative to LOWMARCH_VROID.\nPalette chars: hair A-E (dark->light), eyes r s t (dark->light), coat K L M P (dark->light).\n\"\"\"\n# common enemies share an army palette: the enemy's dark red cloth, worn leather, dull steel\nMOB_COLORS = dict(A=\"#2a2420\", B=\"#4a3a30\", C=\"#6e5644\", D=\"#92785e\", E=\"#b89c7e\",\n r=\"#2a1a12\", s=\"#5a4630\", t=\"#8a7050\", K=\"#3a1418\", L=\"#5e2026\", M=\"#7e2a30\", P=\"#a84848\")\nMOB_PAINT = dict(signature=\"#7b3026\", doublet=\"#3a3330\", heraldry=\"#d8cfc0\", leather=\"#5a3e2a\", boot=\"#3e2c22\",\n glove=\"#4a3426\", steel=\"#9aa0aa\", gold=\"#a88a4a\", hair=\"#4a3a2e\", motif=\"#d8cfc0\",\n padding=\"#8a7a62\", cloth=\"#4a4038\", wood=dict(kind=\"leather\", base=\"#6a4a30\"),\n mail=dict(kind=\"steel\", base=\"#8a909a\"), fur=dict(kind=\"leather\", base=\"#6a5444\"), linen=\"#b8ad94\",\n grain=dict(signature=0.03, padding=0.03, fur=0.10))\n\n# generic units vary in hair, eyes and skin (palette letters: hair A-E dark to light, eyes r s t)\nHAIRS = {\"brown\": (\"#2a1d14\", \"#4a3424\", \"#6e5038\", \"#94704e\", \"#c09a74\"),\n \"black\": (\"#141418\", \"#24242c\", \"#383844\", \"#50505e\", \"#76768a\"),\n \"blond\": (\"#6b4a1e\", \"#a8782e\", \"#d4a648\", \"#ecd07a\", \"#fbf0c0\"),\n \"red\": (\"#3a140c\", \"#6a2414\", \"#9a3a1e\", \"#c45a30\", \"#e8905a\"),\n \"grey\":…831 tokens truncated…,\n \"arm_m_strong\": _head(\"adult\", hair=\"c\", c=0.6, t=0.4),\n \"arm_m_heroic\": _head(\"adult\", hair=\"r\", r=0.6, v=0.4),\n \"arm_m_heavy\": _head(\"heavy\", dict(cheek=0.4), hair=\"x\", x=1),\n \"arm_m_brute\": _head(\"heavy\", dict(jaw=0.8, brow_ridge=0.8), hair=\"t\", t=0.6, x=0.4),\n \"arm_m_old\": _head(\"adult\", dict(brow_ridge=0.8, nose=0.6), hair=\"n\", v=0.6, t=0.4),\n \"arm_m_youth\": _head(\"young\", hair=\"g\", z=0.4, g=0.6),\n \"arm_f_slender\": _head(\"young\", hair=\"j\", j=1),\n \"arm_f_average\": _head(\"generic\", hair=\"a\", a=1),\n \"arm_f_strong\": _head(\"adult\", hair=\"s\", u=1),\n \"arm_f_sexy\": _head(\"adult\", hair=\"u\", q=1), # (faces/face_sexy.vrm, made in VRoid's editor 2026-10-13 from\n # its preset 11, read cuter than this, not sultrier: kept aside)\n \"arm_f_heavy\": _head(\"generic\", dict(cheek=0.4), hair=\"y\", s=0.6, e=0.4),\n \"arm_f_old\": _head(\"adult\", hair=\"w\", m=1),\n}\nHAIR_COLOURS = {\"arm_m_lean\": \"black\", \"arm_m_average\": \"brown\", \"arm_m_strong\": \"black\", \"arm_m_heroic\": \"auburn\",\n \"arm_m_heavy\": \"brown\", \"arm_m_brute\": \"black\", \"arm_m_old\": \"grey\", \"arm_m_youth\": \"blond\",\n \"arm_f_slender\": \"blond\", \"arm_f_average\": \"brown\", \"arm_f_strong\": \"red\", \"arm_f_sexy\": \"black\",\n \"arm_f_heavy\": \"auburn\", \"arm_f_old\": \"grey\"}\nEYE_COLOURS = {\"arm_m_heroic\": \"blue\", \"arm_f_sexy\": \"green\", \"arm_f_slender\": \"blue\", \"arm_m_old\": \"grey\",\n \"arm_f_old\": \"grey\", \"arm_m_youth\": \"amber\"}\nPORTRAIT = { # at rest and age lines: name -> shape extras (tools/vroid_portrait.py)\n \"arm_m_strong\": dict(rest={\"Fcl_BRW_Angry\": 0.4}),\n \"arm_m_heroic\": dict(rest={\"Fcl_BRW_Angry\": 0.25}),\n \"arm_m_brute\": dict(rest={\"Fcl_EYE_Close\": 0.28, \"Fcl_BRW_Angry\": 0.75}),\n # fangs: his teeth have sample V's two fangs (they show in an open mouth); fangs=0 files them away (owner's call)\n \"arm_m_old\": dict(age_lines=0.8, blush=0.0, fangs=1.0, rest={\"Fcl_EYE_Angry\": 0.4, \"Fcl_EYE_Close\": 0.25,\n \"Fcl_BRW_Angry\": 0.5, \"Fcl_MTH_Down\": 0.3}),\n \"arm_f_old\": dict(age_lines=0.6, blush=0.3, rest={\"Fcl_EYE_Close\": 0.22, \"Fcl_MTH_Down\": 0.2}),\n \"arm_f_strong\": dict(rest={\"Fcl_BRW_Angry\": 0.2}),\n}\nARMORY = { # name: (label, sex, its reference, cage spec beyond base and ref)\n \"arm_m_lean\": (\"Man, lean\", \"m\", \"ref_m_lean\", dict(relax=4)),\n \"arm_m_average\": (\"Man, average\", \"m\", \"ref_m_average\", dict(relax=4)),\n \"arm_m_strong\": (\"Man, strong\", \"m\", \"ref_m_strong\", dict(relax=4, forms=CAGE_STRONG_FORMS)),\n \"arm_m_heroic\": (\"Man, heroic\", \"m\", \"ref_m_heroic\", dict(relax=4, forms=CAGE_HEROIC_FORMS)),\n \"arm_m_heavy\": (\"Man, heavy\", \"m\", \"ref_m_heavy\", dict(relax=4, forms=CAGE_HEAVY_FORMS)),\n \"arm_m_brute\": (\"Man, brute\", \"m\", \"ref_m_brute\", dict(wrap_sigma=(0.02, 0.035), relax=4, forms=CAGE_BRUTE_FORMS)),\n \"arm_m_old\": (\"Man, old\", \"m\", \"ref_m_old\", dict(relax=4)),\n \"arm_m_youth\": (\"Man, youth\", \"m\", \"ref_m_youth\", dict(relax=4)),\n \"arm_f_slender\": (\"Woman, slender\", \"f\", \"ref_f_slender\", dict(relax=4, bust_shape=dict(spread=0.008, drop=0.005, flat=0.25))),\n \"arm_f_average\": (\"Woman, average\", \"f\", \"ref_f_average\", dict(relax=4, bust_shape=dict(spread=0.005, drop=0.008, flat=0.3))),\n \"arm_f_strong\": (\"Woman, strong\", \"f\", \"ref_f_strong\", dict(relax=4, bust=0.1, forms=CAGE_STRONG_F_FORMS,\n bust_shape=dict(spread=0.006, drop=0.006, flat=0.35))),\n \"arm_f_sexy\": (\"Woman, sexy\", \"f\", \"ref_f_sexy\", dict(relax=4, bust=0.2, bust_shape=dict(scale=0.3, inflate=0.025, low=0.02, drop=0.025,\n spread=0.006, flat=0.4))),\n \"arm_f_heavy\": (\"Woman, heavy\", \"f\", \"ref_f_heavy\", dict(relax=4, bust=0.3, forms=CAGE_HEAVY_F_FORMS,\n bust_shape=dict(scale=0.2, inflate=0.025, low=0.025, splay=0.015,\n drop=0.03, spread=0.006, flat=0.45, base=0.1))),\n \"arm_f_old\": (\"Woman, old\", \"f\", \"ref_f_old\", dict(relax=4, bust_shape=dict(spread=0.006, drop=0.015, flat=0.4))),\n}\n\nCAST = {\n \"aldric\": dict( # young lord\n model=\"hairsample_male/HairSample_Male.vrm\", hair=\"sakurada_fumiriya/Sakurada Fumiriya.vrm\",\n # heroic proportions after the study's lord: about 7.4 heads (smaller head, longer legs), broad\n # shoulders and chest over a narrower waist, thicker neck and limbs\n shape=dict(eye=1.14, head=0.93, neck=1.14, chest=1.10, shoulders=1.28, arms=1.10, torso=1.06,\n legs=1.06, leg_len=1.05, hands=1.06),\n colors=dict(A=\"#1d2a52\", B=\"#2c4a8a\", C=\"#3f74c0\", D=\"#63a3e0\", E=\"#a6d8f6\",\n r=\"#21183a\", s=\"#3b6ab0\", t=\"#86c0ec\", K=\"#4a2030\", L=\"#7a2e3c\", M=\"#a8444e\", P=\"#d8747a\",\n U=\"#161a38\", V=\"#26305e\", W=\"#3c4c8e\", X=\"#6a7cc4\"),\n costume=\"lord\",\n # painted renderer: one signature cloth hue, neutral steel and brown leather (Unicorn Overlord\n # study: two or three hues at most; gold only for royalty and only as small accents)\n paint=dict(signature=\"#7d1e2c\", doublet=\"#2a2d3d\", heraldry=\"#dfe2e8\", leather=\"#5f3e2b\", boot=\"#4a3326\",\n glove=\"#5f3e2b\", steel=\"#a6adbb\", gold=\"#b08b3f\", hair=\"#3c6db3\")),\n \"elaine\": dict( # knight-princess, swordswoman (the user's brief: a blonde swordswoman like Saber)\n # the sample's hair cards are all dropped (hair_trim < 0): her hair is built by tools/hair.py\n model=\"hairsample_female/HairSample_Female.vrm\", hair=None, hair_trim=-1,\n shape=dict(head=0.95, leg_len=1.04, shoulder_w=0.008, rest={\"Fcl_BRW_Angry\": 0.35}),\n colors=dict(A=\"#6b4a1e\", B=\"#a8782e\", C=\"#d4a648\", D=\"#ecd07a\", E=\"#fbf0c0\",\n r=\"#12321e\", s=\"#2e8a4e\", t=\"#9edcae\", K=\"#18224f\", L=\"#24398a\", M=\"#3556b8\", P=\"#6f8fe0\",\n Q=\"#0f111b\", R=\"#1b1e2c\", S=\"#2a2e42\", T=\"#41465e\"),\n costume=\"knight_dress\",\n paint=dict(signature=\"#2a4aa6\", doublet=\"#1d2133\", heraldry=\"#eef0f5\", leather=\"#5a3d2b\", boot=\"#4a3326\",\n glove=\"#5a3d2b\", steel=\"#b7bfcc\", gold=\"#c9a34a\", hair=\"#e2bf62\", grain=dict(signature=0.015))),\n # benchmark only, NOT FOR THE GAME (Saber is Type-Moon's): a fidelity test of the outline-plate kit on\n # Elaine's base. The game's characters are original designs.\n \"saber\": dict(\n model=\"hairsample_female/HairSample_Female.vrm\", hair=None, hair_trim=0.12,\n shape=dict(head=0.95, leg_len=1.04, shoulder_w=0.008, rest={\"Fcl_BRW_Angry\": 0.35}),\n colors=dict(A=\"#6b4a1e\", B=\"#a8782e\", C=\"#d4a648\", D=\"#ecd07a\", E=\"#fbf0c0\",\n r=\"#12321e\", s=\"#2e8a4e\", t=\"#9edcae\", K=\"#18224f\", L=\"#24398a\", M=\"#3556b8\", P=\"#6f8fe0\",\n"} {"chunk_id":"1a10bd","wall_time_seconds":0.000006111,"exit_code":0,"original_token_count":2976,"output":"<script type=\"importmap\">\n{ \"imports\": { \"three\": \"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js\",\n \"three/addons/\": \"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/\" } }\n</script>\n<script type=\"module\">\nimport * as THREE from \"three\";\nimport { OrbitControls } from \"three/addons/controls/OrbitControls.js\";\nimport { GLTFLoader } from \"three/addons/loaders/GLTFLoader.js\";\n\nconst $ = id => document.getElementById(id);\nconst statusEl = $(\"status\");\nconst params = new URLSearchParams(location.search);\nconst SHEET = params.get(\"sheet\"); // a character's name, or \"duel\": render a check sheet\nlet CAM;\ntry { CAM = await (await fetch(\"camera.json\")).json(); }\ncatch (e) { statusEl.textContent = \"Couldn't load camera.json. Open this page from its published link.\"; throw e; }\n\nconst GROUP_LABELS = { body: \"Body\", hair: \"Hair\", tunic: \"Tunic\", tails: \"Tails\", belt: \"Belt\", trousers: \"Trousers / tights\",\n boots: \"Boots\", gloves: \"Gloves\", collar: \"Collar\", pauldron: \"Shoulder plates\", cape: \"Cape\", trim: \"Gold trim\",\n doublet: \"Doublet\", plate: \"Plate\", tabard: \"Tabard\", mantle: \"Mantle\", shield: \"Shield\", dress: \"Dress\",\n sword: \"Sword\", weapon: \"Weapon\", helmet: \"Helmet\", hood: \"Hood\", padding: \"Padded coat\", mail: \"Mail\",\n terrain: \"Ground\" };\nconst COSTUME = new Set([\"tunic\", \"tails\", \"belt\", \"trousers\", \"boots\", \"gloves\", \"collar\", \"pauldron\", \"cape\", \"trim\",\n \"doublet\", \"plate\", \"tabard\", \"mantle\", \"shield\", \"dress\", \"helmet\", \"hood\", \"padding\", \"mail\"]);\n// role ids for the info pass (features 4-9 get no inner lines; hair 3 and 11 shade the forehead)\nconst ROLE_ID = { face: 1, body: 2, hair: 3, line: 4, iris: 5, white: 6, highlight: 7, brow: 8, mouth: 9, cloth: 10, hair_b: 11 };\nlet nextRole = 12;\nconst roleId = r => (ROLE_ID[r] ??= nextRole++);\nconst VIEW_YAW = { duel: 0, battle: 60, bust: 30, lineup: 20, compare: 0 };\nconst state = { view: \"duel\", who: CAM.characters[0].name, yaw: 0, mode: \"painted\", skin: \"\", toon: true, xray: false, hidden: new Set(),\n cloth: true, wind: false, playing: false, stepped: false, clip: \"clash\", pose: \"out\", compare: [], motion: \"still\",\n physics: true };\nconst charDef = name => CAM.characters.find(c => c.name === name);\n// a workshop page (camera.json \"page\"): its own title and notes, and no duel\nconst PAGE = CAM.page || null;\nconst NO_DUEL = PAGE?.duel === false;\nif (PAGE) {\n document.title = `${PAGE.title} · Lowmarch`;\n document.querySelector(\".brand .eyebrow\").textContent = PAGE.eyebrow || \"Lowmarch\";\n document.querySelector(\".brand h1\").textContent = PAGE.title;\n if (PAGE.notes) document.querySelector(\"#panel section ul\").innerHTML = PAGE.notes;\n}\n// the armory: bodies compared side by side (the Compare view) in three poses, instead of clips and a lineup\nconst ARMORY_PAGE = !!PAGE?.armory;\nconst MAX_COMPARE = 6;\nif (ARMORY_PAGE) {\n $(\"compareBtn\").hidden = false; $(\"poseSeg\").hidden = false; $(\"clipSeg\").hidden = true; $(\"lineupBtn\").hidden = true;\n $(\"motionSeg\").hidden = false;\n if (PAGE.skins && PAGE.skins.length) { // skin picker: try any tone of the range on the bodies shown\n const sel = $(\"skinSel\");\n sel.append(new Option(\"Skin: as built\", \"\"));\n for (const g of [...new Set(PAGE.skins.map(s => s.group))]) {\n const og = document.createElement(\"optgroup\"); og.label = g;\n PAGE.skins.filter(s => s.group === g).forEach(s => og.append(new Option(s.label, s.name)));\n sel.append(og);\n }\n if (PAGE.skins.some(s => s.name === params.get(\"skin\"))) state.skin = params.get(\"skin\"); // ?skin=<tone>\n sel.value = state.skin || \"\";\n sel.hidden = false;\n sel.addEventListener(\"change\", () => { state.skin = sel.value; });\n }\n if ([\"still\", \"bounce\", \"twist\"].includes(params.get(\"motion\"))) state.motion = params.get(\"motion\");\n state.compare = (params.get(\"compare\") || \"\").split(\",\").filter(n => charDef(n)).slice(0, MAX_COMPARE);\n if (!state.compare.length) state.compare = CAM.characters.slice(0, 2).map(c => c.name);\n if ([\"up\", \"out\", \"down\"].includes(params.get(\"pose\"))) state.pose = params.get(\"pose\");\n}\nif (NO_DUEL) {\n document.querySelector('[data-view=\"duel\"]').hidden = true;\n document.querySelector('[data-clip=\"clash\"]').hidden = true;\n state.clip = \"idle\";\n}\n\nconst hex = h => { // raw palette value, no colour-space conversion\n const n = parseInt(h.slice(1), 16);\n return new THREE.Color().setRGB((n >> 16 & 255) / 255, (n >> 8 & 255) / 255, (n & 255) / 255, THREE.LinearSRGBColorSpace);\n};\nconst rawTex = t => { if (!t) return null; const c = t.clone(); c.colorSpace = THREE.NoColorSpace; c.needsUpdate = true; return c; };\nconst gradient = (() => {\n const d = new Uint8Array([70, 70, 70, 255, 140, 140, 140, 255, 205, 205, 205, 255, 255, 255, 255, 255]);\n const t = new THREE.DataTexture(d, 4, 1, THREE.RGBAFormat); t.minFilter = t.magFilter = THREE.NearestFilter; t.needsUpdate = true; return t;\n})();\nconst white = (() => { const t = new THREE.DataTexture(new Uint8Array([255, 255, 255, 255]), 1, 1, THREE.RGBAFormat); t.needsUpdate = true; return t; })();\n\n// ---- scene and camera -----------------------------------------------------------------------------------------------\nconst scene = new THREE.Scene();\nconst hemi = new THREE.HemisphereLight(0xfff6ee, 0x3a3450, 1.35);\nconst sun = new THREE.DirectionalLight(0xffffff, 1.6);\nscene.add(hemi, sun);\nconst camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0.1, 40);\n\n// ---- shaders --------------------------------------------------------------------------------------------------------\nconst SKIN_HEAD = `#include <common>\n #include <skinning_pars_vertex>`;\nconst SKIN_BODY = `#include <beginnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <begin_vertex>\n #include <skinning_vertex>`;\nconst PAINT_VS = `${SKIN_HEAD}\nconst PAINT_COMP = `\n uniform sampler2D tColor; uniform sampler2D tInfo; uniform sampler2D tDepth; uniform vec2 uRes;\n uniform float uNear; uniform float uFar; uniform float uGap; uniform float uSil; uniform float uInner; uniform float uPpm;\n ${HSV}\n float z(vec2 p) { return uNear + texture2D(tDepth, p).x * (uFar - uNear); }\n int rid(vec4 i) { return int(i.r * 255.0 + 0.5); }\n float pid(vec4 i) { return floor(i.g * 255.0 + 0.5) + floor(i.b * 255.0 + 0.5) * 256.0; }\n vec3 ink(vec3 c) { vec3 h = rgb2hsv(c); return hsv2rgb(vec3(h.x, clamp(h.y, 0.20, 0.45), 0.19)); }\n // How far (px) the mouth's opening runs from this pixel in direction d (2 px steps, up to 128 px).\n float mouthRun(vec2 uv, vec2 d) {\n float n = 0.0;\n for (int s = 1; s <= 64; s++) { vec4 a = texture2D(tInfo, uv + d * float(2 * s)); if (a.a < 0.5 || rid(a) != 9) break; n += 2.0; }\n return n;\n }\n // Brows drawn over the bangs: where hair lies just above or below the stroke, the brow is seen through the hair,\n // so it takes some of the hair's colour and doesn't sit on it like a sticker.\n vec3 browOverHair(vec2 uv, vec2 px, vec3 col) {\n float d = 3.5 * uSil;\n vec4 a = texture2D(tInfo, uv + vec2(0.0, d) * px), b = texture2D(tInfo, uv - vec2(0.0, d) * px);\n bool ha = a.a > 0.5 && (rid(a) == 3 || rid(a) == 11), hb = b.a > 0.5 && (rid(b) == 3 || rid(b) == 11);\n if (!(ha || hb)) return col;\n vec3 hc = ha ? texture2D(tColor, uv + vec2(0.0, d) * px).rgb : texture2D(tColor, uv - vec2(0.0, d) * px).rgb;\n return mix(col, hc * 0.80, ha && hb ? 0.68 : 0.34);\n }\n void main() {\n vec2 uv = gl_FragCoord.xy / uRes, px = 1.0 / uRes;\n vec4 inf = texture2D(tInfo, uv);\n if (inf.a < 0.5) { // outer line: grow the silhouette outward\n vec4 best = vec4(0.0); vec2 bq = uv;\n for (int k = 0; k < 12; k++) {\n float a = float(k) * 0.5236;\n for (int s = 1; s <= 2; s++) {\n vec2 q = uv + vec2(cos(a), sin(a)) * uSil * float(s) * 0.5 * px;\n vec4 ni = texture2D(tInfo, q);\n$(\"play\").addEventListener(\"click\", e => { state.playing = !state.playing; e.currentTarget.setAttribute(\"aria-pressed\", String(state.playing)); });\nnew ResizeObserver(() => size()).observe(stageEl);\n\nlet last = performance.now(), simT = 0;\nconst reduceMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\nfunction frame(now) {\n const dt = Math.min(0.05, Math.max(0.001, (now - last) / 1000)); last = now;\n ctl.update();\n const cs = active();\n if (cs.length) {\n if (state.playing) setYaw(state.yaw + dt * (reduceMotion ? 20 : 70));\n animate(dt);\n scene.updateMatrixWorld(true);\n if (state.physics && !SHEET) { // spring bones at a fixed 120 Hz, as the cloth\n const steps = Math.max(1, Math.round(dt / (1 / 120)));\n for (const c of cs) if (c.springs && c.springs.length) for (let s = 0; s < steps; s++) stepSprings(c, dt / steps);\n }\n const cloths = cs.flatMap(c => c.cloths);\n if (state.cloth && cloths.length) {\n const steps = Math.max(1, Math.round(dt / (1 / 120)));\n for (let s = 0; s < steps; s++) { simT += dt / steps; cloths.forEach(c => c.step(dt / steps, simT)); }\n cloths.forEach(c => c.write());\n }\n render();\n placeTags();\n }\n requestAnimationFrame(frame);\n}\n\nif (!LINEUP.order.length) $(\"lineupBtn\").hidden = true;\n// a check for scripts (?springprobe): after a few seconds of the motion, each body's widest spring-bone swing (degrees)\nif (params.has(\"springprobe\")) setTimeout(() => {\n document.title = \"springs \" + JSON.stringify(Object.fromEntries(active().map(c => [c.name, +(c.springMax || 0).toFixed(1)])));\n}, 4000);\nif (SHEET) {\n runSheet(SHEET).catch(e => { console.error(e); $(\"sheetOut\").textContent = \"error: \" + e; document.title = \"sheet failed\"; });\n} else {\n if (window.innerWidth > 1100) setPanel(true);\n loadChecks();\n const v0 = params.get(\"view\"), w0 = params.get(\"who\"), m0 = params.get(\"mode\");\n if (w0 && charDef(w0)) state.who = w0;\n if (m0 === \"3d\") document.querySelector('[data-mode=\"3d\"]').click();\n const views = ARMORY_PAGE ? [\"battle\", \"bust\", \"compare\"] : NO_DUEL ? [\"battle\", \"bust\", \"lineup\"] : [\"duel\", \"battle\", \"bust\", \"lineup\"];\n await setView(views.includes(v0) ? v0 : ARMORY_PAGE ? \"compare\" : NO_DUEL ? \"lineup\" : \"duel\", params.get(\"clip\") || undefined);\n if (params.has(\"yaw\")) setYaw(+params.get(\"yaw\") || 0); // ?yaw=180: open turned (the backs)\n requestAnimationFrame(frame);\n1:\"\"\"Battle animation clips, authored as a few key poses and finished with the rig tools (feet\n4: clips(vrm, shape, stance) -> {name: [(time, pose), ...]}\n8:import poses as P\n14:def clips(vrm, shape=None, stance=\"sword\"):\n23: def finish(pose, lead=0.0, blade=None):\n24: pose = rig.leg_ik(pose, \"L\", foot[\"L\"] + step * lead)\n25: pose = rig.leg_ik(pose, \"R\", foot[\"R\"])\n27: pose = rig.aim(pose, \"J_Bip_R_Hand\", BLADE, blade)\n28: return pose\n41:def fists(rig):\n42: \"\"\"Where each fist closes in the reference pose: the point a held weapon's shaft runs through, as\n75:def sink(t):\n85:def guard_at(t):\n94:def polearm(vrm, shape=None, keys=None):\n105: ref = dict(ref_pose=P.BUST, fist_R=f[\"R\"], fist_L=f[\"L\"])\n113: pose = P.merge(base, {\n119: pose = rig.leg_ik(pose, \"L\", foot[\"L\"] + np.array([-0.07, 0, -0.14 - lead]))\n120: pose = rig.leg_ik(pose, \"R\", foot[\"R\"] + np.array([0.06, 0, 0.12]), pole=(0, -0.2, -1))\n122: fr = rig.pos(pose, \"J_Bip_R_UpperArm\") + span[\"R\"] * np.asarray(fist, float)\n124: q = fr - rig.pos(pose, \"J_Bip_L_UpperArm\")\n128: pose = clear_grip(rig, body, pose, \"R\", ref, fr, D, (0.6, -0.4, 0.7))\n129: return clear_grip(rig, body, pose, \"L\", ref, fr + D * t, D, (-0.8, -1.0, 0.1))\n133: idle.append((IDLE_LOOP, idle[0][1])) # the loop closes on its first pose\n-rwxr-xr-x 1 nobody nogroup 2408 Sep 18 2020 /usr/bin/chromium-browser\n"}exec_commandrg --files ~/.local/share/lowmarch/trials/combined-2026-10-31 | rg '(slender|strong).*png$' | tail -15 && cat tools/clips.py | head -42 && sed -n '1034,1110p' tools/outfit.py && sed -n '299,332p' tools/mobs.py && sed -n '380,460p' tools/export_glb.py (+1 more)
command
rg --files ~/.local/share/lowmarch/trials/combined-2026-10-31 | rg '(slender|strong).*png$' | tail -15 && cat tools/clips.py | head -42 && sed -n '1034,1110p' tools/outfit.py && sed -n '299,332p' tools/mobs.py && sed -n '380,460p' tools/export_glb.py PYTHONDONTWRITEBYTECODE=1 python3 - <<'PY' import sys,os sys.path[:0]=['tools','art/cast'] import cage from cast import CAST for name in ['arm_f_strong','arm_f_slender','arm_m_youth']: p=cage.path_for(name,CAST[name]['cage']);print(name,p,os.path.exists(p)) PY
result, 4 lines
Script completed Wall time 0.3 seconds Output: {"chunk_id":"fe06c8","wall_time_seconds":0.00000465,"exit_code":0,"original_token_count":3010,"output":"~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/lip_E/painted_arm_m_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/lip_E/painted_arm_f_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/lip_E/painted_arm_f_slender.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/surprised/painted_arm_m_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/sad/painted_arm_f_slender.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/surprised/painted_arm_f_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/sad/painted_arm_m_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/surprised/painted_arm_f_slender.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/sad/painted_arm_f_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/smile/painted_arm_m_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/smile/painted_arm_f_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/smile/painted_arm_f_slender.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/lip_A/painted_arm_f_slender.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/lip_A/painted_arm_f_strong.png\n~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/lip_A/painted_arm_m_strong.png\n\"\"\"Battle animation clips, authored as a few key poses and finished with the rig tools (feet\nplanted or stepped with leg IK, the sword aimed by direction rather than by wrist angles).\n\n clips(vrm, shape, stance) -> {name: [(time, pose), ...]}\n\"\"\"\nimport numpy as np\n\nimport poses as P\nfrom rig import Rig\n\nBLADE = (0, 0, -1) # the sword's blade in the right hand's frame (see outfit.sword)\n\n\ndef clips(vrm, shape=None, stance=\"sword\"):\n \"\"\"stance: \"sword\" (one hand, the cast's default) or \"polearm\" (both hands, see polearm()).\"\"\"\n if stance == \"polearm\":\n return polearm(vrm, shape)\n rig = Rig(vrm, shape)\n idle = P.BATTLE_IDLE\n foot = {s: rig.pos(idle, f\"J_Bip_{s}_Foot\") for s in \"LR\"}\n step = np.array([0.0, 0.0, -0.36]) # the lead (left) foot steps forward\n\n def finish(pose, lead=0.0, blade=None):\n pose = rig.leg_ik(pose, \"L\", foot[\"L\"] + step * lead)\n pose = rig.leg_ik(pose, \"R\", foot[\"R\"])\n if blade is not None:\n pose = rig.aim(pose, \"J_Bip_R_Hand\", BLADE, blade)\n return pose\n\n wind = finish(P.WIND_UP, 0.0, blade=(0.15, 0.55, 1.0)) # blade back over the shoulder\n slash = finish(P.SLASH, 1.0, blade=(0.1, -0.55, -1.0)) # forward and down through the target\n follow = finish(P.FOLLOW, 1.0, blade=(-0.45, -1.0, -0.15)) # carried down across the body\n breathe = finish(P.IDLE_BREATH, 0.0)\n return {\n \"idle\": [(0.0, idle), (0.9, breathe), (1.8, idle)],\n \"attack\": [(0.0, idle), (0.32, wind), (0.44, wind), (0.56, slash), (0.68, follow), (1.05, follow),\n (1.5, idle)],\n }\n\n\ndef fists(rig):\n \"\"\"Where each fist closes in the reference pose: the point a held weapon's shaft runs through, as\ndef lord_tunic(fit):\n \"\"\"The first lord costume, head to toe: tunic, tails, belt, trousers, boots, gloves, a standing collar,\n shoulder plates on the near (left) shoulder over a cape clasped at the collarbones, gold trim,\n and a sword in the right hand.\"\"\"\n B = fit.bone\n nk, hips = B[\"J_Bip_C_Neck\"], B[\"J_Bip_C_Hips\"]\n knee = B[\"J_Bip_L_LowerLeg\"][1]\n out = []\n\n def cuff_plane(side):\n a, h = B[f\"J_Bip_{side}_LowerArm\"], B[f\"J_Bip_{side}_Hand\"]\n n = (h - a) / np.linalg.norm(h - a)\n return n, n @ (h - n * 0.025)\n\n torso = (\"Spine\", \"Chest\", \"UpperChest\", \"Shoulder\", \"UpperArm\", \"LowerArm\", \"Neck\", \"Hips\")\n tunic = wrap(fit, \"tunic\", \"coat\", torso, offset=0.009, exclude=(\"UpperLeg\",),\n y_min=hips[1] - 0.03, y_max=nk[1] + 0.012, hems=[cuff_plane(\"L\"), cuff_plane(\"R\")])\n trousers = wrap(fit, \"trousers\", \"leather\", (\"Hips\", \"UpperLeg\", \"LowerLeg\"), offset=0.008,\n y_max=hips[1] + 0.02, subdiv=1)\n boots = wrap(fit, \"boots\", \"boot\", (\"LowerLeg\", \"Foot\", \"ToeBase\"), offset=0.017, y_max=knee - 0.07,\n subdiv=1, hems=[((0, 1, 0), knee - 0.075)])\n gloves = wrap(fit, \"gloves\", \"glove\", (\"Hand\", \"Thumb\", \"Index\", \"Middle\", \"Ring\", \"Little\"),\n offset=0.0028, min_w=0.6, smooth=4)\n out += [p for p in (tunic, trousers, boots, gloves) if p is not None]\n under = merge_surfaces((tunic[\"pos\"], tunic[\"tri\"]), (fit.pos, fit.tri))\n\n for side in (\"L\", \"R\"):\n hand, shin = B[f\"J_Bip_{side}_Hand\"], B[f\"J_Bip_{side}_LowerLeg\"]\n out.append(loop_trim(f\"cuff_trim_{side}\", \"gold\", tunic, lambda P, h=hand: -np.linalg.norm(P.mean(0) - h), width=0.010))\n out.append(loop_trim(f\"boot_trim_{side}\", \"leather\", boots, lambda P, f=shin: -np.linalg.norm(P.mean(0) - f),\n width=0.016, lift=0.003))\n pl = slice_line(tunic, 0, 0.0, keep=lambda p: p[2] < hips[2] - 0.02 and hips[1] + 0.06 < p[1] < nk[1] - 0.02)\n if len(pl) > 3:\n out.append(inherit(ribbon(\"placket\", \"gold\", pl, width=0.009, lift=0.0015, normals=near_normals(tunic, pl)), tunic))\n\n # waist first: belt over the tunic, tails tucked under it\n b, buckle = belt(fit, \"belt\", \"leather\", under, hips[1] + 0.035)\n out.append(b)\n out.append(fit.bind(box(\"buckle\", \"gold\", buckle + [0, 0, -0.006], ((1, 0, 0), (0, 1, 0), (0, 0, 1)),\n (0.02, 0.021, 0.004)), rigid=\"J_Bip_C_Hips\"))\n # the tails settle against the hips and legs only: colliding with the hanging sleeves held them out\n hip_skin = fit.tris_for((\"Hips\", \"UpperLeg\", \"Spine\"), min_w=0.5)\n legs = merge_surfaces((trousers[\"pos\"], trousers[\"tri\"]), (fit.pos, hip_skin))\n tl, tgrid = tails(fit, \"tails\", \"coat\", legs, y_top=hips[1] + 0.025)\n out.append(tl)\n out.append(inherit(ribbon(\"tails_hem\", \"gold\", tgrid[:, -1], width=0.011, lift=0.002,\n normals=near_normals(tl, tgrid[:, -1])), tl))\n\n # cape first, then the plates over it\n behind = merge_surfaces((tunic[\"pos\"], tunic[\"tri\"]), (tl[\"pos\"], tl[\"tri\"]), (b[\"pos\"], b[\"tri\"]), (fit.pos, fit.tri))\n cp, grid = cape(fit, \"cape\", \"cape\", behind)\n out.append(cp)\n for nm, line, w in ((\"cape_trim\", grid[:, 0], 0.009), (\"cape_hem\", grid[:, -1], 0.012),\n (\"cape_edge0\", grid[0], 0.009), (\"cape_edge1\", grid[-1], 0.009)):\n out.append(inherit(ribbon(nm, \"gold\", line, width=w, lift=0.002, normals=near_normals(cp, line)), cp))\n for k, edge in enumerate((grid[0], grid[-1])):\n out.append(fit.bind(ball(f\"clasp{k}\", \"gold\", edge[0] + (edge[0] - nk) * 0.04, 0.012, squash=(1, 1, 0.5)),\n rigid=\"J_Bip_C_UpperChest\"))\n over = merge_surfaces((tunic[\"pos\"], tunic[\"tri\"]), (cp[\"pos\"], cp[\"tri\"]))\n plates, rims = pauldron(fit, \"pauldron\", \"metal\", over, side=\"L\")\n out += plates\n for k, (pc, rim) in enumerate(zip(plates, rims)):\n out.append(inherit(ribbon(f\"pauldron_trim{k}\", \"gold\", rim, width=0.006, lift=0.001,\n normals=near_normals(pc, rim)), pc))\n\n col, rim, fronts = collar(fit, \"collar\", \"coat\")\n out.append(col)\n out.append(inherit(ribbon(\"collar_trim\", \"gold\", rim, width=0.007, lift=0.001, normals=near_normals(col, rim)), col))\n for k, edge in enumerate(fronts):\n out.append(inherit(ribbon(f\"collar_edge{k}\", \"gold\", edge, width=0.006, lift=0.001,\n normals=near_normals(col, edge)), col))\n\n out += sword(fit, \"R\")\n return [p for p in out if p is not None]\n\n\ndef lord(fit):\ndef witch(fit):\n \"\"\"A caster: a long robe with bell sleeves and a gold border, a sash, a tall pointed hat, a staff.\"\"\"\n B = fit.bone\n hips = B[\"J_Bip_C_Hips\"]\n out, shirt, trousers, boots = _base(fit, shirt=\"cloth\", legs=\"cloth\", boots=\"boot\")\n under = Surface(*O.without(shirt, (\"Shoulder\", \"UpperArm\", \"LowerArm\", \"Hand\")))\n out += G.robe(fit, under, role=\"signature\", split=14.0)\n rob = merge_surfaces(*[(p[\"pos\"], p[\"tri\"]) for p in out if p[\"material\"] == \"OUTFIT_robe\"])\n sash, front = O.belt(fit, \"sash\", \"gold\", rob, hips[1] + 0.06, height=0.03, offset=0.006)\n out.append(sash)\n out += G.witch_hat(fit)\n out += G.staff(fit)\n return out\ndef export_skinned(portrait, palette, path, clips=None, max_tex=512):\n \"\"\"The character in its reference pose as a skinned glTF: the VRoid skeleton (with our bone\n scales) drives the body, face, hair and every costume piece through the weights they carry.\n clips: {name: [(time, pose dict), ...]} -> glTF animations (rotation, plus translation where a\n pose moves a bone). Scenery is left out (export it with export()).\"\"\"\n import vroid_portrait as vp\n v = portrait.v\n nodes_v = v.j[\"nodes\"]\n names = v.nodes_by_name()\n parent = v.parents()\n used = set()\n for p in portrait.prims:\n if \"jnames\" in p and not p.get(\"world\"):\n used.update(n for n in p[\"jnames\"] if n in names)\n joints = set()\n for nm in used: # every used bone plus its ancestors\n i = names[nm]\n while i is not None and i not in joints:\n joints.add(i)\n i = parent.get(i)\n order = sorted(joints)\n jidx = {nodes_v[i].get(\"name\"): k for k, i in enumerate(order)}\n ref = portrait.pose_ref\n local_ref = {i: F4 @ v.local_matrix(i, ref) @ F4 for i in order}\n world_ref = {}\n\n def wref(i):\n if i not in world_ref:\n world_ref[i] = (wref(parent[i]) @ local_ref[i]) if parent.get(i) in joints else local_ref[i]\n return world_ref[i]\n\n # glTF assembly (reuses the static exporter's buffer helpers by building a fresh document)\n bin_ = bytearray()\n views, accessors, meshes, gnodes, materials, textures, images, anims = [], [], [], [], [], [], [], []\n tex_index = {}\n\n def add_view(data, target=None):\n while len(bin_) % 4:\n bin_.append(0)\n off = len(bin_)\n bin_.extend(data)\n vw = dict(buffer=0, byteOffset=off, byteLength=len(data))\n if target:\n vw[\"target\"] = target\n views.append(vw)\n return len(views) - 1\n\n def add_acc(arr, kind, comp, target=None, minmax=False):\n arr = np.ascontiguousarray(arr)\n a = dict(bufferView=add_view(arr.tobytes(), target), componentType=comp, count=int(arr.shape[0]), type=kind)\n if minmax or (kind == \"VEC3\" and comp == 5126):\n a[\"min\"] = np.atleast_1d(arr.min(0)).tolist()\n a[\"max\"] = np.atleast_1d(arr.max(0)).tolist()\n accessors.append(a)\n return len(accessors) - 1\n\n def add_texture(key, rgba, limit=None):\n if key in tex_index:\n return tex_index[key]\n im = Image.fromarray(rgba)\n lim = limit or max_tex\n if max(im.size) > lim:\n k = lim / max(im.size)\n im = im.resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)\n b = io.BytesIO()\n im.save(b, \"PNG\", optimize=True)\n images.append(dict(bufferView=add_view(b.getvalue()), mimeType=\"image/png\"))\n textures.append(dict(source=len(images) - 1, sampler=0))\n tex_index[key] = len(textures) - 1\n return tex_index[key]\n\n # joint nodes\n node_of = {}\n for i in order:\n t, q, sc = _trs(local_ref[i])\n node_of[i] = len(gnodes)\n gnodes.append(dict(name=nodes_v[i].get(\"name\"), translation=t.tolist(), rotation=q.tolist(), scale=sc.tolist()))\n for i in order:\n kids = [node_of[c] for c in nodes_v[i].get(\"children\", []) if c in joints]\n if kids:\n gnodes[node_of[i]][\"children\"] = kids\n"}{"chunk_id":"242545","wall_time_seconds":0.114011136,"exit_code":0,"original_token_count":86,"output":"arm_f_strong ~/.local/share/lowmarch/vroid/lowmarch_bodies/cage/arm_f_strong_4ad9ea3b57cd9a77.vrm True\narm_f_slender ~/.local/share/lowmarch/vroid/lowmarch_bodies/cage/arm_f_slender_81550a78f4ae4dbd.vrm True\narm_m_youth ~/.local/share/lowmarch/vroid/lowmarch_bodies/cage/arm_m_youth_4886f9ff964f76b2.vrm True\n"}view_image~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/smile/painted_arm_f_strong.png
input
const r=await tools.view_image({path:"~/.local/share/lowmarch/trials/combined-2026-10-31/all14b/shot/smile/painted_arm_f_strong.png"});image(r.image_url);result, 4 lines
Script completed Wall time 0.1 seconds Output:
agent
+1:23I’m making one posed “border warden” study using the current strong woman, the existing garment and armour kits, and the painted renderer. The test is whether the face, outfit, pose and colours read as one person. This is a separate study for this brief, not a choice of the restart’s character.
