rig-parts 2.58.0 → 2.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/AUTHORING.md CHANGED
@@ -198,7 +198,7 @@ read by no CPU stage).
198
198
  | `bones` | rig; `propose --from-config` | **proposed** by `propose`, then corrected. A single bone `{name, parent, at, tip?}` or a chain `{chain, parent, points, tip, link_inherit?}` whose links are named `<chain>0 … <chain>n`. Parents come before children. In `rig.json` each link is **turned along its chain** — `rotation` is the direction from its origin to the next link's (the last link's to `tip`) and `length` that distance (issue #73), so a physics constraint added downstream finds a lever; under `--idle-keys ctl` the link's `<link>_ctl` carries the turn and the length and the link sits at local rotation 0 beneath it. A single bone with a `tip` is turned the same way, towards its tip, with that distance as its length (issue #239); a tip on the bone's own origin is refused (`RIG_TIP_DISTINCT`). The five face bones `eye_r`, `eye_l`, `brow_r`, `brow_l` and `mouth` (by name, when one has no tip of its own) are turned to the eye line — the line through the origins of `eye_r` and `eye_l` as `bones` writes them, read image-left to image-right, drawn when parts.json holds both an `eyewhite-r` and an `eyewhite-l` part — so the blink's `scaley` squashes across the eye line on a tilted head; move an eye bone and the line moves with it. With one eyewhite or none, or an eye bone missing, the rig stage's `face axis:` line says so and they keep the page's axes. A bone under a face bone keeps the face's axis. With the line, `rig.json` also declares `invariants.axes` — one entry, `"face"`, through `eye_r` and `eye_l`, holding the turned face bones (and their controls) — so rig-c's gate holds the build to the line; the line is the one rigc draws through the same two bones, so the tolerance is only the float floor — the largest gap the emitted (float32) bones have to it, rounded up to 6 places plus one 6-place unit — and the `face axis:` line prints it. With the line the rig stage also adds `head_up` (issue #250): a slotless bone under `head`, at head's origin, turned to the eye line + 90 degrees and as long as the eye midpoint lies from head's origin along that axis — the head's frame, which a rule that needs it reads; `head` keeps its own frame, so no key on it or under it changes meaning, and a config bone of that name is refused (`RIG_HEAD_UP_NAME_FREE`). A face bone with its own `tip` is held too (issue #258), in a second entry, `"face_tips"`, when its tip lies along the line within whole-pixel rounding — a tip written in whole pixels sits at most sqrt(2)/2 px off the point of the line it stands for, so its direction may sit up to asin((sqrt(2)/2) / length) degrees off — with its tolerance measured the same way; a tip further off is the bone's own axis, and the `face axis:` line names it with its gap and that bound. A failure is rig-c's `A51_BONES_LIE_ALONG_THEIR_DECLARED_AXIS` line, which names the bone and the fix (rig-c's `docs/AUTHORING.md` §3.7 and §5.2); with no line no entry is written and A51 reports SKIP. Every region on a turned bone is turned back, so the setup pose does not move. Any other single bone keeps world rotation 0; one whose parent is a link is turned back upright. A single bone may declare `inherit` (issue #348): what it takes from its parent's transform, one of rig-c's own mode names exactly as rig-c's table spells them — `normal`, `onlyTranslation`, `noRotationOrReflection`, `noScale`, `noScaleOrReflection` (rig-c's `RigBone.inherit`) — written to that bone in `rig.json` as declared; any other spelling, `"NoScale"` included (the runtime would fold its first letter; nothing here folds or maps), is refused (`CONFIG_BONE_INHERIT`), and a chain takes no `inherit` (`CONFIG_KEY_KNOWN`). A chain may instead declare `link_inherit` (issue #369), an object mapping its own expanded link names to those same modes, for example `"link_inherit": {"leg_r1": "noScale"}`. Only the named link changes; omitted links inherit normally. A key outside this chain is `CONFIG_NAME_RESOLVES`, with this chain's valid link names in the detail; a non-object or non-string mode is `CONFIG_FIELD_TYPE`, and another mode spelling is `CONFIG_BONE_INHERIT`. The mode is forwarded to the expanded link, or to its control under `--idle-keys ctl`, by the same rule as a single bone. This is an authored opt-in: `propose` does not add it. Its setup rotation is the turn from where rig-c's own poser puts the bone with no rotation of its own under that mode, so it still stands upright (or along its tip) at the setup pose. Where the idle gives the bone a `<bone>_ctl`, the mode goes on the control: the control is the bone the parent's rotation reaches, and the bone under it inherits normally, so the idle's keys moved onto the control still turn it. A foot that does not take its shin's rotation (`noRotationOrReflection` or `onlyTranslation`) keeps its shoe level while the leg is posed (`FEET_STAY_LEVEL`, §7); which mode is the author's. `noScale` keeps a shin or shoe's shape under a scaled parent but still takes the parent's rotation: a shoe that must also stay level needs a separate rotation constraint, for example a transform constraint from an unrotated bone. This does not change the proposed feet's existing inheritance or `FEET_STAY_LEVEL` default. An automatic mesh weighted through a bone with a mode other than `normal` gets no derived amplitude (its row names the bone) and no residual envelope (rig-c's `SKINNING_RANGE_UNSUPPORTED`). Absent, `rig.json` carries no `inherit` and no byte moves |
199
199
  | `meshes.<part>` | rig | **proposed**, then corrected. Generated modes below; `explicit` transfers an accepted mesh (see “An accepted mesh”). Exactly one mode is allowed. `grid` (the lattice: cell size, px — what `propose` writes for non-torso parts: by default one spacing for the figure, round(H / 37) rig px with H the height of every part's box together, a part whose tenth of its short side is already coarser keeping that, and under `propose --grid-rule part` the reference's tenth of the part's short side clamped to 5..36, issue #265), `contour` (the outline mode, authored or drafted for the chest carrier; the next row and "A contour mesh" below) or `auto` (the automatic mode, authored; "An automatic mesh" below) — two, or none, is `CONFIG_MESH_MODE`. In distance-generated modes: `r` (added to every distance before weighting: `w = 1/(d + r)²`), `segments` (a chain name, a bone name with a `tip`, or `[bone, [x0,y0], [x1,y1]]`), and, **authored**, optional, `exponent` (issue #161): a number above 0 that replaces the 2 in that rule, `w = 1/(d + r)^exponent` — a larger one hands each vertex more fully to its nearest bone; absent is 2 and changes no byte, a value that is not a number above 0 is `CONFIG_FIELD_TYPE` at `meshes.<part>.exponent`, and a declared one is echoed as `exponent` in the mesh's `mesh_report.json` row; the exponent is the distance rule's, so declared beside `rule: "heat"` it is refused (`CONFIG_FIELD_TYPE` at `meshes.<part>.exponent`). The segment list is the one authored decision about a layer: which bones may pull it. The slot's bone is the first segment's. Optional `rule` (issue #161): `"distance"` — the rule above, and what an absent `rule` means (every byte is the same) — or `"heat"`, bone heat over the part's own silhouette, in every mode: the lattice's art (alpha above 8, less any island a declared `stray` left out) with holes filled, or for `contour` and `auto` the silhouette their outline is traced from (that mode's art — alpha above 8 for `contour`, alpha 1 and above for `auto` — less any island a declared `stray` left out, holes filled, grown by its `margin`); each bound bone's sources are the silhouette pixels whose centre lies within 0.75 px of its segment (a pixel two bones reach goes to the nearer, a tie to the first listed), held at 1 for that bone and 0 for the others; the field is solved by row-major Gauss–Seidel over-relaxation to a sweep change under 1e-7 within 20000 sweeps; a vertex reads the nearest silhouette pixel and takes the same cap and floor (and `regions`) as the distance rule; `r` is not read. The mesh's `mesh_report.json` row gains `heat` (the constants, each bone's sources and sweeps, the residual). Any other value is `CONFIG_FIELD_TYPE`; a bound bone with no source pixel is `RIG_HEAT_BONE_SOURCE`, an island no bone has a source in `RIG_HEAT_ISLAND_SOURCE`, a solve past its sweep bound `RIG_HEAT_CONVERGED` — none is weighted 0. The rule is chosen per mesh, so `RIG_HEAT_BONE_SOURCE` names three remedies: move the segment onto the art, take the bone out of `segments`, or keep this part on the distance rule — the one to take when the bone anchors the part from outside its art (a torso bone under a neck), since the first moves a bone another part placed and the second drops the anchor (issue #303). On a lattice, `RIG_HEAT_ISLAND_SOURCE` on an island that is dust — at most 4 px and at most 0.1 % of the part's art px, `mesh-draft`'s line — names `meshes.<part>.stray` and the figure that leaves it out, with the value declared; an island above that line keeps the segment remedy, a real piece being a real authoring question. In every mode the mesh's `mesh_report.json` row's `bones` names the bones the emitted model binds for the attachment — the sorted set its weights in the written `rig.json` name, so a `turn` twin (`turn_<part>_<bone>`) or a stopped link's `<link>_d` where those rebind it, never the segment bone it stands for — the same list in every mode, `remesh --delta`'s included (issue #536) Optional `gather: false` keeps an exclusively bound non-segment limb rider at its authored draw position (issue #680); its binding and mesh geometry are unchanged. Remove the key for normal gathering; a non-rider is refused as `RIG_GATHER_RIDER`. `propose` drafts the chest-holding topwear as `contour` instead (issue #986), using the figure tolerance and spacing described below. For a one-layer figure it drafts `trunk_chest` as contour. Other garments keep their existing modes. |
200
200
  | `meshes.<part>.influence` | rig | **authored**, optional (issue #378), a mode beside `grid`, `contour` and `auto`: `{cell, radius, across, max, shape, hold_tip?}`, every field but `hold_tip` required, none defaulted. rig-c's `segments` lattice over the part at `cell` px, each vertex pulled by every link of the mesh's `segments` within `radius` px of it — a pull that falls to exactly 0 at `radius` (`shape` `"linear"` or `"smooth"`), across the `segments` entries or only within the nearest one (`across`), the strongest `max` kept. The lattice and the shares are computed by rig-c's own promised functions (`buildSegmentsLattice`, `segmentDistance`, `influenceShares`), so the rule is rig-c's (its AUTHORING §3.4.7), and the mesh is written with explicit weights like every other mode. `radius` is a length on this part: the rig stage measures the farthest lattice vertex's distance to its nearest link and refuses a radius at or under it (`RIG_INFLUENCE_REACH`), naming the distance. `propose --cloth` drafts it when a recipe declares `influence` and no `radius` (issue #518): the farthest vertex's distance plus 3 of the part's lattice cells, printed on a `LINT` line with both figures. Measured on the cloth fixture and the public `wind` example (#513: 8 covered parts, `render --folds` with the physics on under wind and a hip sway of 8° and 30°): a radius just above the floor folds **more** than the lattice (one skirt went from 0 to 55 folded frames), and a larger one is **not** safer (one fringe folded again at about 3–4× its farthest distance); +2 to +6 cells read 0 on every part, +2 at the edge. That reading counted folds only; read against `check` as well (the rig as built, under the wind schedule +1 → −1 → calm, `build --environment`, the three covered `wind` parts at the same number of cells), the window that holds is **+2 to +3 cells**, and +4 is the ceiling: `wind` `bottomwear`'s `CHECK_TIP_OVER_ROOT` ratio is 1.898 on the lattice, 1.801 at +2 cells, 1.590 at +3 and **1.471 at +4**, under the floor 1.4725, so the build fails there, and 1.351 at +6 (#513, rig-parts 1.52.0, rigc 2.60.0; the lattice, +3 and +4 read again on rig-parts 1.54.0, rigc 2.60.0, the same figures, #599). The drafted +3 sits in that window, one cell under the ceiling (no radius between +3 and +4 was read), and the window is a hypothesis until a third subject — each edge rests on one part — so state `radius` in the recipe to keep your own. `r`, `exponent`, `rule`, `influences`, `stray` and `ribs` belong to the distance rule or another mode and are refused beside it (`CONFIG_INFLUENCE_MODE`). `hold_tip` (issue #615) — `true` only, or absent: the pulled shares are smoothed by the lattice's held-fork passes (the cloth recipe's `split.hold_tip` sentence below: four passes of 1-ring mesh-edge averaging, self weight 0.5, floor 0.005) capped at the declared `max`, so no vertex binds more than `max` bones; absent, the shares are rig-c's as pulled and every byte is the one written before the field existed (`false`, a second spelling of absent, is `CONFIG_FIELD_TYPE`). The mesh's `mesh_report.json` row echoes it in `influence`. `propose --cloth` writes it, with `max` raised to at least 8 (the lattice's smoothing cap), on the parts a recipe with `influence` and `split.hold_tip: true` meshes; the rig stage reads it off the mesh and never the recipe. Measured on `wind` `bottomwear` and the cloth fixture's skirt under a 60° hip sway (#615, `render --folds`, physics on): `wind` `bottomwear` folds 41 frames as drafted before the field (max 6) and **0** with `hold_tip` and max 8, against its lattice's 5; with `hold_tip` at max 6 it reads 23, and at max 8 without `hold_tip` 3; the fixture skirt (recipe given `split.hold_tip`) reads 20 before and 0 with it, against its lattice's 0, and 0 at max 8 without it. So the raised `max` carries most of the gap and the smoothing the rest on `wind` (rig-parts 1.54.0, rigc 2.60.0; a split skirt without `hold_tip` is not smoothed and reads its 44 as before). For cloth and hair that should bend as one surface across its chains |
201
- | `meshes.<part>.contour` | rig | **authored or proposed**, optional (issue #84): `{tolerance, margin, spacing, maxEdge?, budget?, stray?, bridges?, regions?, bust?}`. `tolerance` — rig-c's Douglas–Peucker tolerance on the traced outline, px, 0 or more; `margin` — how far the silhouette grows before it is traced, px: 0, or 1 or more (a pixel joins when its centre lies within `margin` of an art pixel's centre; a value above 0 and below 1 adds nothing and is refused, `CONFIG_FIELD_TYPE`); `spacing` — the background interior spacing, px, above 0; `maxEdge` (issue #265) — the longest outline edge, px, above 0: every simplified edge longer than it is cut into `ceil(length / maxEdge)` equal pieces, each cut point on the 1/256 px grid, before any region or rib touches the outline (absent: nothing is cut, and no byte moves; under 2/256 px the rig stage refuses it, `CONTOUR_PARAMETER`, because two cut points could snap together); the row echoes it in `params` and counts the points it added in `contour.outlineCut`, both only when declared; `budget` — the most vertices the mesh may have (refused above it, nothing thinned); `stray` — the largest island, in art pixels, that may be left out of the mesh (absent: none is); `bridges` (issue #326) — `true`, its one value: islands are read in this order — **dust first** (those `stray` leaves out), **then faint islands** (every pixel's alpha under 64, a quarter of full opacity: left out the same way, their pixels kept in the image but not meshed, so not drawn, and named in the row's `contour.bridges.faint` with their px, brightest alpha and box), **then every visible island is meshed and bridged, whatever the bridge costs** — overdraw is reported, never a reason to drop art; the largest island, or a tie for it, is never left out, faint or not: dropping it would draft the part without its art, and a part whose main body is faint is a question about the layer, which the plan and the author own, not one for the mesh — and the pieces are joined into the one outline rig-c takes by bridges — the kept islands, holes filled, grow together by `margin`, so islands closer than about twice the margin are one grown silhouette, traced as one; each silhouette is traced, simplified, capped, refined and triangulated as a one-island mesh is; then, starting from the silhouette with the most art, the nearest pair of a vertex on the joined outline and one on a silhouette still apart whose quad holds (wound as the mesh, crossing no outline, holding no other vertex, one closed outline after) is joined by that quad, two triangles over no art, until none is apart. Coverage and overshoot read the silhouettes' triangles; a bridge's area is in `meshArea` and in the row's `contour.bridges` (`islands`, `units`, and per join `unit`, `span` — its two crossing edges, px — `area`, `vertices`, `pair`; and `faint`, only when an island was left out as faint), and the row's `params` echoes `bridges`, both only when declared; `art_coverage` counts a faint island's pixels as art not covered. Absent, a second island is refused as below and no byte moves; on one island it writes the mesh the undeclared entry writes. Any other value is `CONFIG_FIELD_TYPE`; beside `ribs` it is `CONTOUR_PARAMETER` (a rib runs across one outline); a join no pair makes is `CONTOUR_BRIDGE`. A bridge stretches with whatever pulls its two ends apart, so it belongs on a part whose pieces ride one bone — the only case `mesh-draft` drafts; a bridge adds no vertex (issue #570): its four corners, `contour.bridges.joins[].vertices`, are outline vertices of the two silhouettes it joins, and they are weighted as every vertex of the mesh is, by distance to every bone the mesh's `segments` name — no step of the weighting reads which island a vertex lies on, so where two islands ride two bones (two legs in one `legwear` on `leg_r` and `leg_l`) each island's vertices, the corners among them, take weight from the other island's bones too (selftest `CW100`: on its fixture the left island's two corners each take 0.35821 from the right island's bone, and none of its vertices less than 0.30431), and a part whose pieces must not pull each other is split into one part per piece; `regions` — local deformation regions, each `{name, shape, bone, spacing, band, cover?}` with `shape` `"circle"` (`cx, cy, r`) or `"polygon"` (`points`, 3 or more): `bone` is the region's control bone (any bone `bones` declares), `spacing` the interior spacing inside the region and its band, `band` the width the bone's weight falls across, and optional `cover` (issue #1548; non-empty part name, `CONFIG_FIELD_TYPE` otherwise; never drafted by `propose`), on a 2.5D turn `"surface"` part whose region `bone` lies in the other turn group's subtree, names the `"surface"` part in that other group (`turn.roles` for head, `turn.body.roles` for body) whose extended depth sheet supplies the region's other-group depth once at `bone`'s setup position (`g · D(z_cover)` across the band, with full-opacity `alpha === 255` support required on `cover`'s art at `bone`'s setup position, `RIG_TURN_BAND_COVER_SUPPORT`; declaring `cover` on a non-surface part, on a bone in the part's own turn group or outside both turn subtrees, or naming an undeclared, non-`"surface"` or sheetless part is `CONFIG_TURN_BAND_COVER`; absent, the band reads the part's own sheet and no byte moves). Every length and position is **rig px**, like every other in the config; the part image is the rig less `(x − 4, y − 4)` (its box less the pad), a translation, so a length is the same number in both. A region's `cx`, `cy`, `r`, `band` and `points` are multiples of 1/256 px (`CONFIG_FIELD_TYPE` otherwise); region names are unique per mesh (`CONFIG_REGION_NAME_UNIQUE`). `bust` (issue #475) — `{apex_r, apex_l, cleavage, alpha?: 0.22, clearance?: 3.8, bone_r?: "boob_r", bone_l?: "boob_l", spacing?: 14}`: derives the two circular regions `bust_r` and `bust_l` from the three rig-px landmarks `apex_r`, `apex_l` and `cleavage` (multiples of 1/256 px, `CONFIG_FIELD_TYPE` otherwise; projecting the torso midline `neck → chest → hip` onto `apex_r → apex_l` misses the cleavage by 14–93 px across all five calibrated 3/4-yaw characters, so all three points are required). With `d_s = \|cleavage − apex_s\|` and `D = \|apex_r − apex_l\|`, each side `s ∈ {r, l}` is placed at `cx = apex_s[0]`, `cy = apex_s[1]` with outer radius `R_s = d_s − clearance`, core radius `r_s = round(alpha × R_s)` and `band_s = round(R_s) − r_s` (`alpha` = 0.22, `clearance` = 3.8 px, `spacing` = 14 px, `bone_r` = `"boob_r"`, `bone_l` = `"boob_l"` by default, reproducing the five calibrated example characters within `<= 6 px`, max `\|ΔR\| = 5 px`, max `\|Δr\| = 3 px`). Refused when `clearance <= 0`, `R_r + R_l >= D`, or a derived `r_s` or `band_s` is not positive (`CONFIG_BUST_CLEARANCE`), when `bone_r` or `bone_l` is not declared in `bones` (`CONFIG_NAME_RESOLVES`), or when `contour.regions` also names `bust_r` or `bust_l` (`CONFIG_REGION_NAME_UNIQUE`). Both `propose` and `rig` read `contour.bust` through `contourRegionsOf` (`deriveBustRegions`), and hand-written `contour.regions` entries build byte-identically when `bust` is absent. The alpha threshold is not a field: art is alpha above 8, the lattice's and `check`'s Short outline edges amplify a cap or floor step in the vertex weights; the recorded grid, contour, bust and continuous-cut comparison is in "The weight cut" below. |
201
+ | `meshes.<part>.contour` | rig | **authored or proposed**, optional (issue #84): `{tolerance, margin, spacing, maxEdge?, budget?, stray?, bridges?, regions?, bust?}`. `tolerance` — rig-c's Douglas–Peucker tolerance on the traced outline, px, 0 or more; `margin` — how far the silhouette grows before it is traced, px: 0, or 1 or more (a pixel joins when its centre lies within `margin` of an art pixel's centre; a value above 0 and below 1 adds nothing and is refused, `CONFIG_FIELD_TYPE`); `spacing` — the background interior spacing, px, above 0; `maxEdge` (issue #265) — the longest outline edge, px, above 0: every simplified edge longer than it is cut into `ceil(length / maxEdge)` equal pieces, each cut point on the 1/256 px grid, before any region or rib touches the outline (absent: nothing is cut, and no byte moves; under 2/256 px the rig stage refuses it, `CONTOUR_PARAMETER`, because two cut points could snap together); the row echoes it in `params` and counts the points it added in `contour.outlineCut`, both only when declared; `budget` — the most vertices the mesh may have (refused above it, nothing thinned); `stray` — the largest island, in art pixels, that may be left out of the mesh (absent: none is); `bridges` (issue #326) — `true`, its one value: islands are read in this order — **dust first** (those `stray` leaves out), **then faint islands** (every pixel's alpha under 64, a quarter of full opacity: left out the same way, their pixels kept in the image but not meshed, so not drawn, and named in the row's `contour.bridges.faint` with their px, brightest alpha and box), **then every visible island is meshed and bridged, whatever the bridge costs** — overdraw is reported, never a reason to drop art; the largest island, or a tie for it, is never left out, faint or not: dropping it would draft the part without its art, and a part whose main body is faint is a question about the layer, which the plan and the author own, not one for the mesh — and the pieces are joined into the one outline rig-c takes by bridges — the kept islands, holes filled, grow together by `margin`, so islands closer than about twice the margin are one grown silhouette, traced as one; each silhouette is traced, simplified, capped, refined and triangulated as a one-island mesh is; then, starting from the silhouette with the most art, the nearest pair of a vertex on the joined outline and one on a silhouette still apart whose quad holds (wound as the mesh, crossing no outline, holding no other vertex, one closed outline after) is joined by that quad, two triangles over no art, until none is apart. Coverage and overshoot read the silhouettes' triangles; a bridge's area is in `meshArea` and in the row's `contour.bridges` (`islands`, `units`, and per join `unit`, `span` — its two crossing edges, px — `area`, `vertices`, `pair`; and `faint`, only when an island was left out as faint), and the row's `params` echoes `bridges`, both only when declared; `art_coverage` counts a faint island's pixels as art not covered. Absent, a second island is refused as below and no byte moves; on one island it writes the mesh the undeclared entry writes. Any other value is `CONFIG_FIELD_TYPE`; beside `ribs` it is `CONTOUR_PARAMETER` (a rib runs across one outline); a join no pair makes is `CONTOUR_BRIDGE`. A bridge stretches with whatever pulls its two ends apart, so it belongs on a part whose pieces ride one bone — the only case `mesh-draft` drafts; a bridge adds no vertex (issue #570): its four corners, `contour.bridges.joins[].vertices`, are outline vertices of the two silhouettes it joins, and they are weighted as every vertex of the mesh is, by distance to every bone the mesh's `segments` name — no step of the weighting reads which island a vertex lies on, so where two islands ride two bones (two legs in one `legwear` on `leg_r` and `leg_l`) each island's vertices, the corners among them, take weight from the other island's bones too (selftest `CW100`: on its fixture the left island's two corners each take 0.35821 from the right island's bone, and none of its vertices less than 0.30431), and a part whose pieces must not pull each other is split into one part per piece; `regions` — local deformation regions, each `{name, shape, bone, spacing, band, cover?, falloff?}` with `shape` `"circle"` (`cx, cy, r`) or `"polygon"` (`points`, 3 or more): `bone` is the region's control bone (any bone `bones` declares), `spacing` the interior spacing inside the region and its band, `band` the width the bone's weight falls across. The default eases the outer half of the band. Set `falloff: "linear"` to retain the prior weights (issue #1578). See [A contour mesh](#a-contour-mesh-meshespartcontour-issue-84). Optional `cover` (issue #1548; non-empty part name, `CONFIG_FIELD_TYPE` otherwise; never drafted by `propose`), on a 2.5D turn `"surface"` part whose region `bone` lies in the other turn group's subtree, names the `"surface"` part in that other group (`turn.roles` for head, `turn.body.roles` for body) whose extended depth sheet supplies the region's other-group depth once at `bone`'s setup position (`g · D(z_cover)` across the band, with full-opacity `alpha === 255` support required on `cover`'s art at `bone`'s setup position, `RIG_TURN_BAND_COVER_SUPPORT`; declaring `cover` on a non-surface part, on a bone in the part's own turn group or outside both turn subtrees, or naming an undeclared, non-`"surface"` or sheetless part is `CONFIG_TURN_BAND_COVER`; absent, the band reads the part's own sheet and no byte moves). Every length and position is **rig px**, like every other in the config; the part image is the rig less `(x − 4, y − 4)` (its box less the pad), a translation, so a length is the same number in both. A region's `cx`, `cy`, `r`, `band` and `points` are multiples of 1/256 px (`CONFIG_FIELD_TYPE` otherwise); region names are unique per mesh (`CONFIG_REGION_NAME_UNIQUE`). `bust` (issue #475) — `{apex_r, apex_l, cleavage, alpha?: 0.22, clearance?: 3.8, bone_r?: "boob_r", bone_l?: "boob_l", spacing?: 14}`: derives the two circular regions `bust_r` and `bust_l` from the three rig-px landmarks `apex_r`, `apex_l` and `cleavage` (multiples of 1/256 px, `CONFIG_FIELD_TYPE` otherwise; projecting the torso midline `neck → chest → hip` onto `apex_r → apex_l` misses the cleavage by 14–93 px across all five calibrated 3/4-yaw characters, so all three points are required). With `d_s = \|cleavage − apex_s\|` and `D = \|apex_r − apex_l\|`, each side `s ∈ {r, l}` is placed at `cx = apex_s[0]`, `cy = apex_s[1]` with outer radius `R_s = round(d_s − clearance)`, core radius `r_s = round(alpha × R_s)` and `band_s = R_s − r_s` (`alpha` = 0.22, `clearance` = 3.8 px, `spacing` = 14 px, `bone_r` = `"boob_r"`, `bone_l` = `"boob_l"` by default, reproducing the five calibrated example characters within `<= 6 px`, max `\|ΔR\| = 5 px`, max `\|Δr\| = 3 px`). Refused when `clearance <= 0`, `R_r + R_l >= D`, a derived `r_s <= 0`, or a derived `band_s < 0` (`CONFIG_BUST_CLEARANCE`), when `bone_r` or `bone_l` is not declared in `bones` (`CONFIG_NAME_RESOLVES`), or when `contour.regions` also names `bust_r` or `bust_l` (`CONFIG_REGION_NAME_UNIQUE`). Both `propose` and `rig` read `contour.bust` through `contourRegionsOf` (`deriveBustRegions`), and the derived pair keeps its linear falloff. To write the same circles directly in `contour.regions`, set `falloff: "linear"` on both entries. The alpha threshold is not a field: art is alpha above 8, the lattice's and `check`'s Short outline edges amplify a cap or floor step in the vertex weights; the recorded grid, contour, bust and continuous-cut comparison is in "The weight cut" below. |
202
202
  | `meshes.<part>.ribs` | rig | **authored**, optional (issue #188), in the `contour` and `auto` modes: `{<chain>: {stations}, …}`, each key a chain this mesh's `segments` name. Each link of the chain gets a row of vertices across the part at its origin and at `stations` points evenly between its origin and its end (`stations`, a whole number, 0 or more, required; a chain of L links carries L × (stations + 1) ribs), each rib a row of vertices across the part, kept as a row of locked edges; the rule is "Ribs along a chain" under "A contour mesh". Absent places none and changes no byte. Refused: a lattice mesh with ribs (`CONFIG_RIBS_MODE` — its vertices are its grid's corners), a key that is not one of the mesh's chains (`CONFIG_NAME_RESOLVES`), an object naming no chain or a `stations` that is not a whole number from 0 (`CONFIG_FIELD_TYPE`); at the rig stage `CONTOUR_RIB_ART`, `CONTOUR_RIB_LINK`, `CONTOUR_RIB_CROSSING`, `CONTOUR_RIB_EDGE` (the contour refusals). The mesh's `mesh_report.json` row gains `ribs` — the declaration, the ribs placed and the vertices they hold — and its contour report (the source's, in `auto`) lists each rib's vertices |
203
203
  | `meshes.<part>.influences` | rig | **authored or proposed**, optional (issue #284), in the `grid` and `contour` modes: `{maxInfluences?, floor?}`, at least one. `maxInfluences` — the most bones that pull one vertex, a whole number 1 or more, or `null`, no cap (every bone the mesh's `segments` name; `null` is the config's spelling of a bound declared absent, as in `maxOvershoot` and `weightJump`); absent is 4. `floor` — `"cut"` (the capped shares normalised, any under 0.03 dropped, the rest normalised again; what an absent `floor` means) or `"continuous"` (0.03 subtracted from every capped share, those at or below 0 dropped, the rest normalised again, so a bone fades out of a vertex instead of leaving it in one step). Absent, the mesh is weighted at 4 and the cut and every byte is the one written before the field existed; declared, it applies under either `rule`, and is echoed as `influences` in the mesh's `mesh_report.json` row. `propose` writes `{maxInfluences: null, floor: "continuous"}` only on a newly drafted contour torso whose segments name a chain or its links, with a note explaining the short-outline-edge weight step (issues #986, #991). Other drafts and authored contour entries retain their policy, and `mesh-draft` carries a lattice's declaration to the contour candidate it drafts. A cap that is not a whole number 1 or more or `null` (the string `"none"` included), another `floor`, or an object naming neither is `CONFIG_FIELD_TYPE`; a vertex the declared cut leaves with no bone is `RIG_INFLUENCES_KEPT`; beside `auto` it is `CONFIG_INFLUENCES_MODE` (that mode's cap and floor are `auto.influences`). What each setting trades is "The weight cut" below |
204
204
  | `meshes.<part>.stray` | rig | **authored**, optional (issue #303), in the `grid` mode: the largest island, in art pixels, that may be left out of the lattice — the contour mode's `contour.stray`, with the same meaning, over the same islands (the 4-connected islands of the art, alpha above 8): every island of `stray` art px or fewer is cleared from the art the lattice and, under `rule: "heat"`, its silhouette are built over, except an island as large as the largest, which is never left out (two equal largest pieces both stay). Unlike the contour mode an island above the figure is not refused — the lattice bridges every island it keeps, as it always has. An island that sits in a cell the lattice keeps for other art leaves the lattice unchanged: there `stray` changes only the silhouette `rule: "heat"` reads, and gives back no triangle (demo `bottomwear`'s 2 px island, in the cell kept for the hem's tip, is that case). Absent, nothing is left out and every byte is the one written before the field existed; a figure that leaves nothing out changes no byte of `rig.json` or `motion.json`. The part's image is not touched: a pixel left out stays in it, and is drawn only where a cell kept for other art happens to cover it; `art_coverage` is over all the art, the islands left out included. Declared, the mesh's `mesh_report.json` row echoes `stray` and adds `stray_cleared` (`islands`, `pixels`, `art_pixels`, after `influences`), and the rig stage's mesh line ends `stray <n> left out <i> island(s), <p> of <a> art px`. A value that is not a whole number from 0 is `CONFIG_FIELD_TYPE`; beside `contour` or `auto` it is `CONFIG_STRAY_MODE` (those modes state it in `contour.stray` and `auto.source.stray`). `propose` and `mesh-draft` never write it |
@@ -2500,18 +2500,29 @@ depth sheet or generated key, and adds no winding validator. Lattice meshes,
2500
2500
  head turns, unrelated animations and attachments absent from the generated
2501
2501
  body-turn deform get no contour/body-turn advice.
2502
2502
 
2503
- **Weights.** A region's bone takes `g` at a vertex: 1 inside the region (its edge included),
2504
- `1 − d/band` at a distance `d` past it, 0 at `d ≥ band` (with `band` 0, a step) — linear, no
2505
- curve. The rest, `1 − g`, is shared among the segment bones exactly as the lattice shares a
2506
- vertex (`w = 1/(d + r)²`, at most 4 bones, the 0.03 floor inside that share). A vertex no
2507
- region reaches is weighted and rounded exactly as a lattice vertex at the same point would be.
2508
- With a region present: a region bone that is also a segment bone is one entry,
2509
- `g + (1 − g)·share`; when the segment share already holds 4 bones and the region's bone is not
2510
- one of them, the lightest segment bone is dropped (never `g`); the 0.03 floor is not applied
2511
- again to the scaled shares; the weights are rounded to 5 places, an entry rounding to 0 is
2512
- dropped, and the remainder goes to the heaviest entry, so each vertex sums to exactly 1
2513
- (`src/localweights.ts`, `roundShares` in `src/rig.ts`). The 1 and the 0 are decided exactly on
2514
- the 1/256 px grid; only a value in between is a floating-point figure. A region's bone counts
2503
+ **Weights.** The nominal share `g` is 1 inside or on the region, `1 − d/band` at a
2504
+ distance `0 < d < band`, and 0 at or past the outer edge. With `band: 0`, the share
2505
+ steps directly from 1 to 0. The endpoints are decided exactly on the 1/256 px grid.
2506
+ Two regions with `g > 0` at the same vertex are refused before weighting.
2507
+
2508
+ By default, a region listed in `contour.regions` uses `4g²(1 − g)` for
2509
+ `0 < g < 0.5` and uses `g` everywhere else (issue #1578). The cubic starts at
2510
+ the outer edge with zero slope and meets the inner half with matching value
2511
+ and slope. Set `falloff: "linear"` on a declared contour region to use `g`
2512
+ throughout the band and recover its old weights. Other explicit values are
2513
+ `CONFIG_FIELD_TYPE`. Regions derived from `contour.bust` and automatic mesh
2514
+ regions keep their linear weighting. Zero-width bands still use a hard edge.
2515
+
2516
+ With selected region share `w_region`, the segment bones split `1 − w_region`
2517
+ in the same proportions as the lattice (`w = 1/(d + r)²`, at most 4 bones, a
2518
+ 0.03 floor before scaling). If the region bone is also a segment bone, its
2519
+ single entry takes `w_region + (1 − w_region)·share`. If the region adds a bone
2520
+ to a full set of segment shares, the lightest segment bone is dropped and the
2521
+ remaining segment shares are renormalized before scaling. At a reached vertex,
2522
+ the weights are rounded to 5 places and entries rounding to 0 are dropped.
2523
+ The heaviest entry absorbs the rounding remainder so the weights sum to 1
2524
+ (`src/localweights.ts`, `roundShares` in `src/rig.ts`). A vertex outside the
2525
+ support uses the lattice's weighting and rounding. A region's bone counts
2515
2526
  as a mesh bone, so an idle key on it moves to `<bone>_ctl` under `--idle-keys ctl` like a
2516
2527
  segment bone's.
2517
2528
 
@@ -2680,7 +2691,8 @@ unreduced source on the rig's idle and passes the author's bounds (step 4). The
2680
2691
  joined to the outside only at a corner counts as outside and a source spanning it is refused
2681
2692
  here (`CONTOUR_OVERSHOOT`, "the background flooded 8-connected"), with the number rig-c would
2682
2693
  read, rather than by rig-c's admission after the call. The row's `source.contour` says so
2683
- (`fitConnectivity: 8`); the contour mode keeps its 4-connected reading and writes no such key. Its weights are the contour mode's — segments and region falloff — under the author's
2694
+ (`fitConnectivity: 8`); the contour mode keeps its 4-connected reading and writes no such key.
2695
+ The source blends segment shares with the linear region falloff under the author's
2684
2696
  `influences`, with no 0.03 floor unless the author writes one.
2685
2697
  2. **The call** — rig-c's `reduceMesh` (`@rig-c/core/mesh`, 2.28.x) refines inside the declared
2686
2698
  regions, then removes vertices while every declared bound still holds. Every number it is
@@ -2860,7 +2872,7 @@ wall time goes to standard error, not into the table).
2860
2872
  | `minArtSamples` | the fewest art pixels a raster row is taken over, 1 or more |
2861
2873
  | `motion` | **required**: `maxLocalDeformation` (rig px, 0 or more — how far the reduced mesh may carry any art pixel from where its source carries it, at any frame); optional `maxStretch` / `minStretch` (ratios; absent, the rows are reported and not gated); optional `deformMayFold` (absent is **false**: a triangle that turns over refuses the part; true declares the slot in `invariants.deformMayFold` and lists every fold instead); optional `gradation` (px per px, 0 or more, or `null`; the author's G for `MQ_ALLOCATION_CONTRAST`, never derived — absent or `null`, the contrast reads `not-measurable` naming it; see *The allocation rows* below); optional `selection` (`{ "policy": "multi-interval", "maxProbes": <whole number, 1 or more> }`; absent, the acceptance loop is the bisection — see *The multi-interval selection* above); optional `residual` (`{ "maxResidual": <px, 0 or more> }`; absent, nothing is sent — see *The skinning residual as a per-step veto* above) |
2862
2874
  | `protect` | optional; each field optional: `hull` (true keeps every source outline vertex; absent is **false**, the default agreed for this mode), `vertices` and `edges` (source vertex indices and pairs that must survive), `regionBoundaries` (region names whose outline vertices must survive), `weightJump` (an L1 weight difference above which a source edge is kept; absent is none), `influences` (bones never pruned from a vertex; every region's bone is added) |
2863
- | `regions` | optional, each `{name, shape, bone?, band?, maxEdgeLength, transition, grade, minArtSamples}` with `shape` `"circle"` (`cx, cy, r`) or `"polygon"` (`points`): `bone` and `band` are the control bone and its weight falloff exactly as a contour region's (rig px, multiples of 1/256 px), written together (the region weights its bone and asks for density) or not at all (density only, issue #155; one without the other is refused by name); `maxEdgeLength` is L0, the longest an edge meeting the region may be, px; outside it, across `transition` px, the bound relaxes as `L0 + grade·d`; `transition` 0 is a hard edge; `minArtSamples` is the region's own sample floor |
2875
+ | `regions` | optional, each `{name, shape, bone?, band?, maxEdgeLength, transition, grade, minArtSamples}` with `shape` `"circle"` (`cx, cy, r`) or `"polygon"` (`points`): `bone` and `band` declare the control bone and its linear weight falloff (rig px, multiples of 1/256 px), written together (the region weights its bone and asks for density) or not at all (density only, issue #155; one without the other is refused by name). Automatic regions reject `falloff` as `CONFIG_KEY_KNOWN`. `maxEdgeLength` is L0, the longest an edge meeting the region may be, px; outside it, across `transition` px, the bound relaxes as `L0 + grade·d`; `transition` 0 is a hard edge; `minArtSamples` is the region's own sample floor |
2864
2876
  | `boundaryRuns` | optional, `{ maxVertices }`, a whole number 2 or more, no default: each removal pass first tries to replace a run of 2 to `maxVertices` consecutive source-hull vertices with one chord, as one step held to every declared row (below) |
2865
2877
  | `retriangulate` | optional, `"delaunay"`: once the reduction ends, the kept vertices are re-triangulated by Delaunay flips, taken whole only when every declared row still passes (below) |
2866
2878
  | `removalOrder` | optional, `"deformation-load"`: the single removals are tried in ascending predicted load instead of ascending source index (below) |
@@ -4045,14 +4057,18 @@ assemble/config step; this bounded draft names that refusal. Reassembly uses the
4045
4057
  CLI defaults `seam=near-white` and `project=core`, explicitly stated in its note
4046
4058
  because `parts.json` does not record the source command's selected rules.
4047
4059
 
4048
- The `note:` line derives `turn.body.unitDepths.<part>` as
4049
- `round4(bodyPivot + neckWorldMedian - firstBodySurfaceWorldMedian)`, using the
4050
- existing scalar sheet, declared `near` polarity and `zScale`. If the new source
4060
+ The draft writes the neck's world median to `turn.body.unitDepths.<part>`,
4061
+ using the existing scalar sheet, declared `near` polarity and `zScale`.
4062
+ The note also reports the projected depth the rig stage computes as
4063
+ `round4(bodyPivot + neckWorldMedian - firstBodySurfaceWorldMedian)`.
4064
+ If the new source
4051
4065
  has no sheet, only new opaque art overlapping the previous registered neck
4052
4066
  sheet is sampled. An absent sheet, empty overlap, missing body reference or
4053
4067
  missing pivot is refused by name; legacy `depth_median` is never converted to
4054
4068
  world units. Other proposal modes (`--keypoints`, `--compare`, `--grid-rule`,
4055
4069
  `--only-missing`) must run separately and are refused in this mode.
4070
+ For a config drafted before #1575, copy the neck world median from the original
4071
+ draft note into its body unit depth, or draft again from the same source.
4056
4072
 
4057
4073
  **The chest on such a config (issue #1436).** With `--bust-landmarks <file>` or
4058
4074
  `--no-bust "<reason>"` and without `--full` and `--head`, `propose --write-config`
@@ -7245,8 +7261,9 @@ and stay absent).
7245
7261
  | <a id="RIG_TURN_GRID_BUDGET"></a>`RIG_TURN_GRID_BUDGET` | a `"surface"` grid exceeds 2,400 triangles on one slot or 4,000 triangles across all `"surface"` slots | lower `config.turn.grid` / `config.turn.body.grid` `[cols, rows]` within the per-slot and total budgets |
7246
7262
  | <a id="RIG_TURN_HEAD_BONE"></a>`RIG_TURN_HEAD_BONE` | `buildRig` found no `"head"` (or body turn root) bone when emitting 2.5D turn carriers | declare `"head"` (or the body turn root bone) in `config.bones` |
7247
7263
  | <a id="RIG_TURN_BOUNDARY_DEPTH"></a>`RIG_TURN_BOUNDARY_DEPTH` | boundary names or sheets do not resolve; surfaces are not different, abutting without overlap in one group with common units; band is empty/outside/not boundary-reaching; declarations cycle; or grid support is missing | use exact existing parts, different abutting surfaces in one group with common near/zScale, a contained nonempty band reaching their boundary, acyclic declarations and the generated grid support |
7248
- | <a id="RIG_TURN_SHARED_DEPTH_SCALE"></a>`RIG_TURN_SHARED_DEPTH_SCALE` | `"surface"` parts bound to one head or body turn declare different `near` polarities or `zScale` values | use one shared `near` and `zScale` across all `"surface"` parts in the turn group |
7264
+ | <a id="RIG_TURN_SHARED_DEPTH_SCALE"></a>`RIG_TURN_SHARED_DEPTH_SCALE` | `"surface"` parts bound to one head or body turn declare different `near` polarities or `zScale` values | use one shared `near` and `zScale` across all `"surface"` parts in the turn group. The check runs separately for the head and body role sets, so if a surface belongs to both, use the larger required `zScale` in both groups. |
7249
7265
  | <a id="RIG_TURN_UNIT_DEPTH_REQUIRED"></a>`RIG_TURN_UNIT_DEPTH_REQUIRED` | a `"unit"` bone has neither a `unitDepths` entry nor a readable `"surface"` depth sheet | provide a `"surface"` depth sheet or an explicit `unitDepths.<part>` value |
7266
+ | <a id="RIG_TURN_BODY_UNIT_CARRIER"></a>`RIG_TURN_BODY_UNIT_CARRIER` | an explicit body unit depth has no movable carrier for its binding, or a shared carrier needs incompatible depths | bind the unit to a movable body branch and use independent branches for different depths |
7250
7267
  | <a id="RIG_TURN_UNIT_DEPTH_SUPPORT"></a>`RIG_TURN_UNIT_DEPTH_SUPPORT` | WARN only: an implicit unit depth sample is outside the source surface pixel-index bounds or its sampled art alpha is below 255 | author an explicit calibrated `unitDepths.<part>` value when this cross-part extrapolation is unintended; existing scalar sampling and refusal behavior are retained |
7251
7268
  | <a id="RIG_TURN_EAR_DEPTH_BEHIND_CHEEK"></a>`RIG_TURN_EAR_DEPTH_BEHIND_CHEEK` | an ear bone in `config.turn.roles` has a calibrated depth at or in front of the cheek surface depth | place the ear behind the cheek surface (for example via `config.turn.unitDepths`) |
7252
7269
 
@@ -9972,20 +9989,36 @@ re-run depth for these inputs, then call
9972
9989
  `rig-parts depth-bind --map <numeric-map.json> --input <prepared.png> --part <name>`. Malformed
9973
9990
  present receipts also refuse. Symlinked receipts, including dangling links, are
9974
9991
  refused; a regular file is required. Preparing again never rebinds a map.
9975
- Under the compatibility policy dated **2026-11-16**, a missing receipt preserves
9976
- legacy output bytes and exits, with one `DEPTH_MAP_BINDING_ABSENT` WARN per
9977
- selected map on stderr. This is unverified inference-input identity, not a
9992
+ Under the compatibility policy dated **2026-11-16**, an otherwise valid recipe
9993
+ can use a map with a missing receipt. This adds one `DEPTH_MAP_BINDING_ABSENT`
9994
+ WARN per selected map on stderr. This is unverified inference-input identity, not a
9978
9995
  binding pass. The provider flow calls the writer when producing a map. The writer binds these
9979
9996
  files at invocation; it cannot prove the map was inferred from that input.
9980
9997
  Parts does not run inference or invent provenance.
9981
9998
 
9982
- Apply computes `u=(raw-median(raw))/(p95-p5)` inside original alpha >=128,
9983
- using linear percentiles, then `Z=median+relief*u`. A flat map requires explicit
9984
- relief 0. Encode `Z/zScale` for near white, `1-Z/zScale` for near black, clip to
9985
- [0,1], and round to the nearest 8-bit level with even ties. Extend every
9986
- non-support pixel with the Euclidean nearest support value, with row-major ties.
9999
+ Apply computes `u=(raw-median(raw))/(p95-p5)` on original part pixels with
10000
+ alpha >= 128, using linear percentiles, then `z=median+relief*u`. A flat map
10001
+ requires explicit relief 0 and uses a zero relief offset. Every supported pixel
10002
+ must satisfy `0 < z < zScale` before encoding. `DEPTH_APPLY_CLIPPED` refuses
10003
+ any nonzero clip fraction before writing outputs. The fraction counts supported
10004
+ pixels with `z <= 0` or `z >= zScale` divided by all supported pixels.
10005
+
10006
+ For upper clipping, the refusal gives the smallest binary64 group `zScale`
10007
+ strictly above the maximum original supported depth in the group. For each part
10008
+ with lower clipping, it gives the minimum authored `median`, the next binary64
10009
+ value above the maximum of `-(relief*u)` across that part's supported pixels.
10010
+ It also gives the difference between that target and the previous authored
10011
+ median in rig pixels. Both remedies are reported when both boundaries clip.
10012
+ If no finite scale clears the upper boundary, revise the median or relief.
10013
+ If no finite median clears the lower boundary, reduce the relief.
10014
+ Recompute the group scale if changing medians changes the maximum supported
10015
+ depth, then prepare the revised recipe again.
10016
+
10017
+ Encode `z/zScale` for near white or `1-z/zScale` for near black and round to
10018
+ the nearest 8-bit level with even ties. Extend every non-support pixel with the
10019
+ Euclidean nearest support value, with row-major ties.
9987
10020
  The resulting opaque gray sheet carries no background cliff. The report names
9988
- levels, clip fraction (Z <=0 or >=zScale on support), declared relief in rig
10021
+ levels, clip fraction (zero on success), declared relief in rig
9989
10022
  pixels, group pivot, sign, raw median/p5/p95 and source/input/map/sheet hashes.
9990
10023
  It reports measurements, not a depth-quality pass mark. `rig` still runs Core's
9991
10024
  gate; apply writes parts and configuration, never a skeleton or a gate verdict.
@@ -10033,10 +10066,9 @@ same medians, group pivot and `zScale`; only the declared relief changes.
10033
10066
  Read each named report row's `relief`, `zScale` and `clipFraction` before
10034
10067
  judging its render. The clipping denominator is every original part pixel
10035
10068
  with alpha >=128, including boundary support, never the padded input area.
10036
- A low clipped fraction does not establish shape quality. Inspect setup,
10037
- both yaw endpoints and their difference at native scale, then enlarge the
10038
- same pixels with nearest-neighbour sampling. Neither clipping nor agreement
10039
- with a reference map substitutes for that inspection.
10069
+ Use those readings to confirm the calibration. To judge shape quality, inspect
10070
+ setup, both yaw endpoints and their difference at native scale, then enlarge
10071
+ the same pixels with nearest-neighbour sampling.
10040
10072
 
10041
10073
  The owner's preference for per-part volume is subjective provenance, not an
10042
10074
  automated quality conclusion. Model licence posture remains the owner's choice.
@@ -10051,25 +10083,108 @@ by `rig`, so their output requires no alternate compiler or dependency pin.
10051
10083
  | rule | refused input | remedy |
10052
10084
  | --- | --- | --- |
10053
10085
  | <a id="DEPTH_RECIPE"></a>`DEPTH_RECIPE` | unknown, absent or wrongly typed recipe field, group, source or frame | use the documented explicit recipe schema; no guessed field |
10054
- | <a id="DEPTH_RECIPE_NUMBER"></a>`DEPTH_RECIPE_NUMBER` | missing/nonfinite median, relief, near-scale pivot or prepare number; invalid range/integer | declare every numeric field in its documented units and range |
10055
- | <a id="DEPTH_INPUT_PRESENT"></a>`DEPTH_INPUT_PRESENT` | declared JSON input missing or not a file | restore the named file |
10086
+ | <a id="DEPTH_RECIPE_NUMBER"></a>`DEPTH_RECIPE_NUMBER` | missing or nonfinite median, relief, group scale or pivot, or prepare number. Also covers invalid ranges, invalid integers and invalid numeric `place.pivot` | declare numbers in the documented units and range, or use `"anchor"` for the placement pivot |
10087
+ | <a id="DEPTH_INPUT_PRESENT"></a>`DEPTH_INPUT_PRESENT` | declared input missing or not a file, or `depth-map` input unreadable or prepared PNG undecodable | restore the named readable input file in its expected format |
10056
10088
  | <a id="DEPTH_INPUT_JSON"></a>`DEPTH_INPUT_JSON` | malformed numeric or configuration JSON | write valid finite JSON |
10057
10089
  | <a id="DEPTH_PART_RESOLVES"></a>`DEPTH_PART_RESOLVES` | selected or cleared name absent from parts.json | use the assembled part name |
10058
- | <a id="DEPTH_OUTPUT_EMPTY"></a>`DEPTH_OUTPUT_EMPTY` | nonempty output or output containing an input | choose a separate absent or empty directory |
10059
- | <a id="DEPTH_MAP_BINDING"></a>`DEPTH_MAP_BINDING` | malformed present map receipt, wrong part, map hash or inference-input hash | re-run depth for these inputs, then `rig-parts depth-bind --map <numeric-map.json> --input <prepared.png> --part <name>` |
10060
- | <a id="DEPTH_MAP_BINDING_ABSENT"></a>`DEPTH_MAP_BINDING_ABSENT` | WARN only: no receipt, compatibility policy dated 2026-11-16 | legacy behavior is retained; re-run depth for these inputs, then `rig-parts depth-bind --map <numeric-map.json> --input <prepared.png> --part <name>` |
10090
+ | <a id="DEPTH_OUTPUT_EMPTY"></a>`DEPTH_OUTPUT_EMPTY` | nonempty output directory or output containing an input, or `depth-map` cannot create its output exclusively | choose a separate absent or empty output directory, or for `depth-map` an absent output file in a writable directory |
10091
+ | <a id="DEPTH_MAP_BINDING"></a>`DEPTH_MAP_BINDING` | invalid part name for `depth-map` or `depth-bind`, or malformed present map receipt, wrong part, map hash or inference-input hash | use a nonempty plain part filename for the command, or re-run depth for the affected receipt and call `rig-parts depth-bind --map <numeric-map.json> --input <prepared.png> --part <name>` |
10092
+ | <a id="DEPTH_MAP_BINDING_ABSENT"></a>`DEPTH_MAP_BINDING_ABSENT` | WARN only: no receipt, compatibility policy dated 2026-11-16 | re-run depth for these inputs, then `rig-parts depth-bind --map <numeric-map.json> --input <prepared.png> --part <name>` |
10061
10093
  | <a id="DEPTH_INPUT_BINDING"></a>`DEPTH_INPUT_BINDING` | changed recipe, art, part record, crop, padding or inference PNG | prepare again for these exact inputs |
10094
+ | <a id="DEPTH_ARRAY_FORMAT"></a>`DEPTH_ARRAY_FORMAT` | unsupported NumPy version, malformed header, wrong dtype or order, or payload byte count does not match the header | export `.npy` v1.0, v2.0 or v3.0 as little-endian float32 or float64 in C order |
10095
+ | <a id="DEPTH_ARRAY_KIND"></a>`DEPTH_ARRAY_KIND` | unknown `depth-map --kind` | declare `depth` or `normals` |
10096
+ | <a id="DEPTH_ARRAY_SHAPE"></a>`DEPTH_ARRAY_SHAPE` | rank, dimension or channel count does not match the declared kind | export `(H,W)` or `(H,W,1)` for depth and `(H,W,3)` for normals, with positive safe integer dimensions |
10097
+ | <a id="DEPTH_ARRAY_PADDING"></a>`DEPTH_ARRAY_PADDING` | malformed padding or padding removes the entire extent on either axis | declare four nonnegative safe integers in left, top, right, bottom order that leave a nonempty crop |
10098
+ | <a id="DEPTH_ARRAY_SIZE"></a>`DEPTH_ARRAY_SIZE` | cropped dimensions are not positive integer multiples of the prepared PNG dimensions on both axes | check the input PNG and declare the raw array's actual padding, or re-export at a supported size |
10099
+ | <a id="DEPTH_ARRAY_NONFINITE"></a>`DEPTH_ARRAY_NONFINITE` | retained raw depth pixel contains `NaN` or an infinity | export finite depth values at the named raw pixel |
10100
+ | <a id="DEPTH_ARRAY_NORMAL"></a>`DEPTH_ARRAY_NORMAL` | retained raw normal is zero or nonfinite, or a pooled normal cancels to zero | export finite nonzero signed XYZ normals in image axes and inspect the named raw or output pixel |
10062
10101
  | <a id="DEPTH_MAP_FORMAT"></a>`DEPTH_MAP_FORMAT` | wrong numeric schema, channels, shape, count, unknown field or nonfinite element | provide the declared float JSON map, not a preview |
10063
- | <a id="DEPTH_MAP_SIZE"></a>`DEPTH_MAP_SIZE` | map dimensions differ from its explicit frame | use the registered part, enlarged art or padded input grid |
10102
+ | <a id="DEPTH_MAP_SIZE"></a>`DEPTH_MAP_SIZE` | map dimensions differ from its explicit frame | use the registered part, enlarged art or padded input grid for a per-part map, or `parts.json`'s `rig_size` for a placement map |
10064
10103
  | <a id="DEPTH_MAP_SUPPORT"></a>`DEPTH_MAP_SUPPORT` | no alpha>=128 support | provide a supported part |
10065
10104
  | <a id="DEPTH_MAP_SPREAD"></a>`DEPTH_MAP_SPREAD` | p5=p95 with nonzero relief | supply a nonflat map or declare relief 0 |
10105
+ | <a id="DEPTH_APPLY_CLIPPED"></a>`DEPTH_APPLY_CLIPPED` | a pixel with original alpha >= 128 has pre-encoding depth `z <= 0` or `z >= zScale` | use the reported minimum median for each low-clipped part and the reported minimum group scale for upper clipping. The rig checks the head and body role sets separately, so if a surface belongs to both, use the larger required `zScale` in both groups. Recompute the group scale after median edits if the maximum changes, then prepare again. |
10066
10106
  | <a id="DEPTH_NORMAL_ISLANDS"></a>`DEPTH_NORMAL_ISLANDS` | zero/multiple connected components at native or integration resolution | scalar source, or a larger registered normal input that preserves one island |
10067
10107
  | <a id="DEPTH_NORMAL_VECTOR"></a>`DEPTH_NORMAL_VECTOR` | a sampled support normal is zero | provide nonzero signed XYZ normals |
10068
10108
  | <a id="DEPTH_NORMAL_CONVEXITY"></a>`DEPTH_NORMAL_CONVEXITY` | core/rim or its convexity sign is unresolved | larger closed convex mask or scalar source |
10069
- | <a id="DEPTH_GROUP_BINDING"></a>`DEPTH_GROUP_BINDING` | part outside declared turn roles, mixed retained near/zScale, or filename collision | register exact roles and one shared scale/polarity, replace/clear conflicting sheets, use distinct names |
10109
+ | <a id="DEPTH_GROUP_BINDING"></a>`DEPTH_GROUP_BINDING` | part outside declared turn roles, including a placed body part absent from `turn.body.roles`, mixed retained near/zScale, or filename collision | register exact roles and one shared scale/polarity, replace/clear conflicting sheets, use distinct names |
10070
10110
  | <a id="DEPTH_GROUP_SELECTION"></a>`DEPTH_GROUP_SELECTION` | `depth-apply --groups` with an empty list, a group the recipe does not declare, or a group named twice | name each group to apply once, from the recipe's `groups` |
10071
10111
  | <a id="DEPTH_GROUP_LEFT_OUT"></a>`DEPTH_GROUP_LEFT_OUT` | `depth-apply --groups` leaves a group out while the rig config declares that group's turn (`turn.body`; `turn.roles` or `turn.depths` for head) | remove that turn block from the rig config, or name the group in `--groups` |
10072
10112
  | <a id="DEPTH_AUTHORED_UNIT_CONFLICT"></a>`DEPTH_AUTHORED_UNIT_CONFLICT` | a selected part already records `provenance.depth.kind: "authored-unit"`; adding scalar depth would make its two representations conflict | retain the authored unit or supply an explicitly reassembled scalar-compatible input; apply never replaces the provenance automatically |
10113
+ | <a id="DEPTH_PLACE_NEAR"></a>`DEPTH_PLACE_NEAR` | `place.near` is missing or invalid | declare `black` for low raw values near or `white` for high raw values near |
10114
+ | <a id="DEPTH_PLACE_SCALE"></a>`DEPTH_PLACE_SCALE` | `place.scale` is missing, nonfinite or nonpositive, or a placed median or implied relief overflows | use the available anchor evidence to declare a finite positive scale in rig pixels per model unit that keeps placement values finite |
10115
+ | <a id="DEPTH_PLACE_GROUP"></a>`DEPTH_PLACE_GROUP` | missing `groups.body` in the recipe or missing 2.5D `turn.body` in the rig config | declare both body blocks and register the placement parts under the body's turn roles |
10116
+ | <a id="DEPTH_PLACE_ANCHOR"></a>`DEPTH_PLACE_ANCHOR` | `place.anchor` is missing or fails to name the first body turn surface | name the first `surface` in `turn.body.roles` and declare its body recipe median |
10117
+ | <a id="DEPTH_PLACE_OCCLUDED"></a>`DEPTH_PLACE_OCCLUDED` | a body recipe part or `turn.body` unit has zero visible pixels at alpha >= 128 in the assembled draw order | make the part visible in the assembled art or remove it from placement |
10118
+ | <a id="DEPTH_PLACE_ROUND"></a>`DEPTH_PLACE_ROUND` | invalid `place.round`, a name outside the placement set, no measurable section, or a nonpositive fitted slope | list unique body recipe parts or body units with measurable round sections and check the declared polarity and depth profile |
10119
+
10120
+ ### Place body depth from a whole-painting map (#1570)
10121
+
10122
+ Run `depth-place` on the assembled parts before preparing the recipe you will
10123
+ apply. Add the optional `place` object to `rig-parts-depth/1` and declare
10124
+ `groups.body` and the matching `turn.body` in the rig config.
10125
+
10126
+ ```sh
10127
+ rig-parts depth-place --parts assembled --config depth-recipe.json --rig-config config.json --out placed --check-turn
10128
+ ```
10129
+
10130
+ | `place` field | contract |
10131
+ | --- | --- |
10132
+ | `map` | Required. A one-channel `rig-parts-map/1` on the assembled painting grid (`parts.json`'s `rig_size`), resolved relative to the recipe. |
10133
+ | `near` | Required. `black` means low raw values are near. `white` means high raw values are near. This is the painting map's polarity. `groups.body.near` controls the encoding of the per-part sheets. |
10134
+ | `scale` | Required. A finite positive value in rig pixels per model unit. The refusal for a missing scale prints the available anchor evidence. |
10135
+ | `anchor` | Required. The body turn's first `surface`, with a median already declared in `parts`. |
10136
+ | `round` | Optional. An array of unique body recipe part or body unit names for round-limb scale evidence. |
10137
+ | `pivot` | Optional. Omit it or use `"anchor"` to write `0`, the offset at the reference depth. Supply a finite number to write that explicit offset in rig pixels. |
10138
+
10139
+ At each painting pixel, the last drawn part with alpha at least 128 owns the
10140
+ sample. Every assembled part participates in occlusion. Each body recipe part
10141
+ and body turn unit must have at least one visible pixel. Its raw median uses
10142
+ those visible samples. The command also refuses missing recipe parts, body
10143
+ units or `clear` entries, mismatched map dimensions, and round parts without
10144
+ measurable sections or with a nonpositive fitted slope.
10145
+
10146
+ With raw medians `m` and `mAnchor`, declared anchor median `zAnchor` and
10147
+ scale `k`, the resulting rig depth is `zAnchor + sign * (m - mAnchor) * k`,
10148
+ with `sign = -1` for `black` and `+1` for `white`. The anchor retains its
10149
+ declared median. Placed unit depths are world rig `z` in
10150
+ `turn.body.unitDepths`. A unit can use just the painting map, with no per-part
10151
+ map declaration. The body carrier projects an explicit unit depth as
10152
+ `pivot + z - zRef`, with `zRef` from the first body surface (#1577).
10153
+
10154
+ The output directory receives `recipe.json`, `config.json` and
10155
+ `depth-place-report.json`. The placed recipe supplies the body medians and
10156
+ the resolved group pivot, which the config also records. Any existing `groups.body.unitDepths` override
10157
+ also carries the placed unit values, so applying the recipe preserves them.
10158
+ Relief remains declared per part, and the body's sheet `zScale` remains a
10159
+ separate authored value. Relative map and config references are rebased to the
10160
+ output directory. Prepare with `placed/recipe.json` to bind its bytes, then
10161
+ apply with the new preparation manifest and `placed/config.json`. If placement
10162
+ changes a declared assembly input, apply's `ASSEMBLY_CONFIG_STALE` refusal names
10163
+ the change and requires reassembly with the placed config.
10164
+
10165
+ `depth-place-report.json` has `spec: "rig-parts-depth-place-report/1"`, `near`,
10166
+ `scale`, `anchor`, `pivot` and `parts`. The rows follow `parts.json` draw order
10167
+ and carry `part`, `group`, `visibleCount`, `visibleFraction` (visible pixels
10168
+ divided by alpha >= 128 pixels), `rawMedian`, `rawP5`, `rawP95`, `rigMedian`,
10169
+ `reliefRatio` (declared relief divided by `rawP95 - rawP5`, or `null` when
10170
+ unavailable) and `impliedRelief` (`(rawP95 - rawP5) * scale`, or `null` for a
10171
+ unit without a recipe entry). An optional
10172
+ `round` row field carries `sections`, `invertedSections`, `scale` (median fit)
10173
+ and `iqr` (the 25th and 75th percentiles of the section scales). The fit
10174
+ uses the full supported silhouette for its principal axis and section widths
10175
+ and the visible samples for regression. For a missing or invalid declared
10176
+ scale, the refusal includes the available evidence by part.
10177
+
10178
+ With `--check-turn`, the command runs prepare, apply and `rig` with the real
10179
+ Core gate in scratch space at the declared turn range and adds `turnCheck`
10180
+ to the report. The check object has `status: "built"` on success.
10181
+ With `status: "refused"` it also has `stage` (`prepare`, `apply` or `rig`),
10182
+ `problems` (each with `code`, `object` and `detail`) and `winding`. Available
10183
+ `A39_DEFORM_KEEPS_TRIANGLE_WINDING` findings carry `rule`, `animation`,
10184
+ `part`, `attachment`, `key`, `reversedTriangles` and `triangles`, with `endKey`
10185
+ for an interval and `frame` when a slider is named. A named check refusal
10186
+ still lets successful placement write its files and exit `0`. Adjust the
10187
+ declarations and check the new candidate with the same gate.
10073
10188
 
10074
10189
  ### Unit depth precedence
10075
10190
 
@@ -10093,6 +10208,15 @@ For each carried unit bone, the existing producer resolves depth in this order:
10093
10208
  landmarks or a mesh sampling position. No documented configuration is
10094
10209
  provided here to bypass primary sampling and select the own sheet instead.
10095
10210
 
10211
+ An explicit body unit value is the world depth `z`. At body yaw angle `a`,
10212
+ its rigid horizontal displacement is `-(pivot + z - zRef) * sin(a)`, using
10213
+ the same primary surface reference `zRef` as the body's surface projection.
10214
+ A region bound to a torso root gets its own mover under `bodyshift`; a
10215
+ region farther down a body branch uses the branch directly under
10216
+ `bodyshift`. Each blink-still piece resolves its binding independently.
10217
+ When the binding cannot be moved at the declared depth, the rig stage
10218
+ refuses with [`RIG_TURN_BODY_UNIT_CARRIER`](#RIG_TURN_BODY_UNIT_CARRIER).
10219
+
10096
10220
  Outside or nonopaque primary support produces
10097
10221
  [`RIG_TURN_UNIT_DEPTH_SUPPORT`](#RIG_TURN_UNIT_DEPTH_SUPPORT), retains the
10098
10222
  extended primary sample, and does not select the own sheet. Removing all
package/docs/DEPTH.md CHANGED
@@ -41,10 +41,11 @@ use. Three things we learned the hard way are built into that path:
41
41
  convexity (the middle of a face is nearer than its rim). That integration is
42
42
  for the face only: it breaks on anything with an occlusion edge, like hair
43
43
  strands or a collar.
44
- - **The numbers that place a part are yours to declare.** A monocular model
45
- gives relative shape, not scale. How far forward each part sits (its
46
- `median`) and how deep its own shape is (its `relief`) are declared in rig
47
- pixels, and the tool never guesses them.
44
+ - **Placement and relief have separate controls.** The `median` sets where
45
+ a part sits and its `relief` sets the depth of its own shape, both in rig
46
+ pixels. Author both directly, or use a whole-painting map to
47
+ [place body medians](#optional-place-body-parts-from-a-whole-painting-map)
48
+ with a scale you declare. Relief is always authored separately.
48
49
 
49
50
  Surfaces in one turn group share one depth reference: the first surface's
50
51
  opaque-art median, preferring the face in a head group. With both eye landmarks,
@@ -78,9 +79,9 @@ measures depth discontinuity, not composite visibility.
78
79
  See-through, the layer decomposition this package reads, also writes a per-layer
79
80
  depth sheet, and a config can register those directly (`config.depth`,
80
81
  [Per-layer depth sheets](AUTHORING.md#per-layer-depth-sheets-773)). In
81
- side-by-side review, per-part maps from a depth model read better by eye than
82
- a single map of the whole painting, which is why the per-part route below is
83
- the one this page walks.
82
+ side-by-side review, per-part maps from a depth model read better by eye for
83
+ local shape. A whole-painting map can supply the relative placement of those
84
+ parts before you use per-part maps to shape them.
84
85
 
85
86
  ## The steps, and what you will see
86
87
 
@@ -92,6 +93,38 @@ as one piece, `rear` for what sits behind the head. A body group is declared
92
93
  the same way under `turn.body.roles`. The roles, the dials and the grid the
93
94
  surfaces are built on are in [AUTHORING §3, the `turn` row](AUTHORING.md#3-configjson-field-by-field).
94
95
 
96
+ ### Optional: Place body parts from a whole-painting map
97
+
98
+ Use `depth-place` if you have a scalar map for the whole painting and want to
99
+ place assembled body parts relative to one another. Supply a one-channel
100
+ `rig-parts-map/1` on the assembled painting grid (`parts.json`'s `rig_size`)
101
+ and add `place` to the depth recipe. Set `place.near` to `black` when low raw
102
+ values mean near or `white` when high values mean near. Nearer samples produce
103
+ larger rig `z`.
104
+ Declare a positive `place.scale` in rig pixels per model unit and name the
105
+ first body surface as `place.anchor`. That surface keeps its declared median.
106
+ The default pivot is at the anchor depth, with an offset of `0` from the turn's
107
+ reference. A numeric `place.pivot` supplies an explicit offset in rig pixels.
108
+
109
+ ```sh
110
+ rig-parts depth-place --parts assembled --config depth.json --rig-config config.json --out placed --check-turn
111
+ ```
112
+
113
+ The command writes `placed/recipe.json`, `placed/config.json` and
114
+ `placed/depth-place-report.json`. Use the placed recipe in steps 1 and 4 and the
115
+ placed config in step 4. Each median comes from the pixels where that part is
116
+ visible in the assembled draw order. The report shows the visible pixel count
117
+ and fraction and the scales implied by declared reliefs and optional round
118
+ parts. If you omit the scale, the refusal prints the available evidence so you
119
+ can choose one explicitly.
120
+
121
+ `--check-turn` prepares and applies the placed recipe in scratch space and runs
122
+ the real rig gate. Read `turnCheck` in the report for `built` or a named refusal
123
+ and any available triangle-winding findings. If placement succeeds, a named check
124
+ refusal still leaves the three placement files and exits `0`. The usual rig
125
+ gate still decides whether the turn can build. See the
126
+ [placement fields and refusals](AUTHORING.md#place-body-depth-from-a-whole-painting-map-1570).
127
+
95
128
  ### 1. Prepare one inference image per part
96
129
 
97
130
  Write a small recipe — a separate JSON file, not a field on the character
@@ -136,14 +169,16 @@ belong to these parts and nothing moved in between.
136
169
 
137
170
  ### 2. Run your depth model
138
171
 
139
- This is your step, with your model, on your machine or wherever you run it.
140
- Read `inference/<part>.png`, write one numeric map per part as JSON
141
- (`rig-parts-map/1`: width, height, channels, and the raw floating-point values
142
- row by row), the same size as the image you read. `"frame": "input"` in the
143
- recipe is what says so, and the manifest binds it, so choose it before you
144
- prepare. Scalar depth is one channel; the face's normals are three signed
145
- channels in image axes. Save the model's actual numbers — a greyscale preview
146
- has already thrown away the normalisation the next stage needs.
172
+ Run your model on `inference/<part>.png` and save its numeric output. The
173
+ recipe above declares `"frame": "input"`, so each JSON map must match the
174
+ size of the prepared PNG, including its grey margin. Choose the frame before
175
+ preparing because the manifest binds the recipe.
176
+
177
+ You can write the JSON directly as before. Use `rig-parts-map/1` with `width`,
178
+ `height`, `channels`, and a flat `data` array of finite floating-point values
179
+ in row order. Scalar depth has one channel and normals have three signed XYZ
180
+ channels in image axes (X right, Y down). A greyscale or RGB preview loses
181
+ the numeric values needed by the next stage.
147
182
 
148
183
  What we used: Depth Anything for the parts (V2 Large, and Depth Anything 3's
149
184
  monocular model), and Lotus's normal model for the face. Any model that
@@ -152,6 +187,35 @@ which one you ran. Model licences are the model's own and are not this
152
187
  package's to restate — the site's [licensing page](https://rig-c.org/docs/licensing/)
153
188
  says where each kind of term sits.
154
189
 
190
+ #### Convert a NumPy array
191
+
192
+ If the model exports a NumPy array, convert it to an input-frame map at the
193
+ recipe's map path. Use the same prepared PNG you supplied to the model:
194
+
195
+ ```sh
196
+ rig-parts depth-map --array face.npy --input inference/face.png --kind normals --part face --out face.json
197
+ ```
198
+
199
+ The array must be a C-order `.npy` file (format 1.0, 2.0, or 3.0) with
200
+ little-endian `float32` or `float64` values. Use `--kind depth` for `(H, W)`
201
+ or `(H, W, 1)` and `--kind normals` for `(H, W, 3)` signed XYZ in image axes.
202
+
203
+ If the model added padding to its output array, pass
204
+ `--padding LEFT,TOP,RIGHT,BOTTOM` in array pixels. The values are nonnegative
205
+ integers and default to zero. Keep the prepared PNG's own grey margin in the
206
+ map. After cropping the declared padding, each array dimension must be a
207
+ positive integer multiple of the corresponding PNG dimension. Each output
208
+ pixel is the mean of its corresponding rectangular block, with independent
209
+ horizontal and vertical factors. For normals, average each component and
210
+ normalize the resulting vector to unit length. A retained nonfinite sample,
211
+ a retained zero normal, or a pooled zero normal is refused with its pixel
212
+ coordinates.
213
+
214
+ `--out` must name a new file in an existing writable directory. `depth-map`
215
+ writes only the `rig-parts-map/1` JSON and prints the next `depth-bind`
216
+ command with the map path, prepared PNG path and part name quoted for a POSIX
217
+ shell.
218
+
155
219
  ### 3. Bind every map to its prepared input
156
220
 
157
221
  After the model writes each numeric map, bind those exact bytes to the input
@@ -169,8 +233,8 @@ it does not prove the model inferred one from the other. Use each recipe map
169
233
  path and its matching prepared image, retain the receipts with the maps, then
170
234
  apply them. Existing receipts are never overwritten. If a map changes, retain
171
235
  the old map and receipt and bind the new map at a new path; update the recipe
172
- and prepare again so its manifest binds that recipe. `depth-apply` refuses
173
- missing, stale or mismatched bindings before emission.
236
+ and prepare again so its manifest binds that recipe. `depth-apply` warns when
237
+ a binding is absent and refuses stale or mismatched bindings before emission.
174
238
 
175
239
  ### 4. Apply the maps as depth sheets
176
240
 
@@ -189,12 +253,34 @@ depth-apply: face levels=30 clip=0 reliefRigPixels=10 sign=1
189
253
  depth-apply: wrote registered parts, config.json and depth-report.json; run rig for the core gate
190
254
  ```
191
255
 
192
- `levels` is how many distinct grey levels the sheet uses, `clip` the share of
193
- pixels that fell outside the group's scale (keep it at or near zero), and
194
- `sign` the convexity sign the face integration chose. `mapped/` is a complete
195
- assembled directory: the art unchanged, a `<part>_depth.png` beside each mapped
196
- part, `parts.json` pointing at them, a copy of your config with the group
197
- pivots written in, and `depth-report.json` with every number and hash. Nothing
256
+ `levels` is how many distinct grey levels the sheet uses, and `sign` is the
257
+ convexity sign the face integration chose. `clip` (`clipFraction` in
258
+ `depth-report.json`) is the share of original part pixels with alpha >= 128
259
+ whose depth is at or beyond either boundary before encoding. Every supported
260
+ depth must satisfy `0 < z < zScale`. A nonzero fraction triggers
261
+ `DEPTH_APPLY_CLIPPED` before any output is written.
262
+
263
+ For clipping at the upper boundary, the refusal gives the smallest binary64
264
+ group `zScale` strictly greater than the largest original supported depth in
265
+ the group. For each part that clips at the lower boundary, it gives the
266
+ minimum authored `median` and how far it is above the previous median in rig
267
+ pixels. The minimum is the next binary64 value above the greatest negated
268
+ relief offset among that part's supported pixels. A group that clips at both
269
+ boundaries gets both remedies across its affected parts. If a required value
270
+ has no finite binary64 representation, revise the calibration as directed by
271
+ the refusal. A median rise can increase the group's maximum depth, so
272
+ recompute the required group scale after changing the median. After
273
+ editing the recipe, run `depth-prepare` again to bind the revised recipe, then
274
+ rerun `depth-apply` with the matching manifest.
275
+
276
+ The bound covers the newly mapped parts in each applied recipe group. At the
277
+ rig stage, each turn group checks its member sheets for one scale and polarity.
278
+ A surface shared by both turn groups must satisfy both groups' checks.
279
+
280
+ On success, `mapped/` is a complete assembled directory with the original
281
+ art, a `<part>_depth.png` beside each mapped part, `parts.json` pointing at
282
+ the sheets, a copy of your config with the group pivots written in, and
283
+ `depth-report.json` with every number and hash. Nothing
198
284
  in `work/rig` or your original config is touched. Any mismatch — a recipe edited
199
285
  after prepare, a part that moved, a map of the wrong size, a part your
200
286
  `turn.roles` does not name — is refused by name before a byte is written.
@@ -272,14 +358,13 @@ judge from a sweep or from the `turn` animation played straight through. Put
272
358
  the build in a page where the pointer drives both dials; the adapters' look
273
359
  example shows [how to bind a pointer to declared sliders](https://github.com/rig-c/adapters/blob/main/examples/look/README.md).
274
360
  Separately, render the setup pose and both yaw endpoints and look at their
275
- difference at native scale: that is where a tear, a clipped sheet or a feature
276
- sliding off the face shows, and it is a check for defects, not for volume.
361
+ difference at native scale to find tears or features sliding off the face.
277
362
 
278
363
  **Read the report before you read the render.** `depth-report.json` names each
279
- part's relief, scale and clip fraction. A high clip fraction means the declared
280
- numbers do not fit the group's scale; fix the recipe, not the render. Small
281
- units — eyes, mouth, brows, ears — usually look best following the face surface
282
- rather than carrying a sheet of their own: list them under `clear`, or give
364
+ part's relief, scale and clip fraction. A zero clip fraction confirms the
365
+ supported depths fit the declared range. Inspect the render for shape quality.
366
+ Small units — eyes, mouth, brows, ears — usually look best following the face
367
+ surface rather than carrying a sheet of their own: list them under `clear`, or give
283
368
  them an explicit depth under the group's `unitDepths`. Which depth a unit ends
284
369
  up using is spelled out in
285
370
  [Unit depth precedence](AUTHORING.md#unit-depth-precedence).