@rig-c/parts 1.18.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.
- package/cli.ts +5 -4
- package/docs/AUTHORING.md +2 -2
- package/docs/MIGRATION.md +21 -0
- package/docs/PAINTING.md +200 -45
- package/package.json +1 -1
- package/skills/rig-parts/SKILL.md +3 -2
- package/src/paintcheck.ts +43 -16
package/cli.ts
CHANGED
|
@@ -644,10 +644,11 @@ usage:
|
|
|
644
644
|
(every channel above 235) or unpainted (alpha 8 or less) ground
|
|
645
645
|
connected to the edge; the figure is the rest; a gap is one background
|
|
646
646
|
pixel on the line between two joints. PAINTING_BACKGROUND_PLAIN (a
|
|
647
|
-
border pixel that is not ground), PAINTING_JOINTS_STATED (a wrist,
|
|
648
|
-
knee or ankle not observed
|
|
649
|
-
|
|
650
|
-
|
|
647
|
+
border pixel that is not ground), PAINTING_JOINTS_STATED (a wrist,
|
|
648
|
+
knee or ankle not observed, or a hip neither observed nor occluded
|
|
649
|
+
with a position), PAINTING_JOINT_ON_FIGURE (an observed joint, or an
|
|
650
|
+
occluded hip, on the background), PAINTING_ARM_CLEAR (no gap from a
|
|
651
|
+
wrist to its hip), PAINTING_HANDS_APART (none between the wrists),
|
|
651
652
|
PAINTING_LEGS_APART (none between the knees, or the ankles). Prints the
|
|
652
653
|
figure, every joint and every gap with its count; writes nothing.
|
|
653
654
|
docs/PAINTING.md says why each one matters. Exit 0 PASS, 1 refused.
|
package/docs/AUTHORING.md
CHANGED
|
@@ -2391,8 +2391,8 @@ says why each requirement exists and what breaks without it.
|
|
|
2391
2391
|
| --- | --- | --- |
|
|
2392
2392
|
| <a id="PAINTING_SOURCE_PRESENT"></a><a id="PAINTING_SOURCE_DECODES"></a>`PAINTING_SOURCE_PRESENT`, `PAINTING_SOURCE_DECODES` | the painting is missing or not a PNG | the path |
|
|
2393
2393
|
| <a id="PAINTING_BACKGROUND_PLAIN"></a>`PAINTING_BACKGROUND_PLAIN` | a border pixel is neither near-white nor unpainted: scenery, a floor, a gradient or a vignette reaches the edge, or the figure is cut by the frame; the detail counts them and names the first | a painting on a plain light background with the whole figure inside the frame (PAINTING.md, *Background*) |
|
|
2394
|
-
| <a id="PAINTING_JOINTS_STATED"></a>`PAINTING_JOINTS_STATED` | a wrist,
|
|
2395
|
-
| <a id="PAINTING_JOINT_ON_FIGURE"></a>`PAINTING_JOINT_ON_FIGURE` | an observed joint's pixel is background | the keypoint file (measured on this painting?), or the painting |
|
|
2394
|
+
| <a id="PAINTING_JOINTS_STATED"></a>`PAINTING_JOINTS_STATED` | a wrist, knee or ankle is `occluded` or `missing` in the keypoint file, or a hip has no position: the gap rules read those eight joints, and a hand or foot the painting does not show is a limb nothing can rig. A hip may be `occluded` (a skirt hides it on most clothed figures, issue #372) when its arm's gap is **well defined**: it carries a position — inside the image, which the keypoint reader holds (`KEYPOINTS_POSITION_INSIDE`), so the wrist-to-hip line's every sample is a pixel of the painting — and that pixel is figure (`PAINTING_JOINT_ON_FIGURE`). A hip `occluded` with no position, or `missing`, is refused: there is no line to read | a painting that shows it; or the joint, if the estimator missed one the painting shows; for a hip under a skirt, `occluded` with its estimated position (PAINTING.md, *An occluded hip*) |
|
|
2395
|
+
| <a id="PAINTING_JOINT_ON_FIGURE"></a>`PAINTING_JOINT_ON_FIGURE` | an observed joint's pixel, or an occluded hip's, is background. For an occluded hip the detail adds that the arm's gap would be the estimate's own background, not one between the arm and the body | the keypoint file (measured on this painting?), or the painting; an occluded hip's estimate, moved onto the figure it is hidden under |
|
|
2396
2396
|
| <a id="PAINTING_ARM_CLEAR"></a>`PAINTING_ARM_CLEAR` | the line from a wrist to the hip of its side crosses no background: the arm is painted against the body. Hands that meet close a loop round the torso, so this fires with `PAINTING_HANDS_APART` on both sides | a painting with the arm held away from the body (PAINTING.md, *Arms*) |
|
|
2397
2397
|
| <a id="PAINTING_HANDS_APART"></a>`PAINTING_HANDS_APART` | the line between the two wrists crosses no background: hands clasped or touching | a painting with the hands apart and open (PAINTING.md, *Hands*) |
|
|
2398
2398
|
| <a id="PAINTING_LEGS_APART"></a>`PAINTING_LEGS_APART` | the line between the knees, or between the ankles, crosses no background: the legs are one column there (a long skirt over the knees is refused here too) | a painting with the legs apart and a visible gap at the knees and the ankles (PAINTING.md, *Legs*) |
|
package/docs/MIGRATION.md
CHANGED
|
@@ -262,3 +262,24 @@ and writes nothing; no other command changed, and no byte any build writes moves
|
|
|
262
262
|
| the README's input bullet for the painting | one sentence | the requirements, linked to `docs/PAINTING.md`, which ships in the package |
|
|
263
263
|
|
|
264
264
|
What to do: nothing. Run `painting` on a new painting before See-through.
|
|
265
|
+
|
|
266
|
+
### And `painting` reads an occluded hip (issue #372)
|
|
267
|
+
|
|
268
|
+
A skirt hides the hips on most clothed figures, and the keypoint file says so with
|
|
269
|
+
`occluded`. `painting` refused that state, which taught a writer to call an
|
|
270
|
+
estimated hip `observed`. It now reads an occluded hip when the arm's gap from it is
|
|
271
|
+
well defined: the hip carries a position (inside the image, as the keypoint reader
|
|
272
|
+
holds every position) and that position's pixel is figure (PAINTING.md, *An occluded
|
|
273
|
+
hip*). No other command changed, and no byte any build writes moves.
|
|
274
|
+
|
|
275
|
+
| change | before | after |
|
|
276
|
+
| --- | --- | --- |
|
|
277
|
+
| a hip `occluded` with a position, on the figure | `PAINTING_JOINTS_STATED` (exit 1) | read: its arm's gap is measured from it, and the run passes or fails on the gaps |
|
|
278
|
+
| a hip `occluded` with a position, on the background | `PAINTING_JOINTS_STATED` | `PAINTING_JOINT_ON_FIGURE`, as an observed joint there is |
|
|
279
|
+
| a hip `occluded` with no position, or `missing` | `PAINTING_JOINTS_STATED` | the same rule; the detail now says a hip may be occluded with a position |
|
|
280
|
+
| a wrist, knee or ankle `occluded` | `PAINTING_JOINTS_STATED` | unchanged; the detail adds that only a hip may be occluded |
|
|
281
|
+
| the `joints:` line | `joints: <n> observed, <m> on the figure` | the same when no hip is occluded; otherwise `joints: <n> observed, <k> occluded with a position (<hips>), <m> on the figure` |
|
|
282
|
+
| a gap line read from an occluded hip | — | ends ` (<hip> occluded, read at its position)` |
|
|
283
|
+
|
|
284
|
+
What to do: write a hip a skirt hides as `occluded` with its estimate. A file that
|
|
285
|
+
wrote it `observed` reads the same gaps as before.
|
package/docs/PAINTING.md
CHANGED
|
@@ -5,7 +5,7 @@ yours — on your own GPU, with any generator, or by hand — and this package r
|
|
|
5
5
|
no model. But a painting the pipeline cannot rig fails late: a sleeve layer that
|
|
6
6
|
holds the torso, a leg chain that drags the other leg, a dance clip that tears.
|
|
7
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
|
|
8
|
+
what breaks without it; gives one generation recipe that passes the check, and what it measured; says how
|
|
9
9
|
to paint alternate art for a limb; and describes `rig-parts painting`, the check
|
|
10
10
|
that reads the painting before See-through runs on it.
|
|
11
11
|
|
|
@@ -31,14 +31,14 @@ Each requirement says what the pipeline needs, what fails without it, and whethe
|
|
|
31
31
|
| requirement | why the pipeline needs it | what fails without it | read by |
|
|
32
32
|
| --- | --- | --- | --- |
|
|
33
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** | 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 | `PAINTING_BACKGROUND_PLAIN` |
|
|
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
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
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
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
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
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
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`; a cape
|
|
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
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
43
|
|
|
44
44
|
**One painting, one character.** The keypoint file may hold several people, and
|
|
@@ -72,47 +72,150 @@ What it reads, each a definition with no tuned number:
|
|
|
72
72
|
line between them, sampled once per pixel the line crosses.
|
|
73
73
|
|
|
74
74
|
The rules: `PAINTING_BACKGROUND_PLAIN` (every border pixel is ground),
|
|
75
|
-
`PAINTING_JOINTS_STATED` (the wrists,
|
|
76
|
-
position
|
|
77
|
-
`
|
|
78
|
-
|
|
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.
|
|
79
102
|
|
|
80
103
|
What it does not read: a front view, the feet, a prop that does not join the
|
|
81
|
-
hands,
|
|
104
|
+
hands, anything on an elbow (a cape, a sleeve's frill, a bow), the hands' fingers,
|
|
105
|
+
the face. A green `painting` says
|
|
82
106
|
the joints and the silhouette hold the requirements it reads, not that the
|
|
83
107
|
painting is good. A shadow or a floor enclosed by the background is figure to it;
|
|
84
108
|
the border rule sees it only where it reaches the edge.
|
|
85
109
|
|
|
86
110
|
## A recipe that is one way, not the only way
|
|
87
111
|
|
|
88
|
-
Anyone with a different generator reads the requirements above, not this. This
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
[parts-examples](https://github.com/rig-c/parts-examples):
|
|
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:
|
|
96
119
|
|
|
97
120
|
```json
|
|
98
121
|
"generation": {
|
|
99
122
|
"checkpoint": "hassakuXLIllustrious_v13StyleA.safetensors",
|
|
100
123
|
"loras": [],
|
|
101
124
|
"trigger": "",
|
|
102
|
-
"identity": "1girl, solo, adult woman,
|
|
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",
|
|
103
126
|
"sampler": { "steps": 30, "cfg": 6.0, "sampler": "euler_ancestral", "scheduler": "normal" },
|
|
104
|
-
"costume": "
|
|
105
|
-
"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",
|
|
106
|
-
"pose": "full body, head to toe, entire body in frame, front view, facing viewer, looking at viewer, standing, arms away from body, hands apart away from skirt, open hands,
|
|
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",
|
|
107
130
|
"style": "anime illustration, detailed, soft shading, (white background:1.3), simple background, plain background",
|
|
108
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",
|
|
109
132
|
"latent": [832, 1216],
|
|
110
|
-
"seed":
|
|
133
|
+
"seed": 372108,
|
|
111
134
|
"control": { "skeleton": "pose.json", "strength": 0.8, "end_percent": 0.7 }
|
|
112
135
|
}
|
|
113
136
|
```
|
|
114
137
|
|
|
115
|
-
|
|
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
|
+
|
|
116
219
|
What each part does:
|
|
117
220
|
|
|
118
221
|
- **The checkpoint** is public: [Hassaku XL (Illustrious)](https://civitai.com/models/140272)
|
|
@@ -120,29 +223,81 @@ What each part does:
|
|
|
120
223
|
[Pony Diffusion V6 XL](https://civitai.com/models/257749) with the same sampler.
|
|
121
224
|
- **The control skeleton** is what holds the pose; a pose asked for in words
|
|
122
225
|
alone is one the sampler is free to ignore (`src/skeleton.ts`). `comfy paint`
|
|
123
|
-
draws
|
|
124
|
-
`controlnet-openpose-sdxl-1.0` at strength 0.8, ending at 0.7 of the
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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`.
|
|
146
301
|
|
|
147
302
|
## Alternate art for a limb
|
|
148
303
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/parts",
|
|
3
|
-
"version": "1.
|
|
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": {
|
|
@@ -65,8 +65,9 @@ under that.
|
|
|
65
65
|
an arm against the body, hands together, legs with no gap, a joint off the
|
|
66
66
|
figure, a background that is not plain — and the fix is a new painting, not a
|
|
67
67
|
config field. `docs/PAINTING.md` lists every requirement, the ones only an eye
|
|
68
|
-
reads (front view, feet,
|
|
69
|
-
report those as not checked.
|
|
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`.
|
|
70
71
|
1. `rig-parts inputs --source <painting> --config config.json --out <dir>` writes
|
|
71
72
|
`st_input_full.png`, the painting on a white square. The config needs only `key`,
|
|
72
73
|
`seethrough` and `assemble.rig_scale` at this point. Run See-through on it — any
|
package/src/paintcheck.ts
CHANGED
|
@@ -33,11 +33,20 @@
|
|
|
33
33
|
* background is what makes the figure readable at all; a border pixel that is
|
|
34
34
|
* not ground is scenery, a floor, a gradient, or the figure cut by the frame.
|
|
35
35
|
* - `PAINTING_JOINTS_STATED` — the eight joints the gap rules read (wrists,
|
|
36
|
-
* hips, knees, ankles) are `observed` with a position
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* hips, knees, ankles) are `observed` with a position, except that a hip may
|
|
37
|
+
* be `occluded` with a position (issue #372). An occluded wrist is a hand the
|
|
38
|
+
* painting does not show; an occluded hip is the honest state of a hip under
|
|
39
|
+
* a skirt, and the arm's gap read from it is **well defined** when the hip
|
|
40
|
+
* carries a position — which the keypoint reader holds inside the image
|
|
41
|
+
* (`KEYPOINTS_POSITION_INSIDE`), so every sample of the wrist-to-hip line is
|
|
42
|
+
* a pixel of the painting — and that position's pixel is figure (the next
|
|
43
|
+
* rule). A hip with no position is still refused: there is no line to read.
|
|
44
|
+
* - `PAINTING_JOINT_ON_FIGURE` — every observed joint's pixel, and every
|
|
45
|
+
* occluded hip's, is figure, not background. A joint off the figure is a
|
|
46
|
+
* keypoint file for another painting, or a limb the painting does not hold
|
|
47
|
+
* where the file says; an occluded hip on the background would also put a
|
|
48
|
+
* background pixel at the end of the arm's line, a gap the hip's own position
|
|
49
|
+
* makes rather than one between the arm and the body.
|
|
41
50
|
* - `PAINTING_ARM_CLEAR` — on each side, a gap between the wrist and the hip
|
|
42
51
|
* of the same side. None is an arm painted against the body.
|
|
43
52
|
* - `PAINTING_HANDS_APART` — a gap between the two wrists. None is hands
|
|
@@ -56,6 +65,15 @@ import type { KeypointName } from './skeleton.ts';
|
|
|
56
65
|
/** The joints the gap rules read, in the order a refusal lists them. */
|
|
57
66
|
export const PAINTING_JOINTS: readonly KeypointName[] = ['r_wrist', 'l_wrist', 'r_hip', 'l_hip', 'r_knee', 'l_knee', 'r_ankle', 'l_ankle'];
|
|
58
67
|
|
|
68
|
+
/** The joints that may be `occluded` with a position and still be read (issue #372): a skirt hides the hips on most clothed figures. */
|
|
69
|
+
export const PAINTING_OCCLUDABLE: readonly KeypointName[] = ['r_hip', 'l_hip'];
|
|
70
|
+
|
|
71
|
+
/** Whether the check reads joint `name` as given: observed with a position, or an occludable joint occluded with one. */
|
|
72
|
+
function readable(name: KeypointName, j: KeypointPerson['joints'][KeypointName]): j is KeypointPerson['joints'][KeypointName] & { at: [number, number] } {
|
|
73
|
+
if (j.at === null) return false;
|
|
74
|
+
return j.state === 'observed' || (j.state === 'occluded' && PAINTING_OCCLUDABLE.includes(name));
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
/** The four gap rules' pairs: the rule, the two joints, and what the pair is called in a line. */
|
|
60
78
|
export const PAINTING_GAPS: ReadonlyArray<readonly [string, KeypointName, KeypointName, string]> = [
|
|
61
79
|
['PAINTING_ARM_CLEAR', 'r_wrist', 'r_hip', 'right arm (r_wrist to r_hip)'],
|
|
@@ -94,9 +112,9 @@ export interface PaintingReading {
|
|
|
94
112
|
firstBorderNotGround: [number, number] | null;
|
|
95
113
|
backgroundPx: number;
|
|
96
114
|
figurePx: number;
|
|
97
|
-
/** Every observed joint, its pixel, and whether that pixel is figure. */
|
|
98
|
-
joints: Array<{ name: KeypointName; at: [number, number]; pixel: [number, number]; onFigure: boolean }>;
|
|
99
|
-
/** The gap readings whose two joints are both observed with a position. */
|
|
115
|
+
/** Every observed joint and every occluded hip with a position, its state, its pixel, and whether that pixel is figure. */
|
|
116
|
+
joints: Array<{ name: KeypointName; state: 'observed' | 'occluded'; at: [number, number]; pixel: [number, number]; onFigure: boolean }>;
|
|
117
|
+
/** The gap readings whose two joints are both read as given (observed with a position, or an occluded hip with one). */
|
|
100
118
|
gaps: GapReading[];
|
|
101
119
|
}
|
|
102
120
|
|
|
@@ -174,15 +192,15 @@ export function readPainting(r: Raster, person: KeypointPerson): PaintingReading
|
|
|
174
192
|
for (const v of bg) backgroundPx += v;
|
|
175
193
|
const joints: PaintingReading['joints'] = [];
|
|
176
194
|
for (const [name, j] of Object.entries(person.joints) as Array<[KeypointName, KeypointPerson['joints'][KeypointName]]>) {
|
|
177
|
-
if (
|
|
195
|
+
if (!readable(name, j)) continue;
|
|
178
196
|
const pixel = pixelOf(j.at, w, h);
|
|
179
|
-
joints.push({ name, at: j.at, pixel, onFigure: bg[pixel[1] * w + pixel[0]] === 0 });
|
|
197
|
+
joints.push({ name, state: j.state === 'observed' ? 'observed' : 'occluded', at: j.at, pixel, onFigure: bg[pixel[1] * w + pixel[0]] === 0 });
|
|
180
198
|
}
|
|
181
199
|
const gaps: GapReading[] = [];
|
|
182
200
|
for (const [rule, a, b, what] of PAINTING_GAPS) {
|
|
183
201
|
const ja = person.joints[a];
|
|
184
202
|
const jb = person.joints[b];
|
|
185
|
-
if (ja
|
|
203
|
+
if (!readable(a, ja) || !readable(b, jb)) continue;
|
|
186
204
|
const line = linePixels(ja.at, jb.at, w, h);
|
|
187
205
|
let background = 0;
|
|
188
206
|
for (const [x, y] of line) background += bg[y * w + x];
|
|
@@ -206,11 +224,14 @@ export function paintingProblems(reading: PaintingReading, person: KeypointPerso
|
|
|
206
224
|
}
|
|
207
225
|
for (const n of PAINTING_JOINTS) {
|
|
208
226
|
const j = person.joints[n];
|
|
209
|
-
if (
|
|
227
|
+
if (readable(n, j)) continue;
|
|
228
|
+
const hip = PAINTING_OCCLUDABLE.includes(n);
|
|
210
229
|
problems.push({
|
|
211
230
|
code: 'PAINTING_JOINTS_STATED',
|
|
212
231
|
object: `${keypoints} person "${person.id}" joint ${n}`,
|
|
213
|
-
detail:
|
|
232
|
+
detail: hip
|
|
233
|
+
? `is ${j.listed ? j.state : 'not listed'} with no position; observed or occluded with a position is required — the arm's gap is read on the line from the wrist to this hip, and a hip with no position gives no line to read`
|
|
234
|
+
: `is ${j.listed ? j.state : 'not listed'}${j.at === null ? '' : ` at ${pt(j.at)}`}; observed with a position is required — the gap rules read ${PAINTING_JOINTS.join(', ')}, and a joint the painting does not show is a limb it cannot rig (only a hip may be occluded, with a position)`,
|
|
214
235
|
});
|
|
215
236
|
}
|
|
216
237
|
for (const j of reading.joints) {
|
|
@@ -218,7 +239,7 @@ export function paintingProblems(reading: PaintingReading, person: KeypointPerso
|
|
|
218
239
|
problems.push({
|
|
219
240
|
code: 'PAINTING_JOINT_ON_FIGURE',
|
|
220
241
|
object: `${keypoints} person "${person.id}" joint ${j.name}`,
|
|
221
|
-
detail: `is at ${pt(j.at)}, and pixel ${pt(j.pixel)} is background (ground connected to the painting's edge); a joint on the figure is required — a file measured on another painting, or a limb that is not where the file says`,
|
|
242
|
+
detail: `is ${j.state === 'occluded' ? 'occluded ' : ''}at ${pt(j.at)}, and pixel ${pt(j.pixel)} is background (ground connected to the painting's edge); a joint on the figure is required — a file measured on another painting, or a limb that is not where the file says${j.state === 'occluded' ? '; an occluded hip is read only from a point on the figure, or the arm\'s gap would be the hip\'s own background' : ''}`,
|
|
222
243
|
});
|
|
223
244
|
}
|
|
224
245
|
for (const g of reading.gaps) {
|
|
@@ -238,8 +259,14 @@ export function paintingLines(reading: PaintingReading): string[] {
|
|
|
238
259
|
` painting ${reading.width}x${reading.height}: background ${reading.backgroundPx} px, figure ${reading.figurePx} px; border ${reading.border} px, ${reading.borderNotGround} not background-coloured`,
|
|
239
260
|
];
|
|
240
261
|
const on = reading.joints.filter((j) => j.onFigure).length;
|
|
241
|
-
|
|
242
|
-
|
|
262
|
+
const observed = reading.joints.filter((j) => j.state === 'observed').length;
|
|
263
|
+
const occluded = reading.joints.filter((j) => j.state === 'occluded').map((j) => j.name);
|
|
264
|
+
const occ = occluded.length === 0 ? '' : `, ${occluded.length} occluded with a position (${occluded.join(', ')})`;
|
|
265
|
+
out.push(` joints: ${observed} observed${occ}, ${on} on the figure${on === reading.joints.length ? '' : ` (off: ${reading.joints.filter((j) => !j.onFigure).map((j) => j.name).join(', ')})`}`);
|
|
266
|
+
for (const g of reading.gaps) {
|
|
267
|
+
const hidden = [g.a, g.b].filter((n) => occluded.includes(n));
|
|
268
|
+
out.push(` gap ${g.what}: ${g.background} of ${g.samples} sampled pixels are background${hidden.length === 0 ? '' : ` (${hidden.join(', ')} occluded, read at its position)`}`);
|
|
269
|
+
}
|
|
243
270
|
return out;
|
|
244
271
|
}
|
|
245
272
|
|