pixelkiln 0.148.0 → 0.149.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.
@@ -412,9 +412,19 @@ layer) stale, so turn it on before generating those.
412
412
 
413
413
  Cleaning goes by colour, so look at the limbs afterwards. A model sometimes
414
414
  shades a far arm or leg in a dark colour the rotations never use. A whole
415
- limb drawn that way, in its own outline, is recognised by its size and left
416
- alone; an edge of such colour on the body itself is still peeled, which can
417
- thin an arm. Regenerate a loop that comes back like that.
415
+ limb drawn that way is recognised by its size and left alone, sealed in its
416
+ own outline or reaching the edge of the silhouette; an edge of such colour on
417
+ the body itself is still peeled, which can thin an arm. Regenerate a loop
418
+ that comes back like that.
419
+
420
+ Dark clothing is the figure's own. Shades below the outline threshold in the
421
+ rotations vouch for a loop's slightly lighter shade of them, and the sweep
422
+ that removes outline left framing nothing never takes a connected stretch of
423
+ dark bigger than a ghost. Until this fix a base in black underwear could lose
424
+ thousands of pixels from a frame that way. Loops cleaned before can come out
425
+ with different bytes on their next `pixelkiln fetch`; no spec hash changes.
426
+ `fetch` warns when cleaning takes more than 3% of a frame's opaque pixels;
427
+ `"clean": false` and `pixelkiln fetch` restore the provider's bytes for free.
418
428
 
419
429
  ### How the family depends on the base
420
430
 
package/docs/CLI.md CHANGED
@@ -7,7 +7,7 @@ pixelkiln <command> [options]
7
7
  Unknown commands, positional arguments, and flags are errors. The only
8
8
  positional words accepted are a command's own subcommands (`refine approve`,
9
9
  `workspace add <manifest>`, and the like), `estimate-skeleton`'s one image
10
- path, `anchors`'s and `redraw`'s asset id, and `skeleton-preview`'s keypoints file or asset id. Repeated `--style`, `--only`, `--claims`, and `--output-role` values
10
+ path, `anchors`'s, `redraw`'s and `layer preview`'s asset id, and `skeleton-preview`'s keypoints file or asset id. Repeated `--style`, `--only`, `--claims`, and `--output-role` values
11
11
  accumulate; comma-separated values work too. This strict parsing prevents a misspelled filter
12
12
  from widening a paid run.
13
13
 
@@ -61,6 +61,7 @@ Which command:
61
61
  | start an `animate-skeleton` keypoints file from an image | `pixelkiln estimate-skeleton poses/hero.png --out poses/hero-swing.json` |
62
62
  | find the hands in every frame so a held item can be pinned to one | `pixelkiln anchors hero.sword` |
63
63
  | draw one wrong frame of a paperdoll layer again, not the whole layer | `pixelkiln redraw hero.robe --frame walk.south.frame-05` |
64
+ | see a paperdoll layer's mask and keyed input for every frame before paying | `pixelkiln layer preview hero.robe` |
64
65
  | see a keypoints file's poses over the source before paying | `pixelkiln skeleton-preview hero-swing` |
65
66
  | work across several projects | `pixelkiln workspace add ../other/pixelkiln.manifest.json`, then `--workspace` on `gallery` and `salvage` |
66
67
 
@@ -2169,6 +2170,23 @@ be downloaded and unchanged in the manifest since; a held item is refused.
2169
2170
 
2170
2171
  See [Redrawing one frame](./PAPERDOLL.md#redrawing-one-frame).
2171
2172
 
2173
+ ### `layer`
2174
+
2175
+ ```bash
2176
+ pixelkiln layer preview <layer> [--style <id>]
2177
+ ```
2178
+
2179
+ Builds a drawn paperdoll layer's sheet, keyed sheet and mask exactly as `gen`
2180
+ would send them, and writes them to `.pixelkiln/layers/<style>/<layer>/preview/`
2181
+ without calling any provider: `sheet.png`, `keyed.png`, `mask.png`,
2182
+ `overlay.png` (the mask over the frames) and `frames/`, each frame's keyed
2183
+ input and mask. It prints each frame's neck row, the frames whose own
2184
+ narrowest row was overruled, and what the inpaint would cost at that sheet
2185
+ size. Free, offline, and outside the plan; the sources must be downloaded. A
2186
+ held item is refused, since it is placed rather than inpainted.
2187
+
2188
+ See [Previewing before paying](./PAPERDOLL.md#previewing-before-paying).
2189
+
2172
2190
  ## Utility commands
2173
2191
 
2174
2192
  ### `help`
package/docs/PAPERDOLL.md CHANGED
@@ -40,7 +40,8 @@ A layer avoids the problem by painting the item onto the body's own frames:
40
40
  cut to the one box that holds them all, and laid on a single sheet.
41
41
  3. **Mask.** White where the provider may paint, black where it may not.
42
42
  4. **Key.** Inside the mask, skin is repainted cyan, keeping its shading.
43
- Outside it the frame keeps its own colours.
43
+ Outside it the frame keeps its own colours. With `cover`, everything
44
+ inside the mask is keyed, whatever its colour.
44
45
  5. **Inpaint.** One masked inpaint over the whole sheet.
45
46
  6. **Cut.** Pixels the provider repainted, that are not still cyan, are the
46
47
  layer. It is split back into one PNG per source frame.
@@ -175,6 +176,28 @@ tried it).
175
176
  "layer": { "of": ["mira", "mira.walk.south"], "skin": ["#f6b58a", "#e58a62", "#f2a076", "#d87855"] }
176
177
  ```
177
178
 
179
+ ### A base that cannot be bare
180
+
181
+ Some characters cannot be generated bare. PixelLab's character state edit
182
+ refused "no clothes" on an adult-proportioned figure (`character generation
183
+ failed upstream`, not billed) and accepted plain underwear. Make the
184
+ underwear part of the base itself, generated with it, and treat it as body:
185
+
186
+ ```json
187
+ "layer": { "of": ["mira", "mira.idle.east"], "cover": true }
188
+ ```
189
+
190
+ `cover` keys every opaque pixel inside the mask, whatever its colour, so the
191
+ provider sees the underwear as skin to dress over. Without it, the default
192
+ keys skin only: dark underwear went to the provider as existing clothing, and
193
+ on a 256px side-view base 5 of 8 frames came back with the underwear kept and
194
+ the outfit drawn around it. Keyed by hand, all 8 came back fully dressed.
195
+
196
+ Layers over such a base are additive only: a garment narrower than the
197
+ underwear leaves it showing, and nothing removes it. The head and hair stay
198
+ outside the mask, as on any outfit. `skin` has the opposite goal (key only
199
+ the skin, keep the clothes) and is not needed with `cover`.
200
+
178
201
  ### One piece at a time
179
202
 
180
203
  An outfit does not have to be one layer. Ask for a single garment and say
@@ -635,7 +658,12 @@ further up are four.
635
658
  so anything one-sided (a sword, a shoulder strap) is drawn for that side
636
659
  rather than flipped. Dress the mirror, do not mirror the layer. A placed
637
660
  item on a mirrored loop is pinned by that loop's own anchors, to the hand
638
- you named.
661
+ you named. A symmetric outfit can still be mirrored for free
662
+ (`"outfit.walk.west": { "mirror": "outfit.walk.east" }`): the flip is
663
+ current while it is the flip of the source layer's current files, and
664
+ `plan` makes it stale only when that layer changes, never on the loop the
665
+ layer was drawn over. While the source layer waits to be redrawn, `plan`
666
+ reports the flip as blocked until a later wave rather than as broken.
639
667
 
640
668
  **One sheet for the game.** `pixelkiln pack --style <style>` puts the
641
669
  character and every layer on one sheet, and its atlas pairs them up: a
@@ -660,13 +688,53 @@ Every step's file is kept in `.pixelkiln/layers/<style>/<asset>/`:
660
688
  | `result.png` | What it returned. |
661
689
  | `layout.json` | Which cell is which frame, and the sheet's size. |
662
690
 
691
+ ### How the mask finds the neck
692
+
693
+ The computed mask finds the head on every frame, then puts the neck a fixed
694
+ distance below the top of it:
695
+
696
+ - **The distance** is the median, over the sheet's frames, of what the
697
+ narrowest row in the upper part of each figure says. One frame whose
698
+ narrowest row is somewhere else (a shoulder in shadow, an elbow tucked in)
699
+ takes its neck from the others. On a 256px 8-frame idle, the narrowest-row
700
+ rule alone put the neck 30 rows low on 2 frames, and those came back as a
701
+ tube top with detached sleeves.
702
+ - **The top of the head** is the first row of the frame at least half as wide
703
+ as a head, so a hand raised above it is passed over. A head that moves down
704
+ the cell, as in a sit-down loop, takes the neck with it.
705
+ - **Above the neck**, an arm raised clear of the head's columns is part of
706
+ the mask and gets its sleeve. The head, and anything joined to it, is not.
707
+ - **Pinholes**: on a bare base, a dark pixel (a tattoo, deep shading) with
708
+ keyed skin no more than 3px away on both sides of its row is keyed too.
709
+ Left in its own colour it comes back unchanged and leaves a speck-sized hole
710
+ in the garment.
711
+
712
+ Generating a layer prints each frame's neck row, and names the frames whose
713
+ own narrowest row was overruled.
714
+
715
+ ### Previewing before paying
716
+
717
+ ```bash
718
+ pixelkiln layer preview hero.leather
719
+ ```
720
+
721
+ Builds the sheet, keyed sheet and mask exactly as `gen` would send them, and
722
+ writes them to `.pixelkiln/layers/<style>/<asset>/preview/` without calling
723
+ the provider: `sheet.png`, `keyed.png`, `mask.png`, `overlay.png` (the mask in
724
+ magenta over the frames) and `frames/`, each frame's own keyed input and
725
+ mask. It prints every frame's neck row and the inpaint's price at that sheet
726
+ size. It is free, needs no API key, and leaves the plan as it was. Look at
727
+ `overlay.png` before the first `gen` of a layer over a new base or a new loop.
728
+
729
+ ### Replacing a step's file
730
+
663
731
  When a step produces the wrong thing, replace its file. The computed mask
664
- finds each neck as the narrowest row in the upper part of the figure. That
665
- holds for a bald base with its arms down, and fails for hair wider than the
666
- head or an arm raised beside it. To fix it:
732
+ still assumes the head is on top and roughly upright: hair wider than the
733
+ shoulders, long hair over them, or limbs across the head need a mask of their
734
+ own. To make one:
667
735
 
668
- 1. Run the layer once.
669
- 2. Open `mask.png` from the work folder in any pixel editor.
736
+ 1. Run `pixelkiln layer preview <asset>` (or the layer once).
737
+ 2. Open `mask.png` from the preview (or work) folder in any pixel editor.
670
738
  3. Paint white where the layer may go and black everywhere else. Pure white
671
739
  and pure black only.
672
740
  4. Save it into the project (the work folder is git-ignored) and name it:
@@ -720,6 +788,24 @@ downloaded shows in `plan` as `recoverable`, and `pixelkiln fetch`
720
788
  re-processes the frames at no cost. Do it before generating layers: a loop
721
789
  the cleaning changed makes a layer over it `stale`.
722
790
 
791
+ **Dark clothing.** A base in black or near-black underwear is mostly below
792
+ the outline threshold, and a loop often lifts its sheen a shade or two from
793
+ the rotations. Until this fix that shade read as foreign, the patch was erased,
794
+ and the outline sweep that follows an erasure ran on through the dark cloth:
795
+ one 256px idle lost 2,563 pixels from a frame and four of eight frames came
796
+ back with holes through the briefs. Now dark shades are vouched for by the
797
+ rotations' dark pixels too, a strange-coloured patch bigger than a ghost gets
798
+ is kept whether it is sealed or reaches the edge of the silhouette, and the
799
+ sweep never takes a connected stretch of dark bigger than that. Loops that
800
+ were cleaned before can come out with different bytes on their next
801
+ `pixelkiln fetch`; no spec hash changes.
802
+
803
+ **Check the frames after cleaning, before generating layers.** `fetch` warns
804
+ when cleaning takes more than 3% of a frame's opaque pixels, which is damage
805
+ rather than ghosts. If a frame has holes, set `"clean": false` on the loop and
806
+ run `pixelkiln fetch`: the provider's original bytes come back from the cache
807
+ at no cost.
808
+
723
809
  More in [Characters](./CHARACTERS.md#cleaning-a-loops-frames).
724
810
 
725
811
  ## Cost and limits
@@ -769,7 +855,7 @@ stated when the job was submitted.
769
855
  tried and left 3 of 18 frames undressed and erased props in others.
770
856
 
771
857
  Not tested: sizes other than 64px, quadrupeds, more than 56 frames,
772
- attack animations (where limbs cross the head and the neck detection is
858
+ attack animations (where limbs cross the head and the head detection is
773
859
  weakest), hair, capes, shields, and two held items at once. For placed
774
860
  items: `tilt` and `lean` through the pipeline (they were tried in a script),
775
861
  a `place` correction, `grasp` on the left hand's far side or with a `radius`
@@ -791,6 +877,7 @@ A `layer` asset needs a `prompt` and a `layer` object. It takes no
791
877
  | `mask` | computed | A black-and-white PNG the size of the sheet. |
792
878
  | `keyed` | computed | A PNG the size of the sheet, sent instead of the keyed sheet. |
793
879
  | `skin` | all but outline | The colours that are skin, for a character that is not bare. |
880
+ | `cover` | `false` | Key everything inside the mask, not only skin: for a base that wears underwear. |
794
881
  | `key` | `#00ffff` | The stand-in colour. Change it for an item that is itself cyan. |
795
882
  | `clean` | `true` | Clean loop frames against the stills among `of` before sheeting them. |
796
883
  | `offset` | none | `[x, y]` pixels to move every frame by, or `{ "<of asset>": [x, y], "*": [x, y] }`. Free to change on a drawn layer. |
@@ -928,7 +1015,8 @@ That one was not tried.
928
1015
  | Hair covers the face, or a pack is on the chest, in some frames | The model read a front view as a back view. | Give each loop its own sheet row with `columns` and say in the prompt which way each row faces. See [Field notes](#field-notes). |
929
1016
  | Part of an arm or leg is missing after cleaning | It was shaded in a colour the rotations do not use. | Regenerate the loop (`gen --force --only <loop>`), or turn `clean` off for it. |
930
1017
  | Pale specks around the dressed character | The loop's own files were never cleaned; the layer is fine. | Set `"clean": true` on the loop and run `pixelkiln fetch`. |
931
- | Sleeves or collar missing where an arm is raised | The computed mask put the neck in the wrong row for that frame. | Supply a `mask`. |
1018
+ | Sleeves or collar missing on some frames | The computed mask left the chest or a raised arm out on those frames. | Check `pixelkiln layer preview <asset>` and its `overlay.png`; supply a `mask` if a frame is still wrong. |
1019
+ | Underwear kept, the outfit drawn around it | The base wears underwear and only skin was keyed. | Set `"cover": true`. |
932
1020
  | The outfit differs between two loops | They were dressed by two layers. | Put both loops in one layer's `of`. |
933
1021
  | Old clothes show at the edges | The base is not bare. | Use a bare base, or accept it. |
934
1022
  | A fringe in the key colour at wrists or collar | Shades of the key the cut did not recognise. | Change `key` to a colour further from the outfit's, or open an issue with `result.png`. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.148.0",
3
+ "version": "0.149.0",
4
4
  "description": "Manifest-driven pixel-art generation, review, recovery, and packaging with deterministic provenance.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -87,6 +87,21 @@ hands mid-walk and an inpainted shield was drawn face-on in a side view.
87
87
  - `pixelkiln pack --style <style>` puts the character and its layers on one
88
88
  sheet; the generic atlas's `layers` section pairs each layer frame with
89
89
  the frame it goes over and the offset to draw it at.
90
+ - Before the first paid `gen` of a drawn layer, run `pixelkiln layer preview
91
+ <layer>`: free and offline, it writes the sheet, keyed sheet, mask and an
92
+ `overlay.png` of the mask over the frames, plus each frame's own, to
93
+ `.pixelkiln/layers/<style>/<asset>/preview/`, and prints every frame's neck
94
+ row and the price. Look at the overlay; a frame it names as overruled
95
+ is the one to check first.
96
+ - A base that wears underwear (some characters cannot be generated bare;
97
+ PixelLab refused "no clothes" on an adult-proportioned figure and accepted
98
+ underwear) needs `"cover": true`: everything inside the mask is keyed, so
99
+ the outfit goes over the underwear instead of around it. Layers over it are
100
+ additive only. Do not combine it with `skin`, which keeps clothes.
101
+ - The computed mask finds the head per frame and puts the neck a fixed
102
+ distance below it, taken from the median of the frames; it includes an arm
103
+ raised beside the head. Hair over the shoulders or limbs across the head
104
+ still need a supplied mask.
90
105
  - `mask` and `keyed` replace the computed sheet inputs with PNGs the person
91
106
  supplies. Every intermediate file is in
92
107
  `.pixelkiln/layers/<style>/<asset>/`.