A 3D model pipeline, pushed by Gemini 4 Argon
agent (cont.)
+1:08read_file{"EndLine":1442,"Path":"~/work/lowmarch/docs/portrait-guide.md","StartLine":1200}
input
{ "EndLine": 1442, "Path": "~/work/lowmarch/docs/portrait-guide.md", "StartLine": 1200 }result, 244 lines
Showing lines 1200-1442 of 1442 1200: **What you saw:** some of the hair went inside the bodies. You asked whether collision there was ours or the game 1201: engine's. 1202: 1203: **Whose it is:** ours. A VRM's hair collides only with spheres the model carries, on its bones; every engine that 1204: plays VRM runs those spheres and nothing else, never the skin. v11's hair brought its sample's spheres, sized for 1205: VRoid's slim sample bodies, with none over the back or bust. Replayed in code (`tools/hair_check.py`), the slender 1206: woman's hair sank up to 6 cm into her upper back and shoulders when she twisted; the heavy man's nape hair stood 1207: 4 cm inside his neck, even standing still. 1208: 1209: **What changed (`tools/collide.py`):** each body gets spheres fitted to its own skin wherever its hair can reach, 1210: 2 cm proud of it, and its hair is draped over them at rest, so it starts where it lies. 1211: 1212: **Lessons:** 1213: - **Measure the joints and the mesh both.** Spring collision tests only a bone's tail. A bone held off the body 1214: still left its lock in it three ways: the body bulges between two joints (a 10 cm bone over the slope from neck to 1215: shoulder dipped 3 cm in); a lock is thick round its bone (a median 2.3 cm); and a bone needn't run down its lock 1216: (the heavy man's nape tufts hang below bones that point back). 1217: - **A transplant must keep what physics reads, not only what the mesh reads.** Taking only the bones the hair's 1218: mesh is weighted to dropped each lock's weightless end bone, the one that says where its last bone points. A 1219: one-bone lock then swung about a tail pointing up off the scalp, and its collisions tested a point in the air. 1220: - **Order that matters goes in a list, never a dict's keys.** A face blend's first sample gives its eyes, but the 1221: body fit's cache stores specs with sorted keys: whenever a body came from the cache, the heavy woman, old man and 1222: youth took their eyes from the other sample. Rebuilding the same commit twice and comparing the files caught it. 1223: - **Drape by letting go, not by turning stiffly.** Turned rigidly with their parents, long locks lifted off the 1224: upper back splayed out like a tent. Each bone keeps its own way unless the body is in it, so the hair falls along 1225: the back. 1226: 1227: ### 32 · Faces shaded from a simple head shape, 2026-10-30 1228: 1229: **What you asked:** you bought DillonGoo's Yin and Yang anime rigs (personal-use licence: study only, nothing of 1230: theirs ships). Take their lessons for our faces one step at a time, each shown in the armory at 0°, 35°, 60° and 90°. 1231: 1232: **What was built:** `face_normals` in `tools/vroid_portrait.py`, on by default (`face_normals=1.0` in NEUTRAL). The 1233: face, brows, lines, mouth and skull are shaded from normals that point away from a short vertical line inside the 1234: head (pulled halfway to its middle), not from the mesh; the neck fades back to its own normals over 3 cm under the 1235: chin; then 5 rounds of smoothing. It runs when a character is drawn, so the armory's painted renderer, the pixel 1236: path and the GLB all get it. 1237: 1238: **Lessons:** 1239: - **The blotches were the mesh, not the light.** A VRoid face's normals carry every small bump of the nose, cheek and 1240: jaw; a cel threshold turns each into a patch that jumps as the head turns. A simple shape behind the face gives one 1241: clean shadow edge at every angle. 1242: - **Place the shape for our faces and our light, not the source's.** At the rig's spot (13% of the head's depth in 1243: front of its middle) a VRoid face, flatter than Yin's, shaded half its front under the armory's key. At the middle 1244: the front stays lit and only the far jaw and the neck shade. 1245: - **Not everything wants it.** On hair the same trick flattened the strands into one plastic sheen in the painted 1246: renderer, so hair keeps its own normals (`hair_normals=0.0`). 1247: - **Check what a cache key covers before editing a file in it.** `tools/cage.py` keys bodies on this file's source, 1248: so every edit here rebuilds bodies (two in about two minutes); they came out byte-identical, as they should. 1249: 1250: ### 33 · Hand-placed shadows: under the nose, the chin's on the neck, 2026-10-30 1251: 1252: **What was built:** `shade_marks` in `tools/vroid_portrait.py` (after `face_normals`, sizes in `SHADE_MARKS`, in 1253: eye-to-chin spans). A small patch under the nose tip and a band on the neck under the jaw line turn their normals 1254: down, so the key from above leaves them in shade at every angle and the cel threshold draws a clean edge, the way the 1255: rigs' shadow cards and painted shade mask do. 1256: 1257: **Lessons:** 1258: - **Small and few.** At the first sizes the nose shadow read as a smudge, almost a moustache on the youth; small 1259: (6% of the span tall) it reads as a nose. 1260: - **Not every drawn convention survives 3D.** A lower-lip shade is house style in the pixel portraits, but in the 1261: painted renderer it read as a goatee or a second mouth at every size tried. It stays supported and off. 1262: - **The chin's shadow is the one that sells it:** a band following the jaw line, 45% of the span deep, gives the 1263: classic V under the chin at the front and holds as the head turns. 1264: 1265: ### 34 · Shadow cards instead of tilted skin, 2026-10-30 1266: 1267: **What you saw:** the chin's shadow from lesson 33 looked like a scar, not a shadow. 1268: 1269: **Why:** it was the neck's skin turned away from the light in a soft patch. Its edge followed the neck mesh's 1270: triangles (a zig-zag with notches) and ended where the neck's own bumpy normals took over. The nose patch did the 1271: same and turned VRoid's painted nose line into a "T", like a stitch. 1272: 1273: **What was built (`shadow_cards`, replacing `shade_marks`):** the shadows are small pieces of geometry with designed 1274: outlines, as on the Yin and Yang rigs: a crescent on the neck under the jaw and a half-moon under the nose tip. 1275: - They lie just off the skin and borrow its weights, so they ride and bend with it. 1276: - They take a new role, "shadow": skin that only ever darkens into its shade tone, in the painted renderer, the 1277: export and the pixel path. 1278: - `face_normals` gains the rig's second skeleton, a cylinder round the neck's axis, so the neck itself shades 1279: smoothly around the card. 1280: 1281: **Lessons:** 1282: - **A cel edge drawn by the mesh is only as smooth as the mesh.** Where the shape of a shadow matters, give it its 1283: own geometry. 1284: - **Follow the real edge, not a guess at it.** A parabola for the jaw line left the card's top ragged where it met 1285: the face; the jaw's lowest edge, measured round the neck's axis and smoothed, hides it. 1286: - **A card must agree with the shade around it.** Fixed at one tone it showed a darker V inside the neck's own 1287: half-shade. Letting it only darken (never lighten) merges it where the neck is already in shade. 1288: - **Take the neck from the skeleton, not from a slice of skin.** In the armory's T-pose the slender woman's neck is 1289: short: 5 cm under her chin is already shoulders and arms, so a ring cut there put her neck's centre at the front 1290: of her throat. Half her chin card failed and the rest came out shallow. Her visible "shadow" was mostly the neck's 1291: own shading, so she and the youth looked unlike each other. The line from the neck bone to the head bone (it leans 1292: as the neck does) fixed it. 1293: - **Hold a light constant to see what a shape really is.** Rendering the neck fully lit, so only the cards shaded, 1294: showed at once that her card was nearly missing, and that the light was not to blame. 1295: - **A chin shadow is the upper neck, not the whole of it:** deepest about a quarter of the eye-to-chin span under 1296: the chin, ends tapering to points before the jaw's angle, and a soft shade tone rather than the darkest one. 1297: 1298: ### 35 · The chin's shadow cast in screen space, 2026-10-30 1299: 1300: **What you said:** at angles the chin card still looked wrong; we might need research. 1301: 1302: **What the research said:** anime pipelines either paint neck shadows into the texture (Genshin), edit normals and 1303: shadow thresholds (Guilty Gear Xrd), or cast them in screen space ("depth offset" shadows: Anime Shading Plus, 1304: Stylized NextGen). They avoid ordinary shadow maps on faces. A painted or card shadow is fixed to the neck, while a 1305: real chin shadow comes from the jaw's outline and changes as the head turns. 1306: 1307: **What was built:** the painted renderer draws its info pass (roles, ids, depth) first. For body skin, the colour 1308: pass walks from each pixel toward the key light across that pass: [redacted: secret] the face (jaw, chin) or hair stands in front of 1309: the ray, the pixel drops into the shade band. The chin card is off (`CHIN_CARD`); the nose card stays, since a face 1310: can't shadow itself this way. 1311: 1312: **Lessons:** 1313: - **A shadow's shape belongs to its caster.** Thrown from the jaw's own outline, the chin's shadow is right at 1314: every angle with no shape to design. 1315: - **Unbind what you are about to draw into.** The first version rendered one tile and then black: the info textures 1316: were still bound for sampling when the next frame drew into them (a WebGL feedback loop). 1317: 1318: ### 36 · A skin range, people and fantasy, 2026-10-30 1319: 1320: **What you asked:** more range for the models, starting with skin, including fantasy tones (dark elves and the 1321: like). The pixel renderer is abandoned; the armory's painted renderer is the target. 1322: 1323: **What was built:** 1324: - `cast.SKINS` gains 12 people tones (porcelain to ebony) and 7 fantasy tones (two dark elf, ashen, two orc, sea, 1325: infernal). 1326: - `export_glb.skin_ramp` gives each tone its own lit, shade and deep-shade colours. 1327: - The armory page has a skin picker that tries any tone on the bodies shown (`?skin=<tone>` for sheets). 1328: 1329: **Lessons:** 1330: - **One tint over a light skin can't make a deep one.** Multiplying the light ramp darkened every tone the same way, 1331: and the stage's blue shade turned brown skin grey. A ramp per tone, with shade hue nudged warm on people (cool on 1332: fantasy blues and greens) and the stage grade taken at 30% on skin, keeps deep tones rich. 1333: - **Space the range by eye, not by name.** The older seven bunched at the light end (pale, light, fair look alike) 1334: and stopped at a mid brown. 1335: 1336: ### 37 · Shut eyes shut (from main's 4aa16f2), 2026-10-31 1337: 1338: - **A blended face may not shut its eyes.** The youth's lash lines come from another sample than his lid skin, and 1339: VRoid's close shapes stopped short on him: a strip of iris, then white, then socket showed in joy and the wink. 1340: `hide_closed_irises` closes a shut eye 30% further, hides its iris and highlight (per eye, so the wink's open eye 1341: keeps them), and the shut eye's white is dropped. 1342: - **A closed lid is the model's own open lash, moved** (the rule: lesson 38). VRoid's close shapes move the lid edge further than the 1343: lash's top, so a closed line came out about 1.3 times the open lash on the youth (a slab beside his thin stroke). 1344: `keep_lash_weight` moves each UV column of the upper line rigidly with its lid edge, so it keeps the open weight, 1345: taper and colour. `lid_gap` measures per model whether the lids meet (the edge reaches the painted lower line): 1346: if so nothing more (closing past 1 folded the woman's lash fan into strays); if not, the lid closes over the whole 1347: lower line. A shut eye's lower line is dropped, and the lash fan moves with the edge rather than folding. 1348: - **A big opening needs a dark inside.** VRoid's mouth map read as teeth/tongue/dark looks right on small mouths but 1349: stretches into a pink blob on a shout; the composite darkens the upper half of a tall opening. 1350: 1351: ### 38 · One lash per character (a rule), 2026-10-31 1352: 1353: **One lash size per character: open and closed lids share it. A closed lid is that lash moved, never a stack of 1354: lines or a generic close.** 1355: 1356: - **How:** `keep_lash_weight` moves each UV column of a closing eye's upper line rigidly with its lid edge, so the 1357: closed (or lidded) eye carries the open lash's weight, taper and colour; VRoid's own close stretched it (about 1.3 1358: times on the youth). `lid_gap` measures per model whether the lids meet: if they do, nothing more; if they stop 1359: short, the lid closes over the lower line, and a shut eye's lower line is dropped, so the lid is one stroke. The 1360: lash fan (FaceEyelash) moves with the edge rather than folding past shut. 1361: - **Where the size is set:** today it is implicit in the VRoid sample that gives the eyes (the first in a head's 1362: blend, `cast.HEADS`). A designed size goes in the character's shape as `lash` (NEUTRAL default 1, the sample's 1363: own; per character in its cast `shape`). `lash_size` applies it to the open lash, and every closed lid is moved 1364: from that open lash, so closed lids follow it automatically; there is no closed-eye lash to set. 1365: - **VRoid's lash highlights:** the pale specks VRoid paints inside its lash lines are filled at export 1366: (`export_glb.fill_line_specks`), in open and closed lashes alike. 1367: - **A shut lid is one solid stroke.** A shut eye's upper line is its own primitive (`lid_fill`), drawn with 1368: `export_glb.fill_lid`: the lash's main stroke solid from its top ink to its bottom ink, its pale streaks and 1369: hollows inked, a crease line or loose wisp above it cleared. On an open eye those read as shine and a crease; over 1370: a closed lid they split it (the brute's hollow lash read as an empty almond, the average's streak as two lines). 1371: The open eye is drawn as VRoid painted it. 1372: - **Check it before an armory republish:** 1373: - `python3 tools/lash_check.py [names]` (meshes; after `tools/cage.py`, under 10 s a body): open lash against 1374: every lid the recipes close 30% or more, across the lash's middle columns. Flags a weight past 15%, and a shut 1375: lid that falls into two lines across a pale gap in 2 or more of its 9 columns. 1376: - `python3 tools/lash_shots.py SHOTS [bodies]` (rendered shots): the same in px on the frontal tile; a body whose 1377: lash is mostly under hair is "not measurable", which is not a pass. 1378: - 15%: half the 1.3 times the owner rejected, and above either measure's noise. 1379: 1380: ### 39 · Expressions, after the Yin and Yang rigs (the pass before the benchmark), 2026-10-30 1381: 1382: Written on master before the expressions benchmark. Its code was replaced by the combined track (B's brows and 1383: recipes, A's mouth and wink, shut eyes from lessons 37 and 38); the benchmark is in `~/Projects/lowmarch-bench`. 1384: The lessons below still hold. 1385: 1386: **What you asked:** compare the rigs' expressions (their selling point) with ours, then iterate on ours and show 1387: frontal images of each. 1388: 1389: **What the comparison showed:** see the trials folder, `expressions-vs-yin-yang.png`. 1390: - The rigs pose expressions with macro controls (Action constraints) and draw closed mouths with Line Art. 1391: - Ours use VRoid's 57 shapes. Joy, wink and the vowels already read. 1392: - Open mouths were a flat dark blob. 1393: - Brows hid under the bangs, so angry and sad didn't read. 1394: - There was no one-sided mouth. 1395: 1396: **What was built (the painted renderer and `tools/vrm.py`):** 1397: - **The mouth from VRoid's own texture, mapped to an anime palette:** maroon cavity, rose tongue, white teeth. The 1398: rim and a closed mouth's sliver are inked, and face pixels round the mouth get an ink line. 1399: - **Brows through the bangs:** a brow-only pass shows a brow where hair stands just in front of it (within 6 cm). 1400: - **VRoid's painted lip line inked** inside the template's lip window. 1401: - **One-sided shapes:** `Fcl_MTH_Up@L` applies a shape to one half with a soft middle. The smug is one corner up and 1402: one brow raised. 1403: 1404: **Lessons:** 1405: - **Use the parts you already have.** VRoid's mouth texture had teeth and tongue all along; a flat colour threw them 1406: away. 1407: - **Map texture to style, don't show it raw.** The raw texture read washed-out pink. A three-colour palette by 1408: brightness reads as an anime mouth. 1409: - **A painted lip line can't carry a frown.** VRoid's is faint (about 0.7 of the skin) and a few texels wide; angry 1410: and sad stay weak whatever we ink. They need a drawn line, as the rigs' Line Art does: next. 1411: - **Brows over hair is the anime convention, not the rigs'.** Yin keeps her bangs above her brows instead. 1412: - **A blended face may not shut its eyes.** The youth's lash lines come from another sample than his lid skin, and 1413: VRoid's close shapes stopped short on him: a strip of iris, then white, then socket showed in joy and the wink. 1414: `hide_closed_irises` closes a shut eye 30% further, hides its iris and highlight (per eye, so the wink's open eye 1415: keeps them), and the shut eye's white is dropped. The woman's eyes, which shut already, are unchanged. 1416: 1417: ### 40 · Mouths on every face (the 14-body check), 2026-10-31 1418: 1419: The open mouth (lessons 37, 39) was tuned on two bodies. On all 14 armory bodies it broke four ways, each because a 1420: fixed number stood in for something that differs per face. 1421: 1422: - **A recipe past VRoid's 1 goes past what the face holds.** Shout is `Fcl_MTH_A:1.5`; on long jaws (average, brute, 1423: old, heavy) the lower teeth and the mouth's floor came out under the chin. `hold_mouth` measures it on the face: 1424: `mouth_room` is how far the mouth's inside stays above the face skin's lower outline (2 mm columns, front and 30 1425: degrees either way), and the recipe's `Fcl_MTH_*` weights scale down together until it is 2 mm (`MOUTH_ROOM`). 1426: Scales for shout: 0.66 to 1.0 (average 0.66, old 0.66, brute 0.74; slender 0.90, youth 0.96). The outline is 1427: sampled along the face's triangle edges: its vertices alone leave columns with no outline point. 1428: - **Measure a texture before thresholding it.** Every VRoid mouth map has the same layout (teeth top left, tongue top 1429: right, the inside below) but not the same paint: the sexy woman's is darker throughout, so fixed thresholds read 1430: her whole mouth as the dark inside. `export_glb.even_mouth` measures each map's inside, tongue light and teeth 1431: white in their parts and repaints it in the colours the renderer's split was tuned on. Teeth are told by their 1432: least channel: a tongue's highlight is bright but pink, and on brightness it read as a white tooth. 1433: - **A slit is all teeth.** VRoid's teeth fill a barely parted mouth (the heroic man's angry, several sads), which read 1434: as a white pill. The composite shows teeth only where the opening is 8 to 11 mm tall, measured in the face's own 1435: metres (`uPpm`), not in pixels. 1436: - **Some samples have fangs in their teeth.** Sample V's upper teeth carry two fangs in the mesh itself (no shape 1437: key applies them), so faces blended from V (arm_m_old) show them in an open mouth. `fangs` in the shape (1, the 1438: face's own teeth) is the switch: 0 adds VRoid's `Fcl_HA_Short`, which removes them and shortens the other teeth a 1439: little. 1440: - **Still weak:** angry on the slender, strong, sexy and old women is a closed line that thins to a hairline in its 1441: middle, where the shape presses the painted lip line; widening its texture taps by how squeezed the texture is 1442: on screen was tried and dropped (no thicker, specks on the heroic man's rim). It needs a drawn line (lesson 39).
agent
+1:18reasoning
I'm thinking through how to approach this.