agent

+12:22
reasoning

The code accesses neck and head positions using node names. The presence of "J_Bip_C_Neck" in the node name lookup is conditional. Further investigation of the v object and the pose variable is required to understand the origin and usage of these node positions.

The face_normals function appears to be responsible for the "surgery scar" effect. Specifically, when r == "body", vertices with y-coordinates less than chin_y - 0.03 are weighted to zero, indicating the scar is applied to the neck region. It seems the issue arises from the way neck and skull vertices are being differentiated. The VRoid model's skinning is potentially misaligned, leading to the unexpected application of face normal modifications to the neck.

The code calculates a cylindrical influence for the neck region, controlled by parameters like radius and position relative to a reference point. The normals of vertices on the upper neck are being altered to point upwards and outwards. However, lower on the neck, the normals are pointing horizontally. This abrupt transition in normal direction could be the source of the "surgery scar" visual artifact. The normal calculations suggest that the influence region should be smoothly tapered, but this may not be happening due to inconsistent handling of different neck segments.

The abrupt normal changes across the neck are linked to how the cylindrical influence works in conjunction with the key light's vertical component. The code forces the neck normals into three segments: bent downward, horizontal, and then back to mesh normal, creating visible shadow bands. A possible solution involves removing the cylindrical normal influence on the "body" region or applying the head proxy only to the skull. Initial assessment suggests the pre-existing cylindrical vertex normals in the VRoid mesh may be sufficient.

The screen-space shadow casting on the throat from the chin and hair is already handled. Removing the "surgery scar" effect can be achieved by modifying the face_normals function to only include skull vertices above the jaw when r == "body". This approach retains smooth neck normals and eliminates the artificial shadow steps. This leaves only the screen-space shadow casting. Checking the knight_dress, saber_study, and elaine parts next. The elaine function call imports hair.

  • read_file{"EndLine":90,"Path":"~/work/lowmarch/tools/outfit.py","StartLine":1}

    input

    {
      "EndLine": 90,
      "Path": "~/work/lowmarch/tools/outfit.py",
      "StartLine": 1
    }

    result, 91 lines

    Showing lines 1-90 of 1272
    1: """Fantasy costume pieces, generated in code and fitted onto a VRoid body.
    2: 
    3: Coordinates are the model's (metres, y up, the character faces -z, its left is -x). Pieces are
    4: built once in the reference pose (the bust pose, arms down) and carry skin weights (J, W, jnames)
    5: so the renderer can pose them with the body through the skeleton: soft layers copy the weights of
    6: the body under them, hard parts ride one bone.
    7: 
    8: Kinds of piece (see docs/portrait-guide.md lesson 07 for the measurements behind the offsets):
    9: 
    10:   wrap      a garment shrink-wrapped onto a body region chosen by bones (tunic, trousers, boots,
    11:             gloves): seams welded, smoothed without shrinking, every vertex set at an offset
    12:   collar    a standing collar fitted to the neck by ray casts, rising toward the back
    13:   pauldron  three overlapping lames whose shape comes from ray casts to what they cover
    14:   drape     cloth (cape, tunic tails) settled by a small cloth simulation against the body
    15:   belt      a band around the waist on top of the tunic
    16:   trim      a band along a piece's edge (gold trim, piping), lifted off its surface
    17:   props     sword and hardware built from boxes, tubes and balls
    18: 
    19: A costume is a function of a Fit (body + bones in the reference pose) returning a list of pieces.
    20: """
    21: import math
    22: import os
    23: 
    24: import numpy as np
    25: from scipy.spatial import cKDTree
    26: 
    27: from fitting import (Surface, merge_surfaces, weld, compact, subdivide, shrink_wrap, flatten_hem, limb_hull,
    28:                      boundary_loops, vertex_normals, transfer_weights, rigid_weights, blend_weights, taubin)
    29: 
    30: 
    31: # ---- mesh helpers --------------------------------------------------------------
    32: def grid_mesh(P):
    33:     """P: (U, V, 3) grid of points -> (pos, tri)."""
    34:     U, V = P.shape[:2]
    35:     idx = np.arange(U * V).reshape(U, V)
    36:     a, b, c, d = idx[:-1, :-1], idx[1:, :-1], idx[1:, 1:], idx[:-1, 1:]
    37:     tri = np.concatenate([np.stack([a, b, c], -1).reshape(-1, 3), np.stack([a, c, d], -1).reshape(-1, 3)])
    38:     return P.reshape(-1, 3), tri
    39: 
    40: 
    41: def piece(name, role, pos, tri, nrm=None, outward_from=None, axis=None):
    42:     """outward_from: a point (or, with axis, a line) the normals should face away from, so the
    43:     renderer knows which side is the outside of a one-sided sheet."""
    44:     pos = np.asarray(pos, float)
    45:     tri = np.asarray(tri)
    46:     nrm = vertex_normals(pos, tri) if nrm is None else nrm
    47:     if outward_from is not None:
    48:         d = pos - np.asarray(outward_from, float)
    49:         if axis is not None:
    50:             a = np.asarray(axis, float) / np.linalg.norm(axis)
    51:             d -= np.outer(d @ a, a)
    52:         if (np.einsum("ij,ij->i", nrm, d) < 0).mean() > 0.5:
    53:             nrm = -nrm
    54:             tri = tri[:, ::-1]
    55:     return dict(mesh="outfit", material=f"OUTFIT_{name}", mi=-1, role=role, pos=pos,
    56:                 nrm=nrm, uv=np.zeros((len(pos), 2)), tri=tri)
    57: 
    58: 
    59: def thick_grid(P, thickness, outward_from, axis=None):
    60:     """A grid sheet given real thickness: outer face, inner face, and the four edges closed, so
    61:     rims read as solid and the inside never shows."""
    62:     pos, tri = grid_mesh(P)
    63:     n = vertex_normals(pos, tri)
    64:     d = pos - np.asarray(outward_from, float)
    65:     if axis is not None:
    66:         a = np.asarray(axis, float) / np.linalg.norm(axis)
    67:         d -= np.outer(d @ a, a)
    68:     if (np.einsum("ij,ij->i", n, d) < 0).mean() > 0.5:
    69:         n, tri = -n, tri[:, ::-1]
    70:     U, V = P.shape[:2]
    71:     inner = (pos - n * thickness).reshape(U, V, 3)
    72:     outer = pos.reshape(U, V, 3)
    73:     mid = outer.reshape(-1, 3).mean(0)
    74:     allp, allt, off = [], [], 0
    75:     parts = [(outer, tri, None), (inner, tri[:, ::-1], None)]
    76:     for edge in (lambda G: G[:, 0], lambda G: G[:, -1], lambda G: G[0, :], lambda G: G[-1, :]):
    77:         strip = np.stack([edge(outer), edge(inner)], 1)
    78:         p_, t_ = grid_mesh(strip)
    79:         nn = vertex_normals(p_, t_)
    80:         if (np.einsum("ij,ij->i", nn, p_ - mid) < 0).mean() > 0.5:
    81:             t_ = t_[:, ::-1]
    82:         parts.append((strip, t_, True))
    83:     for G, t_, _ in parts:
    84:         allp.append(G.reshape(-1, 3))
    85:         allt.append(t_ + off)
    86:         off += G.shape[0] * G.shape[1]
    87:     return np.concatenate(allp), np.concatenate(allt), outer
    88: 
    89: 
    90: def frame_axes(a, hint=(0, 1, 0)):
  • read_file{"EndLine":180,"Path":"~/work/lowmarch/tools/outfit.py","StartLine":90}

    input

    {
      "EndLine": 180,
      "Path": "~/work/lowmarch/tools/outfit.py",
      "StartLine": 90
    }

    result, 92 lines

    Showing lines 90-180 of 1272
    90: def frame_axes(a, hint=(0, 1, 0)):
    91:     a = np.asarray(a, float) / np.linalg.norm(a)
    92:     b = np.cross(a, hint)
    93:     if np.linalg.norm(b) < 1e-6:
    94:         b = np.cross(a, (1, 0, 0))
    95:     b /= np.linalg.norm(b)
    96:     return a, b, np.cross(a, b)
    97: 
    98: 
    99: def box(name, role, centre, axes, half):
    100:     c = np.asarray(centre, float)
    101:     ax = [np.asarray(v, float) * h for v, h in zip(axes, half)]
    102:     corners = np.array([c + sx * ax[0] + sy * ax[1] + sz * ax[2]
    103:                         for sx in (-1, 1) for sy in (-1, 1) for sz in (-1, 1)])
    104:     quads = [(0, 1, 3, 2), (4, 6, 7, 5), (0, 4, 5, 1), (2, 3, 7, 6), (0, 2, 6, 4), (1, 5, 7, 3)]
    105:     pos, tri = [], []
    106:     for q in quads:
    107:         base = len(pos)
    108:         pos += [corners[i] for i in q]
    109:         tri += [(base, base + 1, base + 2), (base, base + 2, base + 3)]
    110:     return piece(name, role, np.array(pos), np.array(tri), outward_from=c)
    111: 
    112: 
    113: def tube(name, role, start, axis, length, r0, r1=None, seg=16, rows=2):
    114:     r1 = r0 if r1 is None else r1
    115:     a, b, c = frame_axes(axis)
    116:     ang = np.linspace(0, 2 * math.pi, seg, endpoint=False)
    117:     P = np.zeros((seg + 1, rows, 3))
    118:     for j, t in enumerate(np.linspace(0, 1, rows)):
    119:         r = r0 + (r1 - r0) * t
    120:         ring = np.asarray(start) + a * length * t + (np.outer(np.cos(ang), b) + np.outer(np.sin(ang), c)) * r
    121:         P[:seg, j] = ring
    122:         P[seg, j] = ring[0]
    123:     pos, tri = grid_mesh(P)
    124:     return piece(name, role, pos, tri, outward_from=np.asarray(start) + a * length / 2, axis=a)
    125: 
    126: 
    127: def ball(name, role, centre, r, seg=14, rows=8, squash=(1, 1, 1)):
    128:     th = np.linspace(0, math.pi, rows)
    129:     ph = np.linspace(0, 2 * math.pi, seg + 1)
    130:     P = np.zeros((seg + 1, rows, 3))
    131:     for j, t in enumerate(th):
    132:         P[:, j, 0] = np.sin(t) * np.cos(ph) * r * squash[0]
    133:         P[:, j, 1] = np.cos(t) * r * squash[1]
    134:         P[:, j, 2] = np.sin(t) * np.sin(ph) * r * squash[2]
    135:     P += np.asarray(centre)
    136:     pos, tri = grid_mesh(P)
    137:     return piece(name, role, pos, tri, outward_from=centre)
    138: 
    139: 
    140: def ribbon(name, role, curve, width=0.006, lift=0.002, normals=None, away=None, closed=False):
    141:     """A band along a 3D polyline, lifted off a surface. normals: the surface normal at each
    142:     point (the band lies flat on it); otherwise it faces away from `away`."""
    143:     C = np.asarray(curve, float)
    144:     N = None if normals is None else np.asarray(normals, float)
    145:     if closed:
    146:         C = np.concatenate([C, C[:1]])
    147:         N = None if N is None else np.concatenate([N, N[:1]])
    148:     t = np.gradient(C, axis=0)
    149:     t /= np.maximum(np.linalg.norm(t, axis=1, keepdims=True), 1e-9)
    150:     nrm = N if N is not None else C - np.asarray(away if away is not None else C.mean(0))
    151:     nrm = nrm - t * np.einsum("ij,ij->i", nrm, t)[:, None]
    152:     nrm /= np.maximum(np.linalg.norm(nrm, axis=1, keepdims=True), 1e-9)
    153:     side = np.cross(t, nrm)
    154:     P = np.stack([C - side * width / 2 + nrm * lift, C + side * width / 2 + nrm * lift], 1)
    155:     pos, tri = grid_mesh(P)
    156:     vn = np.repeat(nrm, 2, axis=0)
    157:     if (vertex_normals(pos, tri) * vn).sum(1).mean() < 0:
    158:         tri = tri[:, ::-1]
    159:     return piece(name, role, pos, tri, nrm=vn)
    160: 
    161: 
    162: # ---- body fit -----------------------------------------------------------------------
    163: class Fit:
    164:     """What a costume is built against: the body skin (welded, measurable) and the bones, all in
    165:     the reference pose, plus the skin weights so pieces can be bound to the skeleton."""
    166: 
    167:     def __init__(self, vrm, pose, prims, roles):
    168:         self._prims, self._roles = prims, roles
    169:         W = vrm.node_world(pose)
    170:         names = vrm.nodes_by_name()
    171:         self.world = {k: W[i].copy() for k, i in names.items() if k}
    172:         self.bone = {k: m[:3, 3].copy() for k, m in self.world.items()}
    173:         skin = [p for p, r in zip(prims, roles) if r == "body"]
    174:         self.body = skin[0]
    175:         self.pos = self.body["pos"]
    176:         self.J, self.W, self.jnames = self.body["J"], self.body["W"], self.body["jnames"]
    177:         self.tri = weld(self.pos, np.concatenate([p["tri"] for p in skin]))
    178:         self.surf = Surface(self.pos, self.tri)
    179:         self.skin = self.pos[np.unique(self.tri)]
    180:         # MakeHuman bodies (tools/makehuman.py) have real muscle relief; VRoid's limbs are smooth tubes

agent

+12:56
reasoning

The code initializes _prims and _roles. A conditional statement checks for "hair" in _roles. If "hair" is absent, it imports a "hair" module and processes the output. The logic suggests a dependency on "hair" components when they are not explicitly present.

  • read_file{"EndLine":276,"Path":"~/work/lowmarch/tools/saber_study.py","StartLine":190}

    input

    {
      "EndLine": 276,
      "Path": "~/work/lowmarch/tools/saber_study.py",
      "StartLine": 190
    }

    result, 88 lines

    Showing lines 190-276 of 541
    190:     def r_base(u, v):                                   # the overskirt's cone before it clears the petticoat
    191:         t = np.clip((y_top - v) / (y_top - y_hem), 0, 1.15)
    192:         return r0(u) + (r_hem - r0_mean) * t ** 1.45
    193: 
    194:     # petticoat: full circle, to mid-calf, the hem cut into sawtooth teeth with a gold lozenge on each
    195:     legs = merge_surfaces((tights["pos"], tights["tri"]), (boots["pos"], boots["tri"]))
    196:     waist = merge_surfaces(torso_only, (tights["pos"], tights["tri"]))
    197:     pt_top = y(0.335)
    198:     seg, rows, teeth = 96, 24, 48
    199:     # not simulated: the viewer's cloth pushes a skirt out of the legs by a few centimetres, which took
    200:     # it through the stiff overskirt; skinned like the overskirt instead, the two move together
    201:     pet, grid = O.skirt(fit, "petticoat", "heraldry", waist, legs, pt_top, pt_top - y(0.858), flare=r_hem - 0.165,
    202:                         seg=seg, rows=rows, folds=8, fold_depth=0.006)
    203:     # the upper part is always hidden under the overskirt and tassets, and the settle crumples it over
    204:     # the hips (a fold whose surface faces inward): rebuild it as a smooth ring between the body and the
    205:     # overskirt's base cone, blending into the settled cloth below
    206:     body_c = TorsoChart(waist, y(0.56), y(0.32), cz=cz, du=3.0, dv=0.01, smooth=(1.2, 1.2))
    207:     Pp = pet["pos"].reshape(seg, rows, 3)
    208:     hz = np.stack([Pp[..., 0], Pp[..., 2] - cz], -1)             # horizontal offset from the axis
    209:     rr = np.linalg.norm(hz, axis=-1)
    210:     d0 = hz / np.maximum(rr[..., None], 1e-9)
    211:     dcol = np.repeat(d0[:, :1], rows, 1)                        # each column's own direction, from its
    212:     a_ = np.clip((Pp[..., 1] - y(0.52)) / (y(0.46) - y(0.52)), 0, 1)   # top point (columns that crossed
    213:     dn = d0 * (1 - a_[..., None]) + dcol * a_[..., None]               # over each other made the fold)
    214:     dn /= np.maximum(np.linalg.norm(dn, axis=-1, keepdims=True), 1e-9)
    215:     up = np.degrees(np.arctan2(dn[..., 0], -dn[..., 1]))
    216:     ring = np.maximum(body_c.radius(up, Pp[..., 1]) + 0.006, r_base(up, Pp[..., 1]) - 0.010)
    217:     r_new = rr + (ring - rr) * a_
    218:     Pp[..., 0] = dn[..., 0] * r_new
    219:     Pp[..., 2] = cz + dn[..., 1] * r_new
    220:     pet["pos"] = Pp.reshape(-1, 3)
    221:     G = pet["pos"].reshape(seg, rows, 3)
    222:     # the settle swings a flared skirt down, so it hangs longer than asked: scale it back to end at mid-calf
    223:     y0_, y1_ = G[:, 0, 1].mean(), G[0::2, -1, 1].mean()
    224:     G[..., 1] = y0_ - (y0_ - G[..., 1]) * (y0_ - y(0.858)) / (y0_ - y1_)
    225:     G[1::2, -1] = G[1::2, -2] + (G[1::2, -1] - G[1::2, -2]) * 0.05    # every other column ends a row early: teeth
    226:     pet["pos"] = G.reshape(-1, 3)
    227:     pet["nrm"] = O.vertex_normals(pet["pos"], pet["tri"])
    228:     # decal: the hem's lozenges, in (s, t) = (round the skirt, folded at the back so the seam repeats
    229:     # nothing; up the skirt, the lowest fifth only)
    230:     from plates import Canvas
    231:     cv = Canvas(512, 256)
    232:     for i in range(0, seg // 2 + 1, 2):
    233:         s_ = 1 - abs(2 * i / seg - 1)
    234:         cv.dot((s_, 0.5 / 0.2 / (rows - 1)), 2.0, 26, "gold")
    235:     pet["decal"] = cv.array()
    236:     ii, jj = np.meshgrid(np.arange(seg), np.arange(rows), indexing="ij")
    237:     s_uv = 1 - np.abs(2 * ii / seg - 1)
    238:     t_uv = np.clip((1 - jj / (rows - 1)) / 0.2, 0, 1)
    239:     t_uv[1::2, -1] = np.clip((1 - (rows - 2 + 0.05) / (rows - 1)) / 0.2, 0, 1)
    240:     pet["uv"] = np.stack([s_uv, t_uv], -1).reshape(-1, 2)
    241:     stiffen(pet, fit, share=0.65)
    242:     pet.pop("closed", None)
    243:     pet["covered_by"] = ["overskirt", "front_panel"]      # for the layer check: it must never show through them
    244:     out += _grouped([pet], "dress")
    245:     # the overskirt's cone, kept a centimetre outside the petticoat everywhere: the petticoat settles
    246:     # against the body, which bulges out behind the hips past a plain cone (it showed through there)
    247:     under = TorsoChart(Surface(pet["pos"], pet["tri"]), y(0.80), y(0.335), cz=cz, du=3.0, dv=0.01, smooth=(1.2, 1.2))
    248: 
    249:     def r_over(u, v):
    250:         base = r_base(u, v)
    251:         # outside the petticoat by 1.6 cm over the hips and below; at the waist the band hugs the body
    252:         w = np.clip((y(0.335) - v) / (y(0.335) - y(0.380)), 0, 1)
    253:         return base + np.maximum(0, under.radius(u, v) + 0.016 - base) * w
    254: 
    255:     cone = ConeChart(r_over, cz=cz)
    256: 
    257:     # overskirt: a stiff cone, open at the front, a gold-edged slit at the back
    258:     slit_h, slit_w = 0.34 * (y_top - y_hem), math.degrees(0.2 * hd / r_hem)
    259: 
    260:     def over_bottom(u):
    261:         return y_hem + slit_h * max(0.0, 1 - abs(u - 180) / slit_w)
    262: 
    263:     over, _ = outline_plate("overskirt", "signature", cone, 27, 333, over_bottom, lambda u: y_top + 0.012, offset=0.0,
    264:                             thickness=0.004, nu=150, nv=26, trim=0.035 * hd, roll=0)
    265:     # layers over the petticoat take its weights (nearest vertex): weights copied from the body
    266:     # differ between a layer close to the thighs and one further out, and the layers then cross
    267:     O.inherit(over, pet)
    268:     out += _grouped([over], "dress")
    269: 
    270:     # front panel: a violet apron from the belt, filling the overskirt's opening, scooped corners
    271:     # ending in points with silver pendants, gold edges, two crescent hooks and a small triangle
    272:     y_ph, y_tip = y(0.745), y(0.690)
    273:     panel_r = lambda u, v: r_over(u, v) - 0.0025
    274: 
    275:     def p_top(u):
    276:         a = abs(u)

agent

+13:03
reasoning

The initial instruction mentions excluding specific elements. The instruction also refers to a file that must not be used. Instead, examining the instructions themselves to determine the intended course.

Examining the available outfits and gear to determine appropriate options for the female lead character. Considering the knight_dress outfit alongside relevant gear components such as breastplates, pauldrons, greaves, and vambraces. The knight_dress includes a full set of armor components and a sword. It also appears to exclude hair, checking if not any(r == "hair" for r in fit._roles):.

  • edit_file{"Path":"~/work/lowmarch/tools/vroid_portrait.py","Replacement":"NEUTRAL = dict(head=1.0, neck=1.0, chest=1.0, height=1.0,\n shoulders=1.0, arms=1.0, torso=1.0, legs=1.0, leg_len=1.0, hands=1.0, shoulder_w=0.0,\n face_len=0.0, jaw=0.0, chin_w=0.0, chin_len=0.0, cheek=0.0, brow_ridge=0.0,\n nose=0.0, nose_w=0.0,\n eye=1.0, eye_tilt=0.0, iris=1.0, lash=1.0, mouth=1.0, arm_out=0.0, age_lines=0.0, blush=1.0, curl=0.0,\n face_normals=1.0, hair_normals=0.0, shadow_cards=0.0, fangs=1.0, rest={})","Target":"NEUTRAL = dict(head=1.0, neck=1.0, chest=1.0, height=1.0,\n shoulders=1.0, arms=1.0, torso=1.0, legs=1.0, leg_len=1.0, hands=1.0, shoulder_w=0.0,\n face_len=0.0, jaw=0.0, chin_w=0.0, chin_len=0.0, cheek=0.0, brow_ridge=0.0,\n nose=0.0, nose_w=0.0,\n eye=1.0, eye_tilt=0.0, iris=1.0, lash=1.0, mouth=1.0, arm_out=0.0, age_lines=0.0, blush=1.0, curl=0.0,\n face_normals=1.0, hair_normals=0.0, shadow_cards=1.0, fangs=1.0, rest={})"}

    input

    {
      "Path": "~/work/lowmarch/tools/vroid_portrait.py",
      "Replacement": "NEUTRAL = dict(head=1.0, neck=1.0, chest=1.0, height=1.0,\n               shoulders=1.0, arms=1.0, torso=1.0, legs=1.0, leg_len=1.0, hands=1.0, shoulder_w=0.0,\n               face_len=0.0, jaw=0.0, chin_w=0.0, chin_len=0.0, cheek=0.0, brow_ridge=0.0,\n               nose=0.0, nose_w=0.0,\n               eye=1.0, eye_tilt=0.0, iris=1.0, lash=1.0, mouth=1.0, arm_out=0.0, age_lines=0.0, blush=1.0, curl=0.0,\n               face_normals=1.0, hair_normals=0.0, shadow_cards=0.0, fangs=1.0, rest={})",
      "Target": "NEUTRAL = dict(head=1.0, neck=1.0, chest=1.0, height=1.0,\n               shoulders=1.0, arms=1.0, torso=1.0, legs=1.0, leg_len=1.0, hands=1.0, shoulder_w=0.0,\n               face_len=0.0, jaw=0.0, chin_w=0.0, chin_len=0.0, cheek=0.0, brow_ridge=0.0,\n               nose=0.0, nose_w=0.0,\n               eye=1.0, eye_tilt=0.0, iris=1.0, lash=1.0, mouth=1.0, arm_out=0.0, age_lines=0.0, blush=1.0, curl=0.0,\n               face_normals=1.0, hair_normals=0.0, shadow_cards=1.0, fangs=1.0, rest={})"
    }

    result, 1 line

    Made 1 replacement in ~/work/lowmarch/tools/vroid_portrait.py starting at line 162 (+1/-1 lines).
  • edit_file{"Path":"~/work/lowmarch/tools/vroid_portrait.py","Replacement":" if r in (\"face\", \"brow\", \"line\", \"mouth\"):\n w = np.full(len(y), amount)\n elif r == \"body\":\n w = amount * np.clip((y - chin_y) / 0.02, 0, 1)\n elif r == \"hair\" and hair > 0:","Target":" if r in (\"face\", \"brow\", \"line\", \"mouth\"):\n w = np.full(len(y), amount)\n elif r == \"body\":\n w = amount * np.clip((y - (chin_y - 0.03)) / 0.03, 0, 1)\n # the neck below: a smooth cylinder round its line (the rig's second skeleton), fading out at its base\n if frame is not None:\n A, u, rad = frame\n rel = p[\"pos\"] - A\n cyl = rel - np.outer(rel @ u, u)\n radial = np.linalg.norm(cyl, axis=1)\n wn = (amount - w) * np.clip((y - (A[1] - 0.01)) / 0.025, 0, 1) * \\\n np.clip((1.6 * rad - radial) / (0.4 * rad), 0, 1)\n elif r == \"hair\" and hair > 0:"}

    input

    {
      "Path": "~/work/lowmarch/tools/vroid_portrait.py",
      "Replacement": "        if r in (\"face\", \"brow\", \"line\", \"mouth\"):\n            w = np.full(len(y), amount)\n        elif r == \"body\":\n            w = amount * np.clip((y - chin_y) / 0.02, 0, 1)\n        elif r == \"hair\" and hair > 0:",
      "Target": "        if r in (\"face\", \"brow\", \"line\", \"mouth\"):\n            w = np.full(len(y), amount)\n        elif r == \"body\":\n            w = amount * np.clip((y - (chin_y - 0.03)) / 0.03, 0, 1)\n            # the neck below: a smooth cylinder round its line (the rig's second skeleton), fading out at its base\n            if frame is not None:\n                A, u, rad = frame\n                rel = p[\"pos\"] - A\n                cyl = rel - np.outer(rel @ u, u)\n                radial = np.linalg.norm(cyl, axis=1)\n                wn = (amount - w) * np.clip((y - (A[1] - 0.01)) / 0.025, 0, 1) * \\\n                    np.clip((1.6 * rad - radial) / (0.4 * rad), 0, 1)\n        elif r == \"hair\" and hair > 0:"
    }

    result, 1 line

    Made 1 replacement in ~/work/lowmarch/tools/vroid_portrait.py starting at line 417 (+1/-9 lines).
  • edit_file{"Path":"~/work/lowmarch/tools/outfit.py","Replacement":" if not any(r == \"hair\" for r in fit._roles):\n import hair\n out += [pc for pc in updo(fit) if pc[\"material\"] != \"OUTFIT_cowlick\"] + hair.elaine(fit)\n out += sword(fit, \"R\", blade_len=0.84, blade_w=0.046, grip_len=0.21, hilt=\"gold\", grip=\"signature\")","Target":" import hair\n out += [pc for pc in updo(fit) if pc[\"material\"] != \"OUTFIT_cowlick\"] + hair.elaine(fit)\n out += sword(fit, \"R\", blade_len=0.84, blade_w=0.046, grip_len=0.21, hilt=\"gold\", grip=\"signature\")"}

    input

    {
      "Path": "~/work/lowmarch/tools/outfit.py",
      "Replacement": "    if not any(r == \"hair\" for r in fit._roles):\n        import hair\n        out += [pc for pc in updo(fit) if pc[\"material\"] != \"OUTFIT_cowlick\"] + hair.elaine(fit)\n    out += sword(fit, \"R\", blade_len=0.84, blade_w=0.046, grip_len=0.21, hilt=\"gold\", grip=\"signature\")",
      "Target": "    import hair\n    out += [pc for pc in updo(fit) if pc[\"material\"] != \"OUTFIT_cowlick\"] + hair.elaine(fit)\n    out += sword(fit, \"R\", blade_len=0.84, blade_w=0.046, grip_len=0.21, hilt=\"gold\", grip=\"signature\")"
    }

    result, 1 line

    Made 1 replacement in ~/work/lowmarch/tools/outfit.py starting at line 1027 (+3/-2 lines).
  • read_file{"EndLine":276,"Path":"~/work/lowmarch/art/cast/cast.py","StartLine":190}

    input

    {
      "EndLine": 276,
      "Path": "~/work/lowmarch/art/cast/cast.py",
      "StartLine": 190
    }

    result, 88 lines

    Showing lines 190-276 of 464
    190:         if "C_Spine" in f["gate"]:
    191:             g["h"] = round(g["h"] * lats, 4)
    192:         if f["gate"] == ("{s}_UpperArm", "{s}_Shoulder"):
    193:             g["h"] = round(g["h"] * delts, 4)
    194:         out.append(g)
    195:     return out
    196: 
    197: 
    198: # a heavy man is big, not only fat: shoulders with some bulk (his arms come from his reference since it's fitted to
    199: # real heavy men's, 2026-10-10: an upper-arm form on top put them past everyone's)
    200: CAGE_HEAVY_FORMS = [
    201:     dict(gate=("{s}_UpperArm", "{s}_Shoulder"), at=("{s}_UpperArm", 0.12), face=(1, 0.7, 0), size=(0.07, 0.07, 0.08), h=0.02),
    202:     dict(gate=("C_UpperChest", "{s}_Shoulder", "C_Neck"), at=("{s}_Shoulder", 0.4), face=(0.2, 1, 0), size=(0.07, 0.05, 0.07),
    203:          h=0.025)]
    204: # the strong man is an athlete: the brute's masses at about two thirds. The heroic man's are a little less, the
    205: # trapezius lower (a clean line from the neck), the lats fuller (the V under the arms) and the deltoids rounder
    206: CAGE_STRONG_FORMS = _muscle(0.65)
    207: CAGE_HEROIC_FORMS = _muscle(0.6, trap=0.6, lats=1.4, delts=1.3)
    208: # women (2026-10-10): VRoid's feminine base over the MakeHuman women. The strong one gets mild shoulder, arm and calf
    209: # forms, since the smoothing takes her muscle tone
    210: CAGE_STRONG_F_FORMS = [
    211:     dict(gate=("{s}_UpperArm", "{s}_Shoulder"), at=("{s}_UpperArm", 0.12), face=(1, 0.7, 0), size=(0.06, 0.06, 0.07), h=0.016),
    212:     dict(gate=("C_UpperChest", "{s}_Shoulder", "C_Neck"), at=("{s}_Shoulder", 0.4), face=(0.2, 1, 0), size=(0.06, 0.04, 0.06),
    213:          h=0.015),
    214:     dict(gate=("{s}_UpperArm",), at=("{s}_UpperArm", 0.55), face=(0, 0.3, 1), size=(0.05, 0.035, 0.045), h=0.008),
    215:     dict(gate=("{s}_LowerLeg",), at=("{s}_LowerLeg", 0.3), face=(0.3, 0, -1), size=(0.035, 0.06, 0.045), h=0.012)]
    216: # VRoid's breasts are a hemisphere each, set close, upper pole as full as the lower (Fable, 2026-10-10): each woman's
    217: # are reshaped after the wrap (tools/cage.py bust_shape): opened at the cleavage, set a little lower, the upper pole
    218: # sloped back (a fuller lower pole). The sexy and heavy women's are grown mostly by inflating them along the skin
    219: # (2026-10-12): scaled up from VRoid's narrow base they stood out as balls glued on, with a crease round the rim.
    220: # The inflation sits low (a teardrop, not a dome), and the heavy woman's falls outward, as her reference's does
    221: CAGE_HEAVY_F_FORMS = [
    222:     dict(gate=("{s}_UpperArm", "{s}_Shoulder"), at=("{s}_UpperArm", 0.12), face=(1, 0.7, 0), size=(0.06, 0.06, 0.07), h=0.012)]
    223: _MASC, _FEM = "lowmarch_bodies/base_masc.vrm", "lowmarch_bodies/base_fem.vrm"
    224: # ranges the armory's checks hold a body to beyond its reference's: the strong and heroic men's deltoid forms widen
    225: # their shoulders over a skeleton fitted to 2.2 head heights (every man's T-posed shoulders read past real men's
    226: # breadth across the deltoids, the average man's too; theirs are the broadest on purpose)
    227: CHECK_RANGES = {"arm_m_strong": dict(shoulder_hd=(1.7, 2.35)), "arm_m_heroic": dict(shoulder_hd=(2.0, 2.4))}
    228: # heads (2026-10-13, tools/heads.py): each body wears a VRoid sample's face, or a blend of samples' faces (the first
    229: # gives the eye drawing), chosen by look. They are left as VRoid built them, with light touches at most: fitted to
    230: # the face ratios of the study's paintings (by lengthening the lower face, enlarging the eyes) they read too sharp
    231: # from the side and the average man too wide (the user, 2026-10-13). The ratios are reported against the face's
    232: # archetype. What a face does at rest (a frown, half-closed eyes) and age lines are drawn when the figure is built
    233: # (PORTRAIT), not in the file
    234: def _head(archetype, sculpt=None, hair=None, face=None, makeup=False, **mix):
    235:     """A head: a sample's face or a blend (mix: letter -> weight), or a face designed in VRoid Studio's own editor
    236:     (face: a VRM under LOWMARCH_VROID, faces/, exported by tools/winvroid; makeup keeps its lips and shadow)."""
    237:     sample = [[face, 1.0]] if face else [[f"avatarsample_{k}", w] for k, w in mix.items()]   # in order: the first
    238:                                                                                                 # gives the eyes
    239:     out = dict(sample=sample, sculpt=sculpt or {}, archetype=archetype)
    240:     if hair:
    241:         out["hair"] = f"avatarsample_{hair}"
    242:     if makeup:
    243:         out["makeup"] = True
    244:     return out
    245: 
    246: 
    247: # hair (2026-10-13): a VRoid sample's hairstyle per body (tools/heads.py: warped onto our head, with its springs),
    248: # chosen by archetype; its colour (HAIR_COLOURS, the cast's palettes) and the eyes' (EYE_COLOURS) are the body's own,
    249: # since the renderers recolour both
    250: HEADS = {
    251:     "arm_m_lean": _head("young", hair="z", z=1),
    252:     "arm_m_average": _head("generic", hair="l", p=0.5, z=0.5),
    253:     "arm_m_strong": _head("adult", hair="c", c=0.6, t=0.4),
    254:     "arm_m_heroic": _head("adult", hair="r", r=0.6, v=0.4),
    255:     "arm_m_heavy": _head("heavy", dict(cheek=0.4), hair="x", x=1),
    256:     "arm_m_brute": _head("heavy", dict(jaw=0.8, brow_ridge=0.8), hair="t", t=0.6, x=0.4),
    257:     "arm_m_old": _head("adult", dict(brow_ridge=0.8, nose=0.6), hair="n", v=0.6, t=0.4),
    258:     "arm_m_youth": _head("young", hair="g", z=0.4, g=0.6),
    259:     "arm_f_slender": _head("young", hair="j", j=1),
    260:     "arm_f_average": _head("generic", hair="a", a=1),
    261:     "arm_f_strong": _head("adult", hair="s", u=1),
    262:     "arm_f_sexy": _head("adult", hair="u", q=1),        # (faces/face_sexy.vrm, made in VRoid's editor 2026-10-13 from
    263:                                                         # its preset 11, read cuter than this, not sultrier: kept aside)
    264:     "arm_f_heavy": _head("generic", dict(cheek=0.4), hair="y", s=0.6, e=0.4),
    265:     "arm_f_old": _head("adult", hair="w", m=1),
    266: }
    267: HAIR_COLOURS = {"arm_m_lean": "black", "arm_m_average": "brown", "arm_m_strong": "black", "arm_m_heroic": "auburn",
    268:                 "arm_m_heavy": "brown", "arm_m_brute": "black", "arm_m_old": "grey", "arm_m_youth": "blond",
    269:                 "arm_f_slender": "blond", "arm_f_average": "brown", "arm_f_strong": "red", "arm_f_sexy": "black",
    270:                 "arm_f_heavy": "auburn", "arm_f_old": "grey"}
    271: EYE_COLOURS = {"arm_m_heroic": "blue", "arm_f_sexy": "green", "arm_f_slender": "blue", "arm_m_old": "grey",
    272:                "arm_f_old": "grey", "arm_m_youth": "amber"}
    273: PORTRAIT = {    # at rest and age lines: name -> shape extras (tools/vroid_portrait.py)
    274:     "arm_m_strong": dict(rest={"Fcl_BRW_Angry": 0.4}),
    275:     "arm_m_heroic": dict(rest={"Fcl_BRW_Angry": 0.25}),
    276:     "arm_m_brute": dict(rest={"Fcl_EYE_Close": 0.28, "Fcl_BRW_Angry": 0.75}),
  • read_file{"EndLine":464,"Path":"~/work/lowmarch/art/cast/cast.py","StartLine":277}

    input

    {
      "EndLine": 464,
      "Path": "~/work/lowmarch/art/cast/cast.py",
      "StartLine": 277
    }

    result, 189 lines

    Showing lines 277-464 of 464
    277:     # fangs: his teeth have sample V's two fangs (they show in an open mouth); fangs=0 files them away (owner's call)
    278:     "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,
    279:                                                                   "Fcl_BRW_Angry": 0.5, "Fcl_MTH_Down": 0.3}),
    280:     "arm_f_old": dict(age_lines=0.6, blush=0.3, rest={"Fcl_EYE_Close": 0.22, "Fcl_MTH_Down": 0.2}),
    281:     "arm_f_strong": dict(rest={"Fcl_BRW_Angry": 0.2}),
    282: }
    283: ARMORY = {      # name: (label, sex, its reference, cage spec beyond base and ref)
    284:     "arm_m_lean": ("Man, lean", "m", "ref_m_lean", dict(relax=4)),
    285:     "arm_m_average": ("Man, average", "m", "ref_m_average", dict(relax=4)),
    286:     "arm_m_strong": ("Man, strong", "m", "ref_m_strong", dict(relax=4, forms=CAGE_STRONG_FORMS)),
    287:     "arm_m_heroic": ("Man, heroic", "m", "ref_m_heroic", dict(relax=4, forms=CAGE_HEROIC_FORMS)),
    288:     "arm_m_heavy": ("Man, heavy", "m", "ref_m_heavy", dict(relax=4, forms=CAGE_HEAVY_FORMS)),
    289:     "arm_m_brute": ("Man, brute", "m", "ref_m_brute", dict(wrap_sigma=(0.02, 0.035), relax=4, forms=CAGE_BRUTE_FORMS)),
    290:     "arm_m_old": ("Man, old", "m", "ref_m_old", dict(relax=4)),
    291:     "arm_m_youth": ("Man, youth", "m", "ref_m_youth", dict(relax=4)),
    292:     "arm_f_slender": ("Woman, slender", "f", "ref_f_slender", dict(relax=4, bust_shape=dict(spread=0.008, drop=0.005, flat=0.25))),
    293:     "arm_f_average": ("Woman, average", "f", "ref_f_average", dict(relax=4, bust_shape=dict(spread=0.005, drop=0.008, flat=0.3))),
    294:     "arm_f_strong": ("Woman, strong", "f", "ref_f_strong", dict(relax=4, bust=0.1, forms=CAGE_STRONG_F_FORMS,
    295:                                                                   bust_shape=dict(spread=0.006, drop=0.006, flat=0.35))),
    296:     "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,
    297:                                                                                                spread=0.006, flat=0.4))),
    298:     "arm_f_heavy": ("Woman, heavy", "f", "ref_f_heavy", dict(relax=4, bust=0.3, forms=CAGE_HEAVY_F_FORMS,
    299:                                                                bust_shape=dict(scale=0.2, inflate=0.025, low=0.025, splay=0.015,
    300:                                                                                drop=0.03, spread=0.006, flat=0.45, base=0.1))),
    301:     "arm_f_old": ("Woman, old", "f", "ref_f_old", dict(relax=4, bust_shape=dict(spread=0.006, drop=0.015, flat=0.4))),
    302: }
    303: 
    304: CAST = {
    305:     "aldric": dict(  # young lord
    306:         model="hairsample_male/HairSample_Male.vrm", hair="sakurada_fumiriya/Sakurada Fumiriya.vrm",
    307:         # heroic proportions after the study's lord: about 7.4 heads (smaller head, longer legs), broad
    308:         # shoulders and chest over a narrower waist, thicker neck and limbs
    309:         shape=dict(eye=1.14, head=0.93, neck=1.14, chest=1.10, shoulders=1.28, arms=1.10, torso=1.06,
    310:                    legs=1.06, leg_len=1.05, hands=1.06),
    311:         colors=dict(A="#1d2a52", B="#2c4a8a", C="#3f74c0", D="#63a3e0", E="#a6d8f6",
    312:                     r="#21183a", s="#3b6ab0", t="#86c0ec", K="#4a2030", L="#7a2e3c", M="#a8444e", P="#d8747a",
    313:                     U="#161a38", V="#26305e", W="#3c4c8e", X="#6a7cc4"),
    314:         costume="lord",
    315:         # painted renderer: one signature cloth hue, neutral steel and brown leather (Unicorn Overlord
    316:         # study: two or three hues at most; gold only for royalty and only as small accents)
    317:         paint=dict(signature="#7d1e2c", doublet="#2a2d3d", heraldry="#dfe2e8", leather="#5f3e2b", boot="#4a3326",
    318:                    glove="#5f3e2b", steel="#a6adbb", gold="#b08b3f", hair="#3c6db3")),
    319:     "elaine": dict(  # knight-princess, swordswoman (the user's brief: a blonde swordswoman like Saber)
    320:         # the sample's hair cards are all dropped (hair_trim < 0): her hair is built by tools/hair.py
    321:         model="hairsample_female/HairSample_Female.vrm", hair=None, hair_trim=-1,
    322:         shape=dict(head=0.95, leg_len=1.04, shoulder_w=0.008, rest={"Fcl_BRW_Angry": 0.35}),
    323:         colors=dict(A="#6b4a1e", B="#a8782e", C="#d4a648", D="#ecd07a", E="#fbf0c0",
    324:                     r="#12321e", s="#2e8a4e", t="#9edcae", K="#18224f", L="#24398a", M="#3556b8", P="#6f8fe0",
    325:                     Q="#0f111b", R="#1b1e2c", S="#2a2e42", T="#41465e"),
    326:         costume="knight_dress",
    327:         paint=dict(signature="#2a4aa6", doublet="#1d2133", heraldry="#eef0f5", leather="#5a3d2b", boot="#4a3326",
    328:                    glove="#5a3d2b", steel="#b7bfcc", gold="#c9a34a", hair="#e2bf62", grain=dict(signature=0.015))),
    329:     # benchmark only, NOT FOR THE GAME (Saber is Type-Moon's): a fidelity test of the outline-plate kit on
    330:     # Elaine's base. The game's characters are original designs.
    331:     "saber": dict(
    332:         model="hairsample_female/HairSample_Female.vrm", hair=None, hair_trim=0.12,
    333:         shape=dict(head=0.95, leg_len=1.04, shoulder_w=0.008, rest={"Fcl_BRW_Angry": 0.35}),
    334:         colors=dict(A="#6b4a1e", B="#a8782e", C="#d4a648", D="#ecd07a", E="#fbf0c0",
    335:                     r="#12321e", s="#2e8a4e", t="#9edcae", K="#18224f", L="#24398a", M="#3556b8", P="#6f8fe0",
    336:                     Q="#0f111b", R="#1b1e2c", S="#2a2e42", T="#41465e"),
    337:         costume="saber_study",
    338:         # colours sampled from the study (royal blue dress, violet front panel, warm light steel)
    339:         paint=dict(signature="#2e5ba6", doublet="#1a1c26", heraldry="#f4f0e6", leather="#2a2326", boot="#3a3032",
    340:                    glove="#221d20", steel="#eceef2", gold="#d9b46a", hair="#ebc985", motif="#3a44a2",
    341:                    violet="#4440a0", ribbon="#5a58a8", grain=dict(signature=0.012, violet=0.012))),
    342:     # ---- common enemies (tools/mobs.py): a class costume on a base, a build and a face (tools/gear.py) ----
    343:     "mob_soldier": mob("base_male/Base_Male.vrm", "Soldier", "soldier", "average", "young", hair="brown", eyes="brown"),
    344:     "mob_mh_youth": mob(None, "MH youth", "soldier", "average", "young", hair="brown", eyes="brown", mh=MH_YOUTH),
    345:     "mob_mh_veteran": mob(None, "MH veteran", "soldier", "average", "veteran", hair="grey", eyes="grey", skin="tan",
    346:                           mh=MH_VETERAN, beard="short"),
    347:     "mob_mh_brute": mob(None, "MH brute", "soldier", "average", "brute", hair="red", eyes="blue", skin="fair",
    348:                         mh=MH_BRUTE, beard=("full", 0.06), age_lines=0.4, iris=0.88, blush=0.3,
    349:                         rest={"Fcl_EYE_Angry": 0.35}),
    350:     "mob_mh_f_youth": mob(None, "MH woman, young", "soldier_f", "average", "young", hair="black", eyes="amber", skin="brown",
    351:                           mh=MH_F_YOUTH),
    352:     "mob_mh_f_veteran": mob(None, "MH woman, veteran", "soldier_f", "average", "stern", hair="grey", eyes="grey",
    353:                             mh=MH_F_VETERAN, age_lines=0.5, iris=0.84, blush=0.0, mouth=1.05,
    354:                             rest={"Fcl_EYE_Angry": 0.45, "Fcl_EYE_Close": 0.1, "Fcl_EYE_Joy": 0.18, "Fcl_BRW_Angry": 0.45,
    355:                                   "Fcl_MTH_Down": 0.25}),
    356:     "mob_mh_f_strong": mob(None, "MH woman, strong", "soldier_f", "average", "plain", hair="red", eyes="green", skin="fair",
    357:                            mh=MH_F_STRONG),
    358:     "spk_mh_vroid_m": mob(None, "Man: MakeHuman + VRoid head", "soldier", "average", "young", hair="brown", eyes="brown",
    359:                           mh=MH_YOUTH, group="Round 1 · bases"),
    360:     "spk_mh_anime_m": mob(None, "Man: MakeHuman, own head", "soldier", "average", "young", hair="brown", eyes="brown",
    361:                           mh=_anime(MH_YOUTH), hair_style="crop", group="Round 1 · bases"),
    362:     "spk_qt_m": mob(None, "Man: Quaternius", "soldier", "average", "young", hair="brown", eyes="brown",
    363:                     qt=QT_M, hair_style="crop", group="Round 1 · bases"),
    364:     "spk_mh_vroid_f": mob(None, "Woman: MakeHuman + VRoid head", "soldier_f", "average", "young", hair="black", eyes="amber",
    365:                           skin="brown", mh=MH_F_YOUTH, group="Round 1 · bases"),
    366:     "spk_mh_anime_f": mob(None, "Woman: MakeHuman, own head", "soldier_f", "average", "young", hair="black", eyes="amber",
    367:                           skin="brown", mh=_anime(MH_F_YOUTH, **{"chin/chin-width": -0.7}), hair_style="crop", group="Round 1 · bases"),
    368:     "spk_qt_f": mob(None, "Woman: Quaternius", "soldier_f", "average", "young", hair="black", eyes="amber",
    369:                     skin="brown", qt=QT_F, hair_style="crop", group="Round 1 · bases"),
    370:     "spk_mh_sample_a_f": mob(None, "Woman: MakeHuman + VRoid sample A head", "soldier_f", "average", "young", hair="black",
    371:                              eyes="amber", skin="brown", mh=dict(MH_F_YOUTH, head="samples_2_14/avatarsample_a/AvatarSample_A.vrm"), group="Round 2 · VRoid"),
    372:     # bodies made in VRoid Studio by the Windows driver, exported without its clothes (they cut the skin they cover)
    373:     "spk_vroid_broad": mob("lowmarch_bodies/vroid_broad_v2.vrm", "Man: VRoid Studio, broad", "soldier", "average", "young",
    374:                            hair="brown", eyes="brown", group="Round 2 · VRoid"),
    375:     "spk_vroid_stocky": mob("lowmarch_bodies/vroid_stocky_v2.vrm", "Man: VRoid Studio, stocky", "soldier", "average", "young",
    376:                             hair="brown", eyes="brown", group="Round 2 · VRoid"),
    377:     # VRoid's Base_Male with MakeHuman's muscle and weight carried across (tools/mass.py), beside it unchanged
    378:     # and beside the MakeHuman brute whose mass they borrow
    379:     "spk_vroid_plain": mob("base_male/Base_Male.vrm", "Man: VRoid Base_Male", "soldier", "average", "young",
    380:                            hair="brown", eyes="brown", group="Round 2 · VRoid"),
    381:     "spk_vroid_muscular": mob("base_male/Base_Male.vrm", "Man: VRoid + MakeHuman muscle", "soldier", "average", "young",
    382:                               hair="brown", eyes="brown", mass=MASS_MUSCULAR, group="Round 2 · VRoid"),
    383:     "spk_vroid_heavy": mob("base_male/Base_Male.vrm", "Man: VRoid + MakeHuman weight", "soldier", "average", "young",
    384:                            hair="brown", eyes="brown", mass=MASS_HEAVY, group="Round 2 · VRoid"),
    385:     "spk_mh_brute": mob(None, "Man: MakeHuman brute + VRoid head", "soldier", "average", "brute", hair="red", eyes="blue",
    386:                         skin="fair", mh=MH_BRUTE, beard=("full", 0.06), age_lines=0.4, iris=0.88, blush=0.3,
    387:                         rest={"Fcl_EYE_Angry": 0.35}, group="Round 2 · VRoid"),
    388:     "spk_mh_anime_teen": mob(None, "MakeHuman own head, 15", "soldier", "average", "young", hair="blond", eyes="blue",
    389:                              skin="fair", mh=_anime(dict(macro=dict(g=1.0, age=0.30, muscle=0.35, weight=0.4,
    390:                                                                     height=0.4, proportions=0.5))),
    391:                              hair_style="crop", group="Round 1 · bases"),
    392:     "spk_mh_anime_old": mob(None, "MakeHuman own head, 70", "soldier", "average", "young", hair="grey", eyes="grey",
    393:                             skin="tan", mh=_anime(dict(macro=dict(g=1.0, age=0.85, muscle=0.5, weight=0.6,
    394:                                                                   height=0.45, proportions=0.4))),
    395:                             hair_style="crop", beard="short", group="Round 1 · bases"),
    396:     "mob_fighter": mob("hairsample_male/HairSample_Male.vrm", "Fighter", "fighter", "athletic", "veteran", hair="black",
    397:                        eyes="grey", skin="tan", hair_from="base_male/Base_Male.vrm", beard="short"),
    398:     "mob_hoplite": mob("base_male/Base_Male.vrm", "Hoplite", "hoplite", "stocky", "stern", hair="red", eyes="blue",
    399:                        skin="fair", beard="full", height=1.09, chest=1.16, arms=1.16),
    400:     "mob_berserker": mob("base_male/Base_Male.vrm", "Berserker", "berserker", "huge", "brute", hair="red", eyes="blue",
    401:                          beard=("full", 0.09)),
    402:     "mob_housecarl": mob("hairsample_male/HairSample_Male.vrm", "Housecarl", "housecarl", "stocky", "brute", hair="blond",
    403:                          eyes="grey", skin="fair", hair_from="base_male/Base_Male.vrm", beard=("full", 0.05)),
    404:     "mob_hunter": mob("avatarsample_d/AvatarSample_D.vrm", "Hunter", "hunter", "slim", "soft", hair="auburn", eyes="green",
    405:                       skin="olive", hair_from="base_female/Base_Female.vrm", paint=dict(signature="#4a5a38", linen="#cfc4a8")),
    406:     # the same soldier's kit on other bodies: generic units vary in build, age and sex
    407:     "mob_soldier_veteran": mob("hairsample_male/HairSample_Male.vrm", "Soldier (veteran)", "soldier", "stocky", "gaunt",
    408:                                hair="grey", eyes="grey", hair_from="base_male/Base_Male.vrm", beard="moustache"),
    409:     "mob_soldier_f": mob("base_female/Base_Female.vrm", "Soldier (woman)", "soldier_f", "slim", "stern", hair="black",
    410:                          eyes="amber", skin="brown"),
    411:     "mob_witch": mob("hairsample_female/HairSample_Female.vrm", "Witch", "witch", "slim", "gaunt", hair="blue", eyes="amber",
    412:                      skin="pale", hair_trim=0.12, height=1.03, paint=dict(signature="#3a2a4e", cloth="#2a2430")),
    413:     "mob_thief": mob("avatarsample_e/AvatarSample_E.vrm", "Thief", "thief", "slim", "young", hair="brown", eyes="brown",
    414:                      skin="tan", paint=dict(cloth="#2e2a30")),             # her own bob (borrowed hair left gaps)
    415:     "brannoc": dict(  # veteran knight
    416:         model="hairsample_male/HairSample_Male.vrm", hair=None,
    417:         shape=dict(face_len=0.12, jaw=0.5, chin_w=0.6, chin_len=0.4, cheek=-0.4, brow_ridge=0.6, nose=0.6,
    418:                    eye=0.92, neck=1.2, chest=1.06, rest={"Fcl_EYE_Close": 0.2, "Fcl_BRW_Angry": 0.35}),
    419:         colors=dict(A="#2a1a16", B="#4a2e22", C="#6e4630", D="#956548", E="#c08f68",
    420:                     r="#2a1a12", s="#5a3a1c", t="#9a7040", K="#2a3a2a", L="#3e5a3a", M="#5a7e50", P="#8aae78")),
    421:     "gorm": dict(  # brute
    422:         model="hairsample_male/HairSample_Male.vrm", hair="base_male/Base_Male.vrm",
    423:         shape=dict(head=0.92, face_len=0.06, jaw=1.0, chin_w=1.0, chin_len=0.3, cheek=0.5, brow_ridge=1.0,
    424:                    nose=0.4, nose_w=1.0, eye=0.95, mouth=1.15, neck=1.45, chest=1.18,
    425:                    rest={"Fcl_EYE_Close": 0.18, "Fcl_BRW_Angry": 0.6}),
    426:         colors=dict(A="#1c2a18", B="#2e4a22", C="#48702e", D="#6e9a3e", E="#a6c86a",
    427:                     r="#2a1a12", s="#6a4a20", t="#b08a40", K="#3a2a1a", L="#5a4028", M="#7e5a38", P="#aa8458")),
    428:     "pip": dict(  # youth
    429:         model="hairsample_male/HairSample_Male.vrm", hair=None,
    430:         shape=dict(head=1.05, face_len=-0.08, jaw=-0.3, chin_len=-0.3, eye=1.08, neck=0.85, chest=0.92),
    431:         colors=dict(A="#5a3a18", B="#96682a", C="#c89a3a", D="#e8c45a", E="#f8ec9a",
    432:                     r="#183a24", s="#2e7a3e", t="#7ac87a", K="#1a3a3a", L="#2a5a5a", M="#3e8080", P="#6ab0a8")),
    433:     "maren": dict(  # young woman, cleric
    434:         model="hairsample_female/HairSample_Female.vrm", hair="avatarsample_g/AvatarSample_G.vrm",
    435:         shape=dict(),
    436:         colors=dict(A="#4a1428", B="#8a2440", C="#c8445a", D="#e8788a", E="#f8b8c0",
    437:                     r="#3a1428", s="#a83a5a", t="#e8889a", K="#6a6a8a", L="#9a9ab8", M="#c8c8e0", P="#f4f4fc")),
    438:     "sylve": dict(  # cold mage
    439:         model="hairsample_female/HairSample_Female.vrm", hair="sendagaya_shino/Sendagaya Shino.vrm",
    440:         shape=dict(face_len=0.06, jaw=-0.3, chin_len=0.3, eye=0.95, eye_tilt=0.25, mouth=0.9,
    441:                    rest={"Fcl_EYE_Close": 0.15}),
    442:         colors=dict(A="#2e2a44", B="#5a5678", C="#8a86a8", D="#b8b6d0", E="#e8e6f4",
    443:                     r="#1d2a3a", s="#3a6a8a", t="#8ac0d8", K="#2a1a3a", L="#44285a", M="#643a80", P="#9a6ab4")),
    444: }
    445: 
    446: 
    447: for _n, (_arch, _spec, _opts) in ARMORY_REFS.items():
    448:     _sx = "m" if _spec["macro"]["g"] else "f"
    449:     # fitted to the archetype (tools/fit.py) and to real people of the body's height and waist (tools/anthro.py); on
    450:     # the fitted short necks only skin bound to the head is jaw
    451:     _spec = dict(_spec, fit=dict(archetype=_arch, sex=_sx, anthro=True, **_opts), jaw_hw=0.9)
    452:     CAST[_n] = dict(mob(None, _n, "underwear_f" if _sx == "f" else "underwear", "average", "young", hair="brown",
    453:                         eyes="brown", mh=_spec, hands=1.0), archetype=_arch, sex=_sx)
    454: for _n, (_label, _sx, _ref, _spec) in ARMORY.items():
    455:     # the pull falls short of the reference's thighs (most on the big ones) and VRoid's breasts are smaller than a
    456:     # slim reference's (the slender woman's cup at the 2nd percentile of her build): each body's own mid-thigh and
    457:     # cup are fitted to real people of its height and waist, as its reference's were (tools/cage.py swell, inflate)
    458:     _arch, _, _opts = ARMORY_REFS[_ref]
    459:     _fit = dict(archetype=_arch, sex=_sx, anthro=True, only=("thigh_p", "cup_p"), old=_n.endswith("_old"),
    460:                 **({"figure": _opts["figure"]} if "figure" in _opts else {}))
    461:     _spec = dict(_spec, base=_FEM if _sx == "f" else _MASC, ref=_ref, fit=_fit, face=HEADS[_n])
    462:     CAST[_n] = dict(mob(_spec["base"], _label, "underwear_f" if _sx == "f" else "underwear", "average", "bare",
    463:                         hair=HAIR_COLOURS.get(_n, "brown"), eyes=EYE_COLOURS.get(_n, "brown"), hands=1.0, cage=_spec, group="Men" if _sx == "m" else "Women", **PORTRAIT.get(_n, {})),
    464:                     archetype=ARMORY_REFS[_ref][0], sex=_sx, ranges=CHECK_RANGES.get(_n, {}))

agent

+13:42
reasoning

Inspecting the code, the arm_* characters within the CAST are generated through a specific function that accepts base specifications, labels, and an underwear designation based on gender. Examining how this function generates arm_m_heroic will inform how to generalize the approach.

Examining the generation logic, the goal is to generalize and adapt the function. Generating arm_f_slender or arm_f_strong in specific costumes and palettes, then comparing to arm_m_heroic in other outfits, is necessary. A script is needed to export character variations, solve the relevant clips, and render the output.