@rig-c/parts 1.17.0 → 1.19.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.
@@ -0,0 +1,327 @@
1
+ # The painting: what makes one riggable
2
+
3
+ rig-parts starts from one painting of one character. Making that painting is
4
+ yours — on your own GPU, with any generator, or by hand — and this package runs
5
+ no model. But a painting the pipeline cannot rig fails late: a sleeve layer that
6
+ holds the torso, a leg chain that drags the other leg, a dance clip that tears.
7
+ This page lists what the painting must be, why the pipeline needs each thing, and
8
+ what breaks without it; gives one generation recipe that passes the check, and what it measured; says how
9
+ to paint alternate art for a limb; and describes `rig-parts painting`, the check
10
+ that reads the painting before See-through runs on it.
11
+
12
+ There are two ways in:
13
+
14
+ - **A generated painting**, decomposed by [See-through](https://github.com/shitagaki-lab/see-through)
15
+ into layers. Everything below is about this route.
16
+ - **An artist's own layered file** (a PSD, one layer per part): [AUTHORING §4,
17
+ *For artists*](AUTHORING.md#for-artists-your-own-layered-file-issue-359) and
18
+ *The correction loop*. The requirements below still hold for the figure — a
19
+ limb the artist draws against the body is as hard to move — but there is no
20
+ See-through step to fail, and an artist can paint what a joint hides as a
21
+ `<layer>:hidden` layer.
22
+
23
+ For the environment that makes a painting (an NVIDIA GPU, an Apple Silicon Mac, or
24
+ none), see [rig-c/getting-started](https://github.com/rig-c/getting-started).
25
+
26
+ ## The requirements
27
+
28
+ Each requirement says what the pipeline needs, what fails without it, and whether
29
+ `rig-parts painting` reads it (and under which rule) or only an eye can.
30
+
31
+ | requirement | why the pipeline needs it | what fails without it | read by |
32
+ | --- | --- | --- | --- |
33
+ | **Front view** | the proposer and the keypoint file read the subject's right on the image's left of a figure facing the viewer, and the eyes, the blink and the head turn are drafted from a face toward the viewer | a back view has no face part for `propose` to draft from (`PROPOSE_FACE_PRESENT`, or the face-less fallback its first note names) | an eye |
34
+ | **Full body, inside the frame** — hair and ribbons too | the figure's height is the proposer's yardstick, and the feet carry the leg chain's last link | a cropped foot is a leg with no ankle; a figure touching the edge reads as background that is not plain. Long hair and trailing ribbons are figure: where they reach the edge they fail the border, and where they curl round the figure into a ring they close off the background between the arms and the body (*What the recipe measured*, below) | `PAINTING_BACKGROUND_PLAIN`; a ring, `PAINTING_ARM_CLEAR` and `PAINTING_HANDS_APART` |
35
+ | **Arms clear of the body** (an A-pose: arms down and out, a gap under each arm) | See-through separates what it can see; an arm with background round it becomes its own `handwear` and sleeve layers | an arm painted against the side is cut into a layer that holds part of the torso, and no rotation of its bone can swing it clear without dragging the torso's pixels | `PAINTING_ARM_CLEAR`: a gap on the line from each wrist to the hip of its side |
36
+ | **Hands apart and open** | each hand is a part on its own arm's chain; open fingers read as a hand at a thumbnail | clasped or touching hands are one `handwear` layer, split only by an `assemble.cuts` polygon drawn by hand; and the clasped hands the README showed until issue #227 did not read as hands above a thumbnail (`examples/demo/README.md`) | `PAINTING_HANDS_APART`: a gap on the line between the wrists. Hands that meet close a loop of arms round the torso, so both arms are refused with them |
37
+ | **Legs apart, with a visible gap** | the leg chain needs the legs painted apart (two legs that touch are one column See-through cannot split), and limbs are cut at their joints (#349, AUTHORING §3, *Limbs*), so each knee must be its own | legs that touch at the knee or the ankle come back as one `legwear` silhouette, a cut at the knee takes the other leg's pixels, and a step drags both | `PAINTING_LEGS_APART`: a gap on the line between the knees and on the line between the ankles |
38
+ | **Feet facing front** | a foot seen from the front stays inside its leg's column, below the ankle the leg chain ends at | not measured in this repository; read the leg parts on the `sheet` | an eye (body-18 has no foot points) |
39
+ | **A plain light background** | See-through and `assemble` read near-white as background (every channel above 235, the one test the assemble rim and the layer plausibility figures share) | scenery, a floor, a cast shadow, a gradient or a vignette is read as more figure — a layer of haze (`PLAN_LAYER_BACKGROUND`), or pixels that belong to no part | `PAINTING_BACKGROUND_PLAIN`: every border pixel near-white or unpainted |
40
+ | **Nothing held, no prop across a limb** | each part rides one bone; a prop belongs to no tag See-through knows | a held object joins the hands (`PAINTING_HANDS_APART`) or lands in a hand or garment layer and moves with the wrong bone | partly: a prop that joins the hands is `PAINTING_HANDS_APART`; anything else, an eye |
41
+ | **Clothing that leaves the joints unoccluded** | limbs are cut at the elbow and the knee (#349); each lower part carries a cap painted from what the joint hides | long sleeves and tights are fine; a cape over the elbows, a wide skirt over the knees or a forearm in front of the skirt's flare puts two parts' pixels on one joint. `assemble` names the missing cap pixels in its `limb cap:` lines | partly: a skirt over the knees is `PAINTING_LEGS_APART`, a forearm across a skirt is `PAINTING_ARM_CLEAR`; anything on an elbow — a cape, a sleeve's frill, a bow — an eye (no rule reads the elbow; *What the recipe measured*) |
42
+ | **Resolution and aspect** | See-through runs on a square (`inputs` pads the painting white to a square of its longer side) at `seethrough.resolution` (1024 by default), and a second run on a crop round the head, because the eyes of a full-figure run are too small to separate. A standing figure is taller than wide; `comfy paint` writes twice its latent (832x1216 → 1664x2432) | a landscape painting is padded above and below and spends See-through's square on white; a small painting leaves the head crop too few pixels for the eyes | an eye; `inputs` refuses a translucent painting (`INPUTS_PAINTING_OPAQUE`) and a head box off it |
43
+
44
+ **One painting, one character.** The keypoint file may hold several people, and
45
+ `--person` names the one checked; the pipeline rigs one.
46
+
47
+ ## The check: `rig-parts painting`
48
+
49
+ ```
50
+ rig-parts painting --keypoints <keypoints.json> [--person <id>] <painting.png>
51
+ ```
52
+
53
+ It runs on the CPU, before See-through, on the painting and its body-18 joints:
54
+ the same keypoint file `propose --keypoints` reads (AUTHORING §3, *A posed
55
+ figure*), from any estimator or written by hand, measured on this painting (its
56
+ `width` and `height` are the painting's, `KEYPOINTS_IMAGE_SIZE`). It writes
57
+ nothing. It prints the figure, every joint and every gap with its count, then
58
+ `PASS` and exit 0, or a `FAIL` line per refusal and exit 1. Each `FAIL` line ends
59
+ with `(see rig-parts guide <RULE>)`, which prints the rule's row in
60
+ [AUTHORING §6](AUTHORING.md#6-refusals-the-rule-and-what-has-to-change).
61
+
62
+ What it reads, each a definition with no tuned number:
63
+
64
+ - **Ground** — a pixel the package already calls background: alpha 8 or less
65
+ (unpainted, the layer reader's cut), or every colour channel above 235
66
+ (near-white, the assemble stage's and the plausibility figures' test).
67
+ - **Background** — the ground that reaches the edge: ground 4-connected to ground
68
+ on the border. A white blouse inside its line art is ground but not background,
69
+ so it is figure.
70
+ - **Figure** — everything that is not background.
71
+ - **A gap** between two joints — at least one background pixel on the straight
72
+ line between them, sampled once per pixel the line crosses.
73
+
74
+ The rules: `PAINTING_BACKGROUND_PLAIN` (every border pixel is ground),
75
+ `PAINTING_JOINTS_STATED` (the wrists, knees and ankles are `observed` with a
76
+ position; a hip is `observed` or `occluded` with a position),
77
+ `PAINTING_JOINT_ON_FIGURE` (every observed joint's pixel, and every occluded hip's,
78
+ is figure), `PAINTING_ARM_CLEAR`, `PAINTING_HANDS_APART` and `PAINTING_LEGS_APART`
79
+ (the gaps in the table above).
80
+
81
+ **An occluded hip** (issue #372). A skirt hides the hips on most clothed figures —
82
+ on every one of the 24 paintings behind the recipe below — and `occluded` with a
83
+ position is how the keypoint file says so: the joint is where its producer
84
+ estimated it, and the painting does not show it. The check reads an occluded hip
85
+ when the arm's gap read from it is **well defined**, which it decides from what it
86
+ reads:
87
+
88
+ - the hip **carries a position**. The keypoint reader already holds every position
89
+ inside the image (`KEYPOINTS_POSITION_INSIDE`), so every sample of the line from
90
+ the wrist to the hip is a pixel of the painting;
91
+ - that position's pixel **is figure** (`PAINTING_JOINT_ON_FIGURE`, which reads an
92
+ occluded hip as it reads an observed joint). An estimate placed on the background
93
+ would put a background pixel at the end of the arm's own line, and the arm would
94
+ pass on the estimate rather than on the painting.
95
+
96
+ A hip with no position is still refused (`PAINTING_JOINTS_STATED`): it gives the arm
97
+ rule no line to read. Only the hips: an occluded wrist is a hand the painting does
98
+ not show, and an occluded knee or ankle is a leg whose gap cannot be read. The
99
+ joints line counts occluded hips apart (`joints: 16 observed, 2 occluded with a
100
+ position (r_hip, l_hip), 18 on the figure`), and an arm's gap line says when it was
101
+ read from one.
102
+
103
+ What it does not read: a front view, the feet, a prop that does not join the
104
+ hands, anything on an elbow (a cape, a sleeve's frill, a bow), the hands' fingers,
105
+ the face. A green `painting` says
106
+ the joints and the silhouette hold the requirements it reads, not that the
107
+ painting is good. A shadow or a floor enclosed by the background is figure to it;
108
+ the border rule sees it only where it reaches the edge.
109
+
110
+ ## A recipe that is one way, not the only way
111
+
112
+ Anyone with a different generator reads the requirements above, not this. This is
113
+ one way that passes `painting`: the `generation` block and the pose file of seed
114
+ 372108, painted by `rig-parts comfy paint` for issue #372 as one of 24 candidates,
115
+ and chosen to be the next public example — a character for a wind demo, where hair
116
+ and cloth move by physics under a side gust. Its painting and See-through layers are
117
+ not yet published; when they are, its record joins the others in
118
+ [parts-examples](https://github.com/rig-c/parts-examples). The block:
119
+
120
+ ```json
121
+ "generation": {
122
+ "checkpoint": "hassakuXLIllustrious_v13StyleA.safetensors",
123
+ "loras": [],
124
+ "trigger": "",
125
+ "identity": "1girl, solo, adult woman, very long twin tails reaching the knees, deep blue hair, amber eyes, large red hair ribbons with long trailing ends",
126
+ "sampler": { "steps": 30, "cfg": 6.0, "sampler": "euler_ancestral", "scheduler": "normal" },
127
+ "costume": "white blouse with long fitted sleeves, red ribbon bow at the collar with long trailing ribbon ends, very wide flared tiered skirt, three ruffled layers, petticoat, skirt above the knees, knees visible, white thighhighs, red ankle boots, fully clothed, empty hands",
128
+ "negative_extra": "revealing clothes, bare shoulders, off shoulder, 2girls, multiple girls, holding, bag, weapon, clouds, cloud, sun, sky, sky background, grey background, blue background, gradient background, scenery, outdoors, from behind, back view, back of head, facing away, vignette, beige background, brown background, dark background, black background, spotlight, lighting gradient, flat color, cel shading, monochrome, lineart, long skirt, knee-length skirt, cape, legs together, knees together, crossed legs, hands on skirt, holding skirt, wide sleeves",
129
+ "pose": "full body, head to toe, entire body in frame, front view, facing viewer, looking at viewer, standing, legs apart, arms spread away from body, arms out to the sides, hands apart away from skirt, open hands, spread fingers, relaxed pose, gentle smile, feet visible, feet facing forward, shoes",
130
+ "style": "anime illustration, detailed, soft shading, (white background:1.3), simple background, plain background",
131
+ "negative_pose": "cropped, out of frame, cut off feet, close-up, portrait, upper body, from side, profile, sitting, kneeling, dynamic pose, arms raised, hand on face, contact shadow, cast shadow, floor, multiple views, reference sheet",
132
+ "latent": [832, 1216],
133
+ "seed": 372108,
134
+ "control": { "skeleton": "pose.json", "strength": 0.8, "end_percent": 0.7 }
135
+ }
136
+ ```
137
+
138
+ and the pose file it names, `pose.json` (OpenPose body-18 points on the 832x1216
139
+ latent canvas, x right, y down):
140
+
141
+ ```json
142
+ {
143
+ "width": 832,
144
+ "height": 1216,
145
+ "points": {
146
+ "nose": [416, 176],
147
+ "neck": [416, 252],
148
+ "r_shoulder": [340, 272],
149
+ "r_elbow": [258, 418],
150
+ "r_wrist": [168, 540],
151
+ "l_shoulder": [492, 272],
152
+ "l_elbow": [574, 418],
153
+ "l_wrist": [664, 540],
154
+ "r_hip": [374, 612],
155
+ "r_knee": [352, 862],
156
+ "r_ankle": [326, 1100],
157
+ "l_hip": [458, 612],
158
+ "l_knee": [480, 862],
159
+ "l_ankle": [506, 1100],
160
+ "r_eye": [398, 160],
161
+ "l_eye": [434, 160],
162
+ "r_ear": [378, 170],
163
+ "l_ear": [454, 170]
164
+ }
165
+ }
166
+ ```
167
+
168
+ **What `comfy paint` adds.** The prompt the sampler reads is not only the block's
169
+ words. `comfy paint` puts a fixed head in front of each side (`POSITIVE_HEAD` and
170
+ `NEGATIVE_HEAD` in `src/graphs.ts`, the reference implementation's, verbatim) — on
171
+ this Illustrious checkpoint as on the Pony one, where its `score_*` words come
172
+ from. A reader copying this recipe to another generator copies these too, or
173
+ knows they are left out:
174
+
175
+ - positive head: `score_9, score_8_up, score_7_up, source_anime, masterpiece, best quality, highly detailed`
176
+ - negative head: `score_4, score_3, score_2, score_1, worst quality, low quality, lowres, blurry, jpeg artifacts, nsfw, nude, naked, cleavage, underwear, sexual, suggestive, child, loli, shota, kid, toddler, text, watermark, signature, logo, bad anatomy, bad hands, extra fingers, deformed, mutated`
177
+
178
+ The positive is then the head, `trigger`, `identity`, `costume`, `pose` and
179
+ `style`, joined with `, `; the negative is the head, `negative_extra` and
180
+ `negative_pose`. The two strings seed 372108 was sampled with, as `comfy paint`
181
+ recorded them beside the painting:
182
+
183
+ ```
184
+ positive: score_9, score_8_up, score_7_up, source_anime, masterpiece, best quality, highly detailed, 1girl, solo, adult woman, very long twin tails reaching the knees, deep blue hair, amber eyes, large red hair ribbons with long trailing ends, white blouse with long fitted sleeves, red ribbon bow at the collar with long trailing ribbon ends, very wide flared tiered skirt, three ruffled layers, petticoat, skirt above the knees, knees visible, white thighhighs, red ankle boots, fully clothed, empty hands, full body, head to toe, entire body in frame, front view, facing viewer, looking at viewer, standing, legs apart, arms spread away from body, arms out to the sides, hands apart away from skirt, open hands, spread fingers, relaxed pose, gentle smile, feet visible, feet facing forward, shoes, anime illustration, detailed, soft shading, (white background:1.3), simple background, plain background
185
+ negative: score_4, score_3, score_2, score_1, worst quality, low quality, lowres, blurry, jpeg artifacts, nsfw, nude, naked, cleavage, underwear, sexual, suggestive, child, loli, shota, kid, toddler, text, watermark, signature, logo, bad anatomy, bad hands, extra fingers, deformed, mutated, revealing clothes, bare shoulders, off shoulder, 2girls, multiple girls, holding, bag, weapon, clouds, cloud, sun, sky, sky background, grey background, blue background, gradient background, scenery, outdoors, from behind, back view, back of head, facing away, vignette, beige background, brown background, dark background, black background, spotlight, lighting gradient, flat color, cel shading, monochrome, lineart, long skirt, knee-length skirt, cape, legs together, knees together, crossed legs, hands on skirt, holding skirt, wide sleeves, cropped, out of frame, cut off feet, close-up, portrait, upper body, from side, profile, sitting, kneeling, dynamic pose, arms raised, hand on face, contact shadow, cast shadow, floor, multiple views, reference sheet
186
+ ```
187
+
188
+ **What `painting` read on it**, with the wrists, knees and ankles read by eye on the
189
+ painting at full size (on a 50 px grid) and the hips — under the skirt — at the pose
190
+ file's hips x2. Written `observed`, as the check required until this change (the
191
+ two paths shortened):
192
+
193
+ ```
194
+ rig-parts painting: painting_372108.png, joints from kp/eye_372108.json person "a" (source: read by eye from the painting at full resolution on a 50 px grid (wrists, knees, ankles); hips under the skirt taken from the pose file x2; head and shoulders from the pose file x2 (not read by the check))
195
+ painting 1664x2432: background 2558081 px, figure 1488767 px; border 8188 px, 0 not background-coloured
196
+ joints: 18 observed, 18 on the figure
197
+ gap right arm (r_wrist to r_hip): 60 of 429 sampled pixels are background
198
+ gap left arm (l_wrist to l_hip): 76 of 415 sampled pixels are background
199
+ gap hands (r_wrist to l_wrist): 157 of 1011 sampled pixels are background
200
+ gap knees (r_knee to l_knee): 137 of 261 sampled pixels are background
201
+ gap ankles (r_ankle to l_ankle): 248 of 351 sampled pixels are background
202
+ PASS the painting holds every requirement this check reads (docs/PAINTING.md); what only an eye reads is listed there
203
+ ```
204
+
205
+ The same file with the two hips `occluded` (their honest state, read since this
206
+ change; *An occluded hip*, above) reads the same five gaps:
207
+
208
+ ```
209
+ painting 1664x2432: background 2558081 px, figure 1488767 px; border 8188 px, 0 not background-coloured
210
+ joints: 16 observed, 2 occluded with a position (r_hip, l_hip), 18 on the figure
211
+ gap right arm (r_wrist to r_hip): 60 of 429 sampled pixels are background (r_hip occluded, read at its position)
212
+ gap left arm (l_wrist to l_hip): 76 of 415 sampled pixels are background (l_hip occluded, read at its position)
213
+ gap hands (r_wrist to l_wrist): 157 of 1011 sampled pixels are background
214
+ gap knees (r_knee to l_knee): 137 of 261 sampled pixels are background
215
+ gap ankles (r_ankle to l_ankle): 248 of 351 sampled pixels are background
216
+ PASS the painting holds every requirement this check reads (docs/PAINTING.md); what only an eye reads is listed there
217
+ ```
218
+
219
+ What each part does:
220
+
221
+ - **The checkpoint** is public: [Hassaku XL (Illustrious)](https://civitai.com/models/140272)
222
+ v1.3 Style A, no LoRA. `scarf` and the two reference examples used
223
+ [Pony Diffusion V6 XL](https://civitai.com/models/257749) with the same sampler.
224
+ - **The control skeleton** is what holds the pose; a pose asked for in words
225
+ alone is one the sampler is free to ignore (`src/skeleton.ts`). `comfy paint`
226
+ draws the pose file as OpenPose body-18 in the annotator's own style and applies
227
+ it through `controlnet-openpose-sdxl-1.0` at strength 0.8, ending at 0.7 of the
228
+ steps. A pose file carries no words, so `generation.pose` is required beside it.
229
+ This one is the public `demo`'s pose file (`examples/demo/pose.json`) with the
230
+ head, neck and shoulders unchanged and the limbs moved, latent px:
231
+
232
+ | joint | `demo` | this recipe |
233
+ | --- | --- | --- |
234
+ | wrists | (206, 590), (626, 590) | (168, 540), (664, 540) — 72 px above the hips' line, 206 px out from each hip |
235
+ | elbows | (282, 440), (550, 440) | (258, 418), (574, 418) |
236
+ | hips | (378, 612), (454, 612) | (374, 612), (458, 612) |
237
+ | knees | (384, 862), (448, 862) — 64 px apart | (352, 862), (480, 862) — 128 px apart |
238
+ | ankles | (388, 1100), (444, 1100) — 56 px apart | (326, 1100), (506, 1100) — 180 px apart |
239
+
240
+ The paintings followed it: on the seven candidates whose joints were read by
241
+ eye, every wrist, knee and ankle lies within 38 painting px (in x or in y) of the
242
+ pose file's x2. On this one the eye read the wrists at (320, 1080) and
243
+ (1330, 1080), the knees at (700, 1720) and (960, 1720), and the ankles at
244
+ (655, 2190) and (1005, 2190).
245
+ - **The pose words** repeat what the skeleton asks — legs apart, arms out, hands
246
+ apart and open, feet forward — and the **negatives** refuse what breaks a rig: a
247
+ held object, a background that is not plain, a back or side view, a crop, a cast
248
+ shadow or a floor, and what closes the legs or covers them (`long skirt`,
249
+ `knee-length skirt`, `cape`, `legs together`, `knees together`, `crossed legs`).
250
+ - **The seed** is chosen by looking and by `painting`: generate several, run the
251
+ check on each, then read what it cannot (below). This one was chosen over the
252
+ others that passed because its ribbons wrap the twin tails (free ribbon arcs
253
+ become the rest shape a physics constraint swings from), its hair hangs at rest
254
+ (a candidate painted with its tails already swept out was a blown rest shape),
255
+ it has the widest two-layer skirt (the largest wind surface), and its tails
256
+ hang behind the figure, so they come out under a side gust. Two other passing
257
+ candidates were set aside because they read as a well-known existing character.
258
+
259
+ ## What the recipe measured
260
+
261
+ 24 paintings, seeds 372001-372008, 372101-372108 and 372201-372208, on the pose
262
+ file above under three wordings of the hair and the skirt (the block above is the
263
+ second; the first asked for twin tails "reaching the thighs" and a "wide flared
264
+ layered ruffled miniskirt", the third added "layered skirt"). Screened with
265
+ `painting` on the pose file's joints x2 — a screen, not a reading: a pose-file
266
+ joint can land off the limb, which three did (`PAINTING_JOINT_ON_FIGURE`, on a
267
+ wrist or an ankle), and the seven best were then read by eye. On that screen:
268
+
269
+ - **Spreading the knees and the ankles in the pose file holds a gap.** The knee
270
+ gap held in 23 of 24 paintings and the ankle gap in 24 of 24, on Hassaku XL
271
+ v1.3 Style A. The one knee miss painted an overskirt down to the shins, which
272
+ joins the legs whatever the skeleton says. On the `demo` painting, painted from
273
+ knees 64 and ankles 56 latent px apart, `painting` refuses both.
274
+ - **What clears `PAINTING_ARM_CLEAR` is the wrists' height above the skirt's
275
+ flare, not a narrow skirt.** With the wrists 72 latent px above the hips' line
276
+ (the `demo`'s are 22), both arm gaps held in 23 of 24 paintings, the widest
277
+ skirts among them: this recipe's two-layer skirt, at 60 and 76 background px on
278
+ the eye-read arm lines, and a three-tier ruffled skirt at 59 and 74. The one miss
279
+ is the hair ring below. On the `demo` painting the forearms hang across the
280
+ flare and both arms are refused.
281
+ - **Long hair and ribbons that reach the frame fail the border.** 6 of the 9
282
+ refusals were `PAINTING_BACKGROUND_PLAIN`: twin tails or a ribbon's trailing
283
+ end painted out to the edge: 1 of 8 under the first wording (tails "reaching the
284
+ thighs"), 5 of 16 under the other two (tails "reaching the knees", "large red
285
+ hair ribbons with long trailing ends") — counts, not a rate any other prompt will
286
+ repeat. One of the six
287
+ also curled its hair round the figure into a ring: the white between the arms
288
+ and the body was no longer connected to the edge, so it was not background, and
289
+ both arms and the hands were refused with the border (`PAINTING_ARM_CLEAR` x2,
290
+ `PAINTING_HANDS_APART`). The remedy, **untested here**: leave a margin round
291
+ where the hair falls — the pose file decides where the figure sits, and this
292
+ one puts the wrists 168 latent px from each side — and ask for hair no longer
293
+ than the frame holds; `painting` says whether a seed kept it inside.
294
+ - **`painting` cannot see the elbow.** Body-18 has an elbow point, but no rule reads
295
+ it, and 3 of the 7 best candidates passed with something on it: two with short
296
+ puff sleeves whose frilled cuff ends on the elbow, one with ribbons tied in
297
+ bows at the elbows. The costume's "long fitted sleeves" did not prevent either.
298
+ It is an eye check: look at each elbow at full size before See-through runs.
299
+ Prompt advice, **untested here**: add `puffy sleeves, short sleeves, puff
300
+ sleeves, elbow ribbon, ribbon on arm` to `negative_extra`.
301
+
302
+ ## Alternate art for a limb
303
+
304
+ A rig plays its base art in every pose; where a limb turns somewhere the base art
305
+ cannot follow (behind the head, toward the camera), the mesh folds.
306
+ [rig-c/pose#6](https://github.com/rig-c/pose/issues/6) lets `rig-pose retarget`
307
+ switch to an alternate drawing of the limb for those spans, and its report's
308
+ `uncovered` list names every fold no alternate covers — that list is the answer
309
+ to *which* angles to paint.
310
+
311
+ To paint one without the character drifting, repaint only the limb:
312
+
313
+ 1. **Start from the base painting**, not from a new generation: the face, the
314
+ costume and the colours stay the base painting's pixels.
315
+ 2. **Inpaint with a mask along the old and the new limb**: the region the limb
316
+ leaves and the region it moves into, from the shoulder (or hip) down. Keep the
317
+ face out of the mask.
318
+ 3. **Use the key skeleton as the control**: the body-18 pose the alternate depicts,
319
+ in the painting's space — the same skeleton the pose map's `alternates` entry
320
+ records — drawn the way `comfy paint` draws a pose file.
321
+ 4. **Run See-through on the result and take the limb's layers** (the sleeve, the
322
+ hand); the rest of that run is discarded. The base rig's other parts stay the
323
+ base painting's.
324
+
325
+ `comfy paint` does not run an inpainting graph; the demo's hand-detailer pass is
326
+ the same idea at hand scale (a masked repaint on the same checkpoint, recorded
327
+ beside its painting in parts-examples).
package/docs/STABILITY.md CHANGED
@@ -46,21 +46,22 @@ defaults are the help's too, and none is guessed from the art.
46
46
  <!-- stable:commands -->
47
47
  | command | flags |
48
48
  | --- | --- |
49
- | `layers` | one positional path: a wrapper directory, a `layers.json` or a `.psd` |
49
+ | `layers` | one positional path: a wrapper directory, a `layers.json` or a `.psd`; with it, optional `--export` (a directory to write the wrapper form into, issue #359); or `--template` with `--canvas` and no path |
50
50
  | `sheet` | `--source`, `--layers` (repeatable), `--out`; optional `--cell`, `--cols` |
51
51
  | `inputs` | `--source`, `--config`, `--out` |
52
52
  | `comfy` | `paint`: `--config`, `--out`; optional `--seeds`, `--seed0`, `--host`, `--wait`, `--timeout`, `--poll` |
53
53
  | `comfy` | `seethrough`: `--image`, `--out`; optional `--resolution`, `--steps`, `--seed`, `--prefix`, `--offload`, `--lama`, `--nf4`, `--host`, `--wait`, `--timeout`, `--poll` |
54
- | `assemble` | `--propose-plan` with `--source`, `--full`, `--head`, `--config`; or `--source`, `--full`, `--head`, `--config`, `--out`, optional `--seam` (near-white, silhouette), `--project` (core, visible) |
54
+ | `assemble` | `--propose-plan` with `--source`, `--full`, `--config`, optional `--head`; or `--source`, `--full`, `--config`, `--out`, optional `--head` (without it, one run: issue #359), `--seam` (near-white, silhouette), `--project` (core, visible) |
55
55
  | `propose` | `--head-box` with `--full`, `--canvas` |
56
56
  | `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`) |
57
57
  | `compare` | `--left`, `--right`; optional `--map` |
58
58
  | `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon) |
59
59
  | `check` | `--rig`, `--out`; optional `--parts`, `--source`, `--page-edges`, `--pack-shape`, `--requirements`, `--seam-pairs`, `--keep-stills` |
60
60
  | `loop` | `--frames`, `--out`; optional `--palette` |
61
- | `build` | `--config`, `--source`, `--full`, `--head`, `--out`; optional `--seam`, `--project`, `--page-edges`, `--pack-shape`, `--loop`, `--lead-in`, `--requirements`, `--idle-keys`, `--seam-pairs`, `--keep-stills` |
61
+ | `build` | `--config`, `--source`, `--full`, `--out`; optional `--head` (as for `assemble`), `--seam`, `--project`, `--page-edges`, `--pack-shape`, `--loop`, `--lead-in`, `--requirements`, `--idle-keys`, `--seam-pairs`, `--keep-stills` |
62
62
  | `compose` | `--scene`, `--out`; optional `--requirements`, `--accept` |
63
63
  | `mesh-draft` | `--config`, `--parts`, `--out`; optional `--requirements`, `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon), `--more-triangles` |
64
+ | `painting` | one positional path, the painting; `--keypoints`; optional `--person` |
64
65
  | `guide` | one positional argument: a rule name, `§<n>`, `§<n>.<m>` or `§<n>.<m>.<k>` |
65
66
  | (none) | `--version`, `--help` |
66
67
  <!-- /stable:commands -->
@@ -173,10 +174,12 @@ every number) are AUTHORING §3's tables, and the loader refuses any other by na
173
174
 
174
175
  | file | written by | what is stable |
175
176
  | --- | --- | --- |
176
- | `parts.json`, `parts/<name>.png` | `assemble`, `build` | one record per part: `from` (`<run>:<tag>` with a See-through v3 tag, `<run>:author:<label>` for a layer the author made — issue #256, read by no role rule — or `painting:<name>` for a patch), `cut_from` on a cut's piece only (the plan part it was cut from, issue #230), `limb` on a limb segment's part only (issue #349: `name`, `segment`, `of`, `bone`, and below a joint `joint` and `cap` — `at`, `width`, `radius`, `box`, `layer_px`, `image_px` with a cap image, `missing_px`), the box `x`, `y`, `w`, `h` (rig px), the pixel counts `src/parts.ts` documents (`opaque_px`, `visible_px`, `occluded_px`, `projected_core_px`, `source_px_taken`, `visible_not_projected_px`, `refused_drift_px`, `merged_px`, `seam_override_px`, and `fringe_pushed_back` when not empty); `rig_size`, `scale_rig_per_source`, `ghost_px`, `recomposite`, and `scene` (`figure_alpha_above`, `figure_px`, `figure_mask`) under `config.scene` only, with the figure's mask `figure_rig.png` beside the recomposite (issue #242) |
177
+ | `parts.json`, `parts/<name>.png` | `assemble`, `build` | one record per part: `from` (`<run>:<tag>` with a See-through v3 tag, `<run>:author:<label>` for a layer the author made — issue #256, read by no role rule — or `painting:<name>` for a patch), `cut_from` on a cut's piece only (the plan part it was cut from, issue #230), `limb` on a limb segment's part only (issue #349: `name`, `segment`, `of`, `bone`, and below a joint `joint` and `cap` — `at`, `width`, `radius`, `box`, `layer_px`, `image_px` with a cap image, `image_layer` after it when that image was a hidden-art layer — issue #359, `<run>:<layer>:hidden` — `missing_px`), the box `x`, `y`, `w`, `h` (rig px), the pixel counts `src/parts.ts` documents (`opaque_px`, `visible_px`, `occluded_px`, `projected_core_px`, `source_px_taken`, `visible_not_projected_px`, `refused_drift_px`, `merged_px`, `seam_override_px`, and `fringe_pushed_back` when not empty); `rig_size`, `scale_rig_per_source`, `ghost_px`, `recomposite`, and `scene` (`figure_alpha_above`, `figure_px`, `figure_mask`) under `config.scene` only, with the figure's mask `figure_rig.png` beside the recomposite (issue #242); `single_run_pad` (`file_size`, `side`, `left`, `top`) last, only for one run whose file is not the `seethrough.resolution` square (issue #366) |
177
178
  | `rig/rig.json`, `rig/motion.json`, `rig/images/` | `rig`, `build`, `compose` | rig-c's rig spec and motion spec, `spec` `rigc-rig/1` and `rigc-motion/1`: the format is rig-c's, and this package writes only what rig-c's parser accepts; a bone carries `inherit` only where config.bones declares one, rig-c's mode name as written (issue #348) |
178
179
  | `rig/mesh_report.json` | `rig`, `build` | one row per mesh: `part`, `vertices`, `triangles`, `hull`, `bones`, `max_influences`, `mean_influences`, `art_coverage`, then `grid` (a lattice); `mode` "contour" with `params`, `contour`, `regions` (`params.maxEdge` and `contour.outlineCut` only when the mesh declares `contour.maxEdge`; `params.bridges` and `contour.bridges` — `islands`, `units`, `joins`, and `faint` only when an island was left out as faint — only when it declares `contour.bridges`); or `mode` "auto" with `settings`, `source`, `result`, `residuals`, `worst_residual`, `worst_region`, `motion_amplitude`, `termination`, `weights`, `regions`, `deformation`, `quality_report` (rig-c's `mesh-quality-report/1` document whole), `motion_report`, and, only when they apply, `stray_cleared` (after `source`, when `source.stray` is declared), `skinning_residual` and `replay` (`AutoMeshReport` in `src/rig.ts`); in every mode, `exponent` when the mesh declares one (after `grid`, or after `mode`); `influences`, as declared, when a lattice or contour mesh declares it (after `exponent`, or where `exponent` would be); `stray` and `stray_cleared` when a lattice mesh declares `stray` (after `influences`, or where `influences` would be); `ribs` when a contour or auto mesh declares them (after `exponent`, or after `mode`), and then `contour.ribs` (`source.contour.ribs` in the automatic mode) |
179
180
  | `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode`, `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issue #320: `status`, `animations`, `fps`, `physics_left_out`, `folding`, `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `skipped`, a `requirements` block under `--requirements`, and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes |
181
+ | `layers.json`, `<index>_<name>.png` | `layers --export` | the wrapper form `layers` reads (issue #359): `width`, `height`, then `layers` — each `name`, `filename`, `left`, `top`, `right`, `bottom`, `depth_median` (the input's own; `null` for a PSD, the manifest's order then being the draw order) — drawn layers in draw order, then the hidden-art layers; a PNG's name is its index and its layer's name, and the manifest, not the file name, says which layer it is |
182
+ | the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
180
183
  | `proposal.json`, `render/landmarks*.png` | `propose` | the config's four rig sections, `turn` with `--full`/`--head`, and `notes` |
181
184
  | `basis.json` | `propose` | spec `spine-parts-basis/1` |
182
185
  | `config.json`, `mesh_draft.json` | `mesh-draft` | `config.json` is the config read, byte for byte, but for each drafted part's `meshes` entry; `mesh_draft.json` is spec `rig-parts-mesh-draft/1`: `rules`, `lattice_check`, `draft_check`, `figure_overdraw`, and per lattice part `part`, `mode`, `lattice`, `candidate` (with `bridges` — `units`, `joins` of `span` and `area_px2`, `area_px2`, `overdraw`, and `faint` only when an island was left out as faint — only when the candidate is a bridged one, issue #326), `delta` (under `--more-triangles` only), `readings`, `gate` (each line's `reading`, `pass`, `text`, `margin`), `note`; and `not_compared` (issue #307), only when the config holds an `auto` or `contour` entry: per such entry, in config order, `part`, `mode` and `note` — the part was neither drafted nor compared, and a config of lattices alone writes no such key |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/parts",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -43,6 +43,7 @@
43
43
  "workflows",
44
44
  "docs/AUTHORING.md",
45
45
  "docs/MIGRATION.md",
46
+ "docs/PAINTING.md",
46
47
  "docs/STABILITY.md",
47
48
  "skills",
48
49
  "NOTICE.md"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: rig-parts
3
- description: Turn one anime character painting and its See-through layer decomposition into a verified 2D character rig (Spine 4.3 skeleton data) — measured parts, weighted meshes, bone chains and a looping idle — with rig-parts, which gates everything through rig-c before it is written. Use for a request to rig or animate a single character painting, to run or read rig-parts layers, sheet, assemble, propose, rig, check, loop or build, or to write or fix a rig-parts config.json. Not for cutting art into parts by hand, for authoring a rig from loose PNGs (that is the rigc skill), for lip-sync or swapping a part's image, or for running See-through itself.
3
+ description: Turn one anime character painting and its See-through layer decomposition into a verified 2D character rig (Spine 4.3 skeleton data) — measured parts, weighted meshes, bone chains and a looping idle — with rig-parts, which gates everything through rig-c before it is written. Use for a request to rig or animate a single character painting, to check a painting before See-through (rig-parts painting), to run or read rig-parts layers, sheet, assemble, propose, rig, check, loop or build, or to write or fix a rig-parts config.json. Not for cutting art into parts by hand, for authoring a rig from loose PNGs (that is the rigc skill), for lip-sync or swapping a part's image, or for running See-through itself.
4
4
  license: MIT
5
5
  compatibility: Requires Bun 1.2 or later. The tool is the npm package @rig-c/parts (npm i -D @rig-c/parts, or bun add -d @rig-c/parts), whose command is rig-parts; rig-c is installed with it. See-through is run separately.
6
6
  ---
@@ -58,6 +58,16 @@ under that.
58
58
 
59
59
  ## The loop
60
60
 
61
+ 0. Before See-through, check the painting: `rig-parts painting --keypoints
62
+ <k.json> <painting.png>` with the figure's body-18 joints (the file
63
+ `propose --keypoints` reads, from an estimator or the painting — never a joint
64
+ you guessed). A `FAIL PAINTING_…` line names what a rig cannot be cut from —
65
+ an arm against the body, hands together, legs with no gap, a joint off the
66
+ figure, a background that is not plain — and the fix is a new painting, not a
67
+ config field. `docs/PAINTING.md` lists every requirement, the ones only an eye
68
+ reads (front view, feet, anything on an elbow: a cape, a sleeve's frill, a
69
+ bow), and one generation recipe; report those as not checked. A hip a skirt
70
+ hides is written `occluded` with its estimated position, not `observed`.
61
71
  1. `rig-parts inputs --source <painting> --config config.json --out <dir>` writes
62
72
  `st_input_full.png`, the painting on a white square. The config needs only `key`,
63
73
  `seethrough` and `assemble.rig_scale` at this point. Run See-through on it — any
@@ -114,6 +124,7 @@ under that.
114
124
  (rigc refuses the pair the link's control splits, and the line names the flag
115
125
  on the command that ran; AUTHORING §3).
116
126
  7. `rig-parts build --config … --source … --full … --head … --out out --loop`
127
+ (no `--head` for an artist's own file, below)
117
128
  (add `--idle-keys direct` when step 6 said so).
118
129
  It stops at the first stage that refuses, printing that stage's lines under
119
130
  `[assemble]`, `[rig]` or `[check]`. Fix what the FAIL line names and build again.
@@ -127,6 +138,23 @@ under that.
127
138
  last: `check/build/skeleton.json`, `skeleton.atlas` and the packed page. Report
128
139
  them with the pack line and the check figures verbatim.
129
140
 
141
+ An artist's own layered PSD (issue #359; AUTHORING §4, *For artists*): one run,
142
+ no See-through, no `--head` and no `head_box` in the config. The file must hold
143
+ `face`, `eyewhite-r` and `eyewhite-l`, painted (`ASSEMBLE_SINGLE_RUN_FACE`
144
+ otherwise); its stacking is the draw order and it carries no depth, so `layers`
145
+ prints `SKIP depth:` and the turn draft says `turn: SKIP` — report those as
146
+ skipped, never as passed. `rig-parts layers --template art.psd --canvas <W>x<H>`
147
+ writes the empty layers an artist paints into. A layer named `<layer>:hidden` is
148
+ that layer's art where something covers it (the forearm under a sleeve): read as a
149
+ cut's `under` and a limb segment's cap, never drawn; a `hidden art:` line names
150
+ what read it. To correct a parse, `rig-parts layers --export work art.psd` writes
151
+ the same layers as `layers.json` and one PNG each; move pixels between the PNGs
152
+ (grow a PNG and its box in `layers.json` together), then pass `--full work` and
153
+ read `recomposite vs source` and the error map again (AUTHORING §4, *The
154
+ correction loop*). A patch in the wrong layer shows as error only where the
155
+ painting is near-white; elsewhere it shows as `drift=`/`seam=` on the part drawn
156
+ over it.
157
+
130
158
  Several characters in one rig: build each one green on its own, then
131
159
  `rig-parts compose --scene scene.json --out scene` (spec `spine-parts-scene/1`:
132
160
  the canvas, each character's `build` and `offset`, an optional plate with its