pixelkiln 0.135.0 → 0.137.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.
@@ -248,8 +248,21 @@ unlike a held thing, its file has to keep that frame, which `texture.py`
248
248
  gives it. Its back goes to the back of the forearm, its top towards the
249
249
  elbow, so it stands upright when the arm hangs, and it is made
250
250
  `STRAPPED_LENGTH` of the body's height tall (default 0.36). `STRAPPED_TURN=90`
251
- lays it across the arm. It follows the forearm alone and needs no hand
252
- bones.
251
+ lays it across the arm, which the shield motions need. It follows the forearm
252
+ alone and needs no hand bones.
253
+
254
+ A shield strapped across the left arm gets motions of its own:
255
+
256
+ ```bash
257
+ python3 research/scripts/shield.py <animated.glb> <with-shield-motions.glb>
258
+ ```
259
+
260
+ That adds `Shield_Idle`, `Shield_Walk`, `Shield_Jog`, `Shield_Attack`,
261
+ `Shield_Block`, `Shield_Hold` (the block held) and `Shield_Bash`. Each takes
262
+ the body from a stock motion and writes the shield arm: where the elbow
263
+ lies, which way the shield faces and which way its top points. Run it before
264
+ `sway.py`. In the stock motions the shield lies on its side on a hanging
265
+ arm, so play these in their place.
253
266
 
254
267
  Two hands on one grip takes the `two-handed` kind and one more script:
255
268
 
@@ -326,7 +339,9 @@ It adds a `Root` bone under the hips and keys it forward in every walk, run and
326
339
  advance, at the pace the planted foot goes back. In Godot, set the animation
327
340
  player's `root_motion_track` to that bone. The report gives each motion's
328
341
  speed and how far a foot still slides at it; the walk and the advance are
329
- good, the jog and sprint rough. Keep the file without it for anything that
342
+ good, the jog and sprint rough. `Great_Attack_Fwd` and `Spear_Thrust_Fwd` are
343
+ the cut and the thrust ending where the step landed; they only make sense
344
+ with root motion, and `SKIP=_Fwd` on `wield.py` leaves them out. Keep the file without it for anything that
330
345
  plays animations plainly, where the character would walk off and jump back.
331
346
 
332
347
  Not tried: Unity and Unreal, Godot's retargeting onto its own humanoid rest
@@ -360,8 +375,8 @@ swing. See step 31 of the research note.
360
375
  untried, the grip is not sized to the hand, there are four motions made for two hands
361
376
  and the rest are stock one-handed ones bent to fit, which can bend a wrist
362
377
  too far,
363
- and the animation library has no left-handed or shield motions, so a shield
364
- is carried, not used. A fist cannot open, so it cannot let go or change its hold.
378
+ and there are no left-handed sword motions. The shield's straps are paint:
379
+ the hand does not hold one. A fist cannot open, so it cannot let go or change its hold.
365
380
  - **Many bodies.** The items have been worn by two: the one they were cut on
366
381
  and one much heavier man, after `refit.py` reshaped them for him. Other
367
382
  heights and builds are untried.
@@ -65,6 +65,8 @@ Last updated 17 November 2026.
65
65
  | 55 | A side-on spear stance | Our scripts | The spear motions rewritten with the hips turned (45 degrees standing, 28 walking, 14 jogging), the feet split and the head looking along the shaft | Keep. Both bodies hold it with wrists under 36 degrees and both feet on the ground. The walk's legs still walk straight under turned hips. |
66
66
  | 56 | A spear advance | Our scripts | A forward step written as footwork: the leading foot steps, the other follows, neither passes the other, the hips stay turned 45 degrees | Keep. Both bodies advance in the stance with the stance's wrists and both feet reaching. Made in place; not seen in a game. |
67
67
  | 57 | Root motion | Our scripts | A `Root` bone under the hips, keyed forward at the pace the planted foot goes back, for every walk, run and the advance | Keep for walks and the advance: Godot moves the character by the measured distance to the millimetre. The jog's and sprint's speeds are rough. |
68
+ | 58 | An attack and a thrust that carry forward | Our scripts | `Great_Attack_Fwd` and `Spear_Thrust_Fwd`: the stepping foot stays where it lands and the other follows, with the travel written as root motion | Keep. The measured travel is within 5 mm of what was written and a planted foot moves 8 mm at most. |
69
+ | 59 | Shield motions | Our scripts | `shield.py`: the shield arm written as three directions (elbow, face, top), for a guard, a walk, a jog, the sword attack, a block, a held block and a bash | Keep. Seven motions on both bodies; nothing gets more than 1.7 cm inside the shield. Not seen in a game. |
68
70
 
69
71
  **How the percentages are measured.** The model is projected back to each of the eight camera positions and its outline is compared with the sprite's outline. The score is the area the two share divided by the area either covers, averaged over the views. 100% means the model casts exactly the sprite's shadow from every side. It measures shape only, not colour. It also favours carving, which is built from those same outlines.
70
72
 
@@ -1606,6 +1608,82 @@ Not checked: the rebuilt model's picture in the site viewer, any moment but the
1606
1608
 
1607
1609
  **Verdict.** Keep, for walks and the advance. Use the jog's and sprint's figures as a starting speed, not a fact.
1608
1610
 
1611
+ ## 58. An attack and a thrust that carry forward
1612
+
1613
+ **Question.** The two-handed cut and the spear thrust step out and come back to where they started. Can each end where its step landed, with the travel written as root motion?
1614
+
1615
+ **What was tried.** Two new motions beside the old ones, and one more number in a row of footwork.
1616
+
1617
+ - *Travel.* A row of `feet` in `wield.py` gains a ninth number: how far the character has gone forward. With it, the row's hips and feet are places over the ground, and the script takes the travel off each to get the animation, which is still held from where the character is.
1618
+ - *`Spear_Thrust_Fwd`.* The thrust as before until it lands. Then the leading foot stays where it is and the rear foot lifts and follows into the stance again, 0.38 leg lengths on.
1619
+ - *`Great_Attack_Fwd`.* The cut as before until it lands. Then the other foot comes up beside the one that stepped, 0.45 leg lengths on.
1620
+ - *Feet that hold.* The curve through a motion's footwork now rests at a moment where a value stops or turns back, so a foot written at the same place twice running stays there and does not swing past. The older motions' reports are the same to the degree and the millimetre.
1621
+ - *One front for the spear.* Step 57 found the advance stepping 13 degrees off the way the character faces. All the spear motions now set their feet the way he faces, so the stance, the advance and both thrusts agree.
1622
+ - *Root motion for a motion that plays once.* `rootmotion.py` takes these (names ending `_Fwd`) differently from a loop: `Root` follows the planted foot moment by moment and stays put when no foot is down, and the travel is the sum.
1623
+ - *Leaving them out.* Played plainly, a carried motion slides back at its end. `SKIP=_Fwd` makes a file without them; the site's models are built that way.
1624
+
1625
+ **Result.**
1626
+
1627
+ ![The carried thrust on both bodies and the carried cut, at the start, the landing, the other foot following, and the end, with the travel applied](../website/public/research/3d/carried-attacks.png)
1628
+
1629
+ | | Written, m | Measured from the feet, m | A planted foot moves at most |
1630
+ |---|---|---|---|
1631
+ | `Spear_Thrust_Fwd`, first body | 0.333 | 0.328 | 7 mm |
1632
+ | `Spear_Thrust_Fwd`, second body | 0.280 | 0.281 | 6 mm |
1633
+ | `Great_Attack_Fwd`, first body | 0.388 | 0.386 | 8 mm |
1634
+
1635
+ - **Each foot stays where it is while it is down.** With the travel applied, each ankle was followed over the ground through every stretch it spent down: none moved more than 8 mm forward or back, or 6 mm sideways.
1636
+ - **The arms are the old motions' arms:** wrist bend at most 26 and 29 degrees for the carried thrust on the first body, 34 and 29 on the second, 42 and 35 for the carried cut. Both feet reach and nothing is pulled in.
1637
+ - **All files validate with no errors or warnings,** with and without root motion.
1638
+ - **Godot moves the character by the measured travel.** Read headless with `root_motion_track` on the `Root` bone, two plays of the carried thrust moved it 0.655 m on the first body and 0.563 m on the second, and two of the carried cut 0.772 m, each twice the measured figure to within a millimetre and straight ahead. All 17 required bones are found on each file, none under the wrong parent.
1639
+ - **Not done:** the greatsword exists on the first body only, so the carried cut was made once. The rear foot comes forward flat, with no roll. The travel is fixed by the motion; a game cannot shorten it. Nothing was watched in a running game.
1640
+
1641
+ **Verdict.** Keep. An attack can now move the character, and the file says by how much.
1642
+
1643
+ ## 59. Shield motions
1644
+
1645
+ **Question.** Step 49 strapped a shield to the left forearm, and it has been carried, not used: the library has no shield motions, so the arm does what it does empty. Can motions be written for it, as step 51 wrote them for the greatsword?
1646
+
1647
+ **Setup.** A new script, [`scripts/shield.py`](../research/scripts/shield.py).
1648
+
1649
+ - *What is written down.* A shield strapped to a forearm leaves the arm little to decide: which way the elbow lies from the shoulder, which way the shield's face points, and which way its top points. A motion gives those three directions at a few moments. Being directions and not places, they give the same pose on a body with other proportions and cannot fall short. A first version gave the shield's place instead and solved the arm to it; the same numbers then asked the second body, whose upper arm is two thirds of his arm, for a 60 degree roll and still missed by 13 cm.
1650
+ - *The frame they are in.* It leans with the spine. It faces the way the character does while the chest is within 45 degrees of that, and turns with the chest beyond it. The sword idle stands with the chest turned 45 degrees and the jog swings it 55 degrees each way, so a frame fixed to the chest pointed the shield off to one side, and a frame fixed to the ground put the shield through the trunk whenever the trunk leaned or turned. A motion may ask for less slack: the jog and the sword attack let the shield ride the chest (10 and 20 degrees), because the arm cannot keep a shield facing ahead while the chest turns 134 degrees behind it.
1651
+ - *Strapped across the arm.* Step 49 put the shield's top towards the elbow, which is upright only while the arm hangs. A guard needs the forearm level behind an upright shield, so both bodies were rigged again with `STRAPPED_TURN=90`, and `rig.py` now leaves the shield's face and top on the forearm bone for `shield.py` to read.
1652
+ - *The sword arm.* In the stock walk the right arm swings, and on the first body the sword went 10 cm into the shield. The walk and the jog hold the sword arm as the sword idle has it.
1653
+ - *The motions.* `Shield_Idle`, `Shield_Walk` and `Shield_Jog`; `Shield_Attack`, the stock sword attack with the shield held out of the sword's way; `Shield_Block`, one second, the shield up over the face while the knees give; `Shield_Hold`, the block held; and `Shield_Bash`, one second, drawn in and driven out with a step of the left foot and the hips turning behind it. The block and the bash reuse `wield.py`'s footwork.
1654
+ - *The measure.* The shield is rigid, so everything else was taken into its own space at every thirtieth of a second and tested against a depth map of its front and back: how deep the deepest point of the body, the armour, the cape or the sword gets inside it. The left forearm and hand are left out, since the shield sits on them.
1655
+
1656
+ **Result.**
1657
+
1658
+ ![Both armoured bodies with sword and shield: on guard, walking, jogging, attacking, blocking and bashing](../website/public/research/3d/shield-motions.png)
1659
+
1660
+ On guard, walking, jogging, the sword attack, the block held, and the bash, on the first body (top) and the second.
1661
+
1662
+ | Motion | Seconds | Elbow bend | Deepest inside the shield, first body | Second body |
1663
+ |---|---|---|---|---|
1664
+ | `Shield_Idle` | 1.67 | 90 | 0.6 cm (cuirass) | nothing |
1665
+ | `Shield_Walk` | 1.33 | 93 | under 0.1 cm | 1.7 cm (cuirass) |
1666
+ | `Shield_Jog` | 0.93 | 88 | 0.2 cm | nothing |
1667
+ | `Shield_Attack` | 1.53 | 88 to 92 | 0.6 cm | nothing |
1668
+ | `Shield_Block` | 1.00 | 90 to 102 | 0.6 cm | nothing |
1669
+ | `Shield_Hold` | 1.67 | 102 | nothing | nothing |
1670
+ | `Shield_Bash` | 1.00 | 90 to 107 | 0.6 cm | 1.7 cm (cuirass) |
1671
+
1672
+ - **Before the poses were tuned** the same measure found the helm 6.7 cm into the shield in the attack and the lifted thigh right through it in the jog. The jog's and the attack's pose, elbow out from the side and the shield turned out, was the third of ten tried.
1673
+ - **The block lifts the middle of the shield** from 23 cm below the shoulder to 4 cm below it on the first body, and puts it 44 cm ahead; the bash carries it from 18 cm ahead of the shoulder to 44 cm.
1674
+ - **Both files validate** with no errors or warnings, at 3.1 and 2.9 MB with 19 animations, and Godot 4.7.2 imports them with no errors and lists all seven.
1675
+ - **Godot renames animations ending in `_Loop`.** The held block was first `Shield_Block_Loop`; Godot drops that ending on import and the name collided with `Shield_Block`. It is `Shield_Hold`.
1676
+
1677
+ **What is not done.**
1678
+
1679
+ - **The shield lies across the arm now,** so in every motion that is not one of these seven (the plain idle, the roll, the death) it sits on its side on a hanging arm.
1680
+ - **The left hand does not grip anything.** The straps are still paint.
1681
+ - **In the attack the shield swings behind** with the chest and shows its back. A fighter would keep it nearer the front.
1682
+ - **A shield on the right arm** is untried, and would need `STRAPPED_TURN=-90`.
1683
+ - **Not seen moving.** The poses were looked at as stills, and the measure is of the meshes; nothing was watched in a running game or in the site's viewer.
1684
+
1685
+ **Verdict.** Keep. A character with a sword and shield has motions of its own.
1686
+
1609
1687
  ## What has not worked, in one place
1610
1688
 
1611
1689
  So nobody repeats them:
@@ -1640,7 +1718,7 @@ Two bugs worth remembering, because both produced plausible wrong pictures: glTF
1640
1718
  - **Sixteen directions and lighting for the sprite cards** (step 31): the in-between views of step 13, and normals from the hidden mesh.
1641
1719
  - **More directions, and animation.** Step 13 gives sixteen directions. Thirty-two would spin smoothly, and the same trick on a walk cycle would give walks in the in-between directions, which the generator does not offer.
1642
1720
  - **Fix the squat proportions.** Carve at a finer grid, or let the redraw see a true neighbour at full height (the guide sheet does this and kept proportions better on the bare character).
1643
- - **Held items.** Steps 47 to 51 put a sword in either hand, open or drawn as a fist, a shield on a forearm, and a greatsword in both hands with four motions of its own. Step 52 gave the attack a step and step 53 added a spear with the hands apart, step 54 moved its rear elbow so both bodies hold it with easy wrists, step 55 turned the spear motions side-on, step 56 added an advance that keeps the stance, and step 57 wrote root motion for the walks, runs and the advance. Still to do: a handle sized to the hand, an attack and a thrust that carry the character forward, and motions made for a shield or a left-handed sword.
1721
+ - **Held items.** Steps 47 to 51 put a sword in either hand, open or drawn as a fist, a shield on a forearm, and a greatsword in both hands with four motions of its own. Step 52 gave the attack a step and step 53 added a spear with the hands apart, step 54 moved its rear elbow so both bodies hold it with easy wrists, step 55 turned the spear motions side-on, step 56 added an advance that keeps the stance, step 57 wrote root motion for the walks, runs and the advance, step 58 added a cut and a thrust that carry the character forward, and step 59 wrote seven motions for a sword and shield. Still to do: a handle sized to the hand, a hand that grips the shield's strap, and motions for a left-handed sword.
1644
1722
  - **A score that sees cleanliness.** Colour error against one drawing cannot tell a clean redraw from a torn render.
1645
1723
  - **Fewer, larger pieces in the unwrap.** The chest unwraps into a few large pieces, but the character comes out in hundreds of small ones, which is fine for a program and poor for a person or an image model to paint on. One piece per view, like a folded paper model, would make the texture a sprite sheet.
1646
1724
  - **Carve at a finer grid** than one voxel per pixel, so thin objects survive.
@@ -1809,6 +1887,9 @@ python3 research/scripts/retarget.py <character.glb> <library.glb> <out.glb>
1809
1887
  CHAINS="Cape=3x4" ITEMS="Cape=<cape.glb>:Hips,Spine,Chest:loose" python3 research/scripts/rig.py <body.glb> <body.rig.json> - - <character.glb>
1810
1888
  python3 research/scripts/sway.py <animated.glb> <out.glb>
1811
1889
 
1890
+ # Add shield motions for a character with a strapped shield (step 59). Run it before sway.py.
1891
+ python3 research/scripts/shield.py <animated.glb> <with-shield-motions.glb>
1892
+
1812
1893
  # Write root motion for the walks, runs and the spear advance (step 57). Run it last.
1813
1894
  python3 research/scripts/rootmotion.py <animated.glb> <with-root-motion.glb>
1814
1895
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.135.0",
3
+ "version": "0.137.0",
4
4
  "description": "Manifest-driven pixel-art generation, review, recovery, and packaging with deterministic provenance.",
5
5
  "type": "module",
6
6
  "sideEffects": false,