pixelkiln 0.133.0 → 0.135.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.
@@ -293,11 +293,14 @@ SET=spear python3 research/scripts/wield.py <animated.glb> <with-spear-motions.g
293
293
 
294
294
  `GRIP_AT` is where the forward hand's middle is, as a share of the item's
295
295
  length from its butt, and `GRIP_APART` how far behind it the other hand is.
296
- That adds `Spear_Idle`, `Spear_Walk`, `Spear_Jog` and `Spear_Thrust`. The
296
+ That adds `Spear_Idle`, `Spear_Advance`, `Spear_Walk`, `Spear_Jog` and `Spear_Thrust`. The
297
297
  idle is a side-on stance: the hips turned 45 degrees so the forward shoulder
298
298
  leads, the forward foot ahead, the other behind and turned out, and the head
299
299
  looking along the shaft. The walk and jog turn the hips less (28 and 14
300
- degrees), and the thrust squares them up as the point goes out. The
300
+ degrees), and the thrust squares them up as the point goes out.
301
+ `Spear_Advance` moves forward in the stance, the forward foot stepping and
302
+ the other following without passing it; it is made in place, and the report's
303
+ `groundMetresALoop` says how far to move the character in one loop. The
301
304
  stock one-handed motions do not suit a shaft; `offhand.py` can still be run
302
305
  on them, but the rear hand is often off the shaft.
303
306
 
@@ -312,6 +315,20 @@ The example file was imported into Godot 4.7.2 with no errors: one skeleton of
312
315
  `hiddenBy` list in its node metadata. Godot drops a trailing `_Loop` from
313
316
  animation names, so the library's `Walk_Loop` arrives as `Walk`.
314
317
 
318
+ The motions are made in place. For an engine that moves a character by its
319
+ animation, run this last:
320
+
321
+ ```
322
+ python3 research/scripts/rootmotion.py <animated.glb> <with-root-motion.glb>
323
+ ```
324
+
325
+ It adds a `Root` bone under the hips and keys it forward in every walk, run and
326
+ advance, at the pace the planted foot goes back. In Godot, set the animation
327
+ player's `root_motion_track` to that bone. The report gives each motion's
328
+ 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
330
+ plays animations plainly, where the character would walk off and jump back.
331
+
315
332
  Not tried: Unity and Unreal, Godot's retargeting onto its own humanoid rest
316
333
  pose, and how the model looks drawn in any engine but three.js.
317
334
 
@@ -63,6 +63,8 @@ Last updated 17 November 2026.
63
63
  | 53 | A spear, hands apart | PixelLab, Hunyuan3D-2mv, our scripts | A generated spear held left hand forward with the right behind it on the shaft, and four motions made for it: a guard, a walk, a jog and a thrust with a step | Keep for the first body. The second body's rear wrist bends 82 to 86 degrees, and stock motions fit a shaft poorly. |
64
64
  | 54 | The spear's rear elbow | Our scripts | The rear arm's elbow moved from back and up to out at the side, found by trying 37 places for it on both bodies | Keep. The second body's rear wrist went from 82 to 86 degrees down to 8 to 19, the first body's from 47 to 72 down to 15 to 20. |
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
+ | 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
+ | 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. |
66
68
 
67
69
  **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.
68
70
 
@@ -1551,6 +1553,59 @@ Not checked: the rebuilt model's picture in the site viewer, any moment but the
1551
1553
 
1552
1554
  **Verdict.** Keep. The stance and the thrust read as a spearman's. The walk and jog are a stopgap until the legs are made for the stance.
1553
1555
 
1556
+ ## 56. A spear advance
1557
+
1558
+ **Question.** Step 55's stance is side-on, but `Spear_Walk` and `Spear_Jog` are stock legs under hips turned less, so the trunk swings round every time he starts or stops. Can he move forward without leaving the stance?
1559
+
1560
+ **What was tried.** One new motion, `Spear_Advance`, written as footwork and not taken from a stock walk.
1561
+
1562
+ - *The feet.* Each foot on the ground goes back under the body at a steady pace, 0.26 leg lengths in all. For 32% of each cycle it is lifted 0.07 and brought forward again, leaving and landing at the ground's pace. The rear foot does the same half a cycle later. Neither passes the other: the leading foot stays between 0.09 and 0.35 ahead, the other between 0.05 and 0.31 behind.
1563
+ - *The hips* stay turned 45 degrees and sink a little as the feet part. The arms hold the stance's grip.
1564
+ - *The other foot's lift.* A row of `feet` gains an eighth number for it. The rows are made by a small function, `shuffle`, 24 to a cycle.
1565
+ - *The length.* The body comes from the idle, so the motion is as long as the idle (2.5 seconds) and holds three cycles; it loops with nothing to hide at the seam.
1566
+ - *The ground.* It is made in place. The report gives how far the ground goes by in a loop (`groundMetresALoop`), for a game to move him by.
1567
+
1568
+ **Result.**
1569
+
1570
+ ![Both bodies at three moments of one advance cycle, from the side and from the front quarter](../website/public/research/3d/spear-advance.png)
1571
+
1572
+ - **Both feet reach and both hands are on the shaft at every moment on both bodies,** with no pull-in.
1573
+ - **The wrists are the stance's:** 19 and 8 degrees at most on the first body (forward hand, rear hand), 12 and 13 on the second.
1574
+ - **The ground covered in one loop** is 1.01 m for the first body and 0.85 m for the second, about 0.4 and 0.34 m a second.
1575
+ - **First frame to last: 0 degrees.** Both files validate with no errors or warnings, with 17 animations, and Godot finds all 17 required bones on both.
1576
+ - **Not done:** a lifted foot stays flat, with no roll from heel to toe. Nothing was checked in a game with the body really moving, so whether the feet slide at that speed is worked out, not seen. A retreat is this motion played backwards, which was not tried. `Spear_Walk` and `Spear_Jog` are unchanged.
1577
+
1578
+ **Verdict.** Keep. A character in the stance can now close distance without turning out of it.
1579
+
1580
+ ## 57. Root motion
1581
+
1582
+ **Question.** Every walk and run in the file is made in place, and step 56's advance only reports how far the ground goes by. Can the file itself say how far each travelling motion carries the character, so a game does not guess a speed?
1583
+
1584
+ **Setup.** A new script, [`scripts/rootmotion.py`](../research/scripts/rootmotion.py), run last.
1585
+
1586
+ - *A bone to carry it.* The skeleton's top bone was the hips. The script adds a bone named `Root` on the ground as their parent, joined to the skin last so no mesh's joint numbers change. Godot's humanoid profile expects that bone under that name.
1587
+ - *The pace, from the feet.* For each travelling motion the ankles and the balls of both feet are followed. Whichever is lowest, while within 2 cm of as low as it gets, is on the ground, and how fast it goes back under the body is how fast the ground goes by. A foot just landing is slower than the ground, so the pace kept is the middle one of the faster half of those moments.
1588
+ - *The track.* `Root` is keyed forward at that pace for the motion's length. The motion's own bones are untouched. `PLANT=1` moves `Root` at the planted foot's own pace moment by moment instead, which takes the slide away and makes the pace uneven.
1589
+ - *A fault from step 56, found here.* The advance stepped along the way the idle's hips point, which is 13 degrees off the way the character faces, so it measured 0.98 m forward and 0.23 m sideways a loop. It now steps the way the character faces. The standing stance still sets its feet along the idle's hips, so the feet shift a little between standing and advancing, and on the first body the advance's rear foot is 1 mm short of its mark at its furthest.
1590
+
1591
+ **Result.** Steady pace, both bodies:
1592
+
1593
+ | Motion | First body, m/s | Foot slide, cm | Second body, m/s | Foot slide, cm |
1594
+ |---|---|---|---|---|
1595
+ | `Walk_Loop`, `Spear_Walk` | 1.02 | 5.4 | 0.90 | 5.7 |
1596
+ | `Jog_Fwd_Loop`, `Spear_Jog` | 5.95 | 8.4 | 5.15 | 7.2 |
1597
+ | `Sprint_Loop` | 8.96 | 59 | 8.08 | 54 |
1598
+ | `Spear_Advance` | 0.41 | 0.6 | 0.35 | 0.5 |
1599
+
1600
+ - **Godot moves the character by what was written.** With `root_motion_track` set to the `Root` bone, two loops of each motion, stepped at 60 a second, moved it twice the measured distance to the millimetre on both bodies (the walk 2.728 m and 2.410 m, the advance 2.034 m and 1.730 m), with no sideways or upward movement, and the `Root` bone itself stayed at the origin. The other motions moved it nowhere.
1601
+ - **The advance measures as it was written:** 1.017 m a loop against the 1.006 m its footwork was made for, and no sideways drift.
1602
+ - **The jog is fast.** Its planted foot sweeps 0.9 m in a sixth of a second, between long flights, so feet that do not slide mean nearly 6 m/s. A game that wants a slower jog must slow the motion or accept the slide.
1603
+ - **The sprint's figure is weak.** Only three moments of each step have a foot truly down, and the foot hangs at ground height for two moments before it. Those count as slide, which is why its slide reads 59 cm. Treat its speed as rough.
1604
+ - **Both files validate with no errors or warnings,** Godot finds all 17 required bones and no bone under the wrong parent, and the skeleton has one more bone.
1605
+ - **Not done:** the attack and the thrust still return to where they started; carrying them forward needs the rear foot to follow, which is footwork not yet written. Turning motions and the roll are not measured. Nothing was watched in a running game: Godot's numbers were read headless. The site's viewer does not read root motion, so its model is built without it.
1606
+
1607
+ **Verdict.** Keep, for walks and the advance. Use the jog's and sprint's figures as a starting speed, not a fact.
1608
+
1554
1609
  ## What has not worked, in one place
1555
1610
 
1556
1611
  So nobody repeats them:
@@ -1585,7 +1640,7 @@ Two bugs worth remembering, because both produced plausible wrong pictures: glTF
1585
1640
  - **Sixteen directions and lighting for the sprite cards** (step 31): the in-between views of step 13, and normals from the hidden mesh.
1586
1641
  - **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.
1587
1642
  - **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).
1588
- - **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, and step 55 turned the spear motions side-on. Still to do: a handle sized to the hand, root motion, a spear advance with legs of its own, and motions made for a shield or a left-handed sword.
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.
1589
1644
  - **A score that sees cleanliness.** Colour error against one drawing cannot tell a clean redraw from a torn render.
1590
1645
  - **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.
1591
1646
  - **Carve at a finer grid** than one voxel per pixel, so thin objects survive.
@@ -1754,6 +1809,9 @@ python3 research/scripts/retarget.py <character.glb> <library.glb> <out.glb>
1754
1809
  CHAINS="Cape=3x4" ITEMS="Cape=<cape.glb>:Hips,Spine,Chest:loose" python3 research/scripts/rig.py <body.glb> <body.rig.json> - - <character.glb>
1755
1810
  python3 research/scripts/sway.py <animated.glb> <out.glb>
1756
1811
 
1812
+ # Write root motion for the walks, runs and the spear advance (step 57). Run it last.
1813
+ python3 research/scripts/rootmotion.py <animated.glb> <with-root-motion.glb>
1814
+
1757
1815
  # Reshape an item made on one body for another (step 46). The skin files come from rig.py with SKIN=<file>.
1758
1816
  ONLY=Head python3 research/scripts/refit.py <helm.glb> <first.skin.npz> <second.skin.npz> <helm-for-second.glb>
1759
1817
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.133.0",
3
+ "version": "0.135.0",
4
4
  "description": "Manifest-driven pixel-art generation, review, recovery, and packaging with deterministic provenance.",
5
5
  "type": "module",
6
6
  "sideEffects": false,