pixelkiln 0.125.0 → 0.127.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/docs/CHARACTERS_3D.md +40 -5
- package/docs/RESEARCH_3D.md +80 -1
- package/package.json +1 -1
package/docs/CHARACTERS_3D.md
CHANGED
|
@@ -50,7 +50,7 @@ wrong one.
|
|
|
50
50
|
| GPU time, body and four items | About 45 minutes | About two hours |
|
|
51
51
|
| Build | About four heads tall | About seven heads tall |
|
|
52
52
|
| Surface | The sprite's colours, soft up close; meant to be drawn small with a pixel filter | Plates, trim, faces and cloth painted in |
|
|
53
|
-
| The example file | 9,300 triangles, 1.0 MB |
|
|
53
|
+
| The example file | 9,300 triangles, 1.0 MB | 19,500 triangles with a sword and shield, 2.8 MB |
|
|
54
54
|
|
|
55
55
|
**Take the pixel path** when the game is pixel art, the camera is far, and
|
|
56
56
|
cost matters. Its limits are known:
|
|
@@ -234,6 +234,39 @@ frame does not matter. It needs a hand with a grip point: one with finger
|
|
|
234
234
|
bones, or a closed fist. In a fist the grip runs through the fist from front
|
|
235
235
|
to back, blade to the front, and the guard is kept clear of the fist's side.
|
|
236
236
|
|
|
237
|
+
Either hand works: name `LeftHand` for the left.
|
|
238
|
+
|
|
239
|
+
A shield, or anything flat carried on an arm, is `strapped` to a forearm:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
ITEMS="Shield=<shield.glb>:LeftLowerArm:strapped;Sword=<sword.glb>:RightHand:held" python3 research/scripts/rig.py <body-light.glb> <body.rig.json> - - <character.glb>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Make it the same way as the sword, drawn upright with its face to the viewer;
|
|
246
|
+
unlike a held thing, its file has to keep that frame, which `texture.py`
|
|
247
|
+
gives it. Its back goes to the back of the forearm, its top towards the
|
|
248
|
+
elbow, so it stands upright when the arm hangs, and it is made
|
|
249
|
+
`STRAPPED_LENGTH` of the body's height tall (default 0.36). `STRAPPED_TURN=90`
|
|
250
|
+
lays it across the arm. It follows the forearm alone and needs no hand
|
|
251
|
+
bones.
|
|
252
|
+
|
|
253
|
+
Two hands on one grip takes the `two-handed` kind and one more script:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
HELD_LENGTH=0.8 ITEMS="Greatsword=<greatsword.glb>:RightHand:two-handed" python3 research/scripts/rig.py <body-light.glb> <body.rig.json> - - <character.glb>
|
|
257
|
+
python3 research/scripts/retarget.py <character.glb> <library.glb> <animated.glb>
|
|
258
|
+
python3 research/scripts/offhand.py <animated.glb> <two-handed.glb>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The hand named leads and sits under the guard. `rig.py` leaves a bone,
|
|
262
|
+
`RightGrip2`, where the other hand belongs. `offhand.py` then goes through
|
|
263
|
+
every animation: it pulls the grip in front of the body until both arms can
|
|
264
|
+
reach it, bends both arms to meet it, and stores the result as keys. It
|
|
265
|
+
prints, for each animation, how far the grip was pulled, whether the hand
|
|
266
|
+
ever fell short and how far a wrist bends. Run it after `retarget.py` and
|
|
267
|
+
before `sway.py`. An engine with its own arm solver can use the `RightGrip2`
|
|
268
|
+
bone and skip the script.
|
|
269
|
+
|
|
237
270
|
Then animate as in step 8. `retarget.py` carries the library's thumb and
|
|
238
271
|
middle finger over, so the hand is a fist in a walk and closed round the grip
|
|
239
272
|
in a sword attack. A fist has no fingers to move and holds as drawn.
|
|
@@ -241,7 +274,7 @@ in a sword attack. A fist has no fingers to move and holds as drawn.
|
|
|
241
274
|
## In a game engine
|
|
242
275
|
|
|
243
276
|
The example file was imported into Godot 4.7.2 with no errors: one skeleton of
|
|
244
|
-
47 bones (21 for the body, 14 for the hands, 12 for the cape),
|
|
277
|
+
47 bones (21 for the body, 14 for the hands, 12 for the cape), eleven skinned meshes, twelve animations, and each body piece's
|
|
245
278
|
`hiddenBy` list in its node metadata. Godot drops a trailing `_Loop` from
|
|
246
279
|
animation names, so the library's `Walk_Loop` arrives as `Walk`.
|
|
247
280
|
|
|
@@ -272,9 +305,11 @@ swing. See step 31 of the research note.
|
|
|
272
305
|
redraw's lighting is painted in.
|
|
273
306
|
- **Separate fingers, eyes and a jaw** in the skeleton. The four fingers
|
|
274
307
|
move as one, and only on the painted path.
|
|
275
|
-
- **Held items beyond
|
|
276
|
-
|
|
277
|
-
|
|
308
|
+
- **Held items beyond swords and a shield.** A shield gripped in the fist is
|
|
309
|
+
untried, the grip is not sized to the hand, two-handed motions are stock
|
|
310
|
+
one-handed ones bent to fit and can bend a wrist too far,
|
|
311
|
+
and the animation library has no left-handed or shield motions, so a shield
|
|
312
|
+
is carried, not used. A fist cannot open, so it cannot let go or change its hold.
|
|
278
313
|
- **Many bodies.** The items have been worn by two: the one they were cut on
|
|
279
314
|
and one much heavier man, after `refit.py` reshaped them for him. Other
|
|
280
315
|
heights and builds are untried.
|
package/docs/RESEARCH_3D.md
CHANGED
|
@@ -56,6 +56,8 @@ Last updated 17 November 2026.
|
|
|
56
56
|
| 46 | Put the first body's items on a second, heavier body | PixelLab, our scripts | The same four items fit a much broader man, after reshaping each to his bones and thickness | Keep. Scaling by ratio failed; adding the difference in thickness works. |
|
|
57
57
|
| 47 | Finger bones, and a sword in the hand | PixelLab, Hunyuan3D-2mv, Quaternius's library, our scripts | A thumb and one finger chain a hand, found on the mesh; the library's fists and sword grip carry over; a generated sword sits in the closed right hand | Keep for 256 pixel sources. A 64 pixel hand and a hand drawn as a fist get no finger bones. |
|
|
58
58
|
| 48 | A grip for a hand drawn as a fist | Our scripts | The heavier second body holds the same sword: the fist and its wrist are found on the mesh, the grip runs through the fist. No new generations | Keep. A fist holds but cannot open, and which way it faces is assumed, not measured. |
|
|
59
|
+
| 49 | The left hand, and a shield | PixelLab, Hunyuan3D-2mv, our scripts | The sword sits in either body's left hand with no change; a generated shield is strapped to the left forearm of both and stands upright through the library's motions | Keep. The shield is carried, not used: the library has no shield or left-handed motions. |
|
|
60
|
+
| 50 | Two hands on one grip | PixelLab, Hunyuan3D-2mv, our scripts | A generated greatsword in both hands of both bodies through all twelve motions, by pulling the grip in front of the body and solving both arms at every moment | Keep as a baked fallback. Wrists bend past what a wrist can in some motions; real two-handed animations would be better. |
|
|
59
61
|
|
|
60
62
|
**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.
|
|
61
63
|
|
|
@@ -1276,6 +1278,81 @@ Not checked: the left fist holding something, the item fit at the moved wrists b
|
|
|
1276
1278
|
|
|
1277
1279
|
**Verdict.** Keep. A hand that is already closed needs a wrist and a grip point, not finger bones.
|
|
1278
1280
|
|
|
1281
|
+
## 49. The left hand, and a shield
|
|
1282
|
+
|
|
1283
|
+
**Question.** Steps 47 and 48 put a sword in the right hand of both bodies. Does the same work on the left, and can the other arm carry a shield?
|
|
1284
|
+
|
|
1285
|
+
**Setup.**
|
|
1286
|
+
|
|
1287
|
+
- *The left hand.* Nothing new: `Sword=sword.glb:LeftHand:held` on each bare body.
|
|
1288
|
+
- *The shield.* One PixelLab object, a heater shield upright with its face to the viewer in eight directions at 128 pixels, for 25 generations. Its front, left, back and right went to Hunyuan3D-2mv (eight and a half minutes), the mesh was coloured from the eight sprites and thinned from 29,999 triangles to 1,500.
|
|
1289
|
+
|
|
1290
|
+

|
|
1291
|
+
|
|
1292
|
+
- *Carrying it.* A shield is not gripped like a sword: it is strapped to the forearm. A new kind of item in `rig.py`, `Shield=shield.glb:LeftLowerArm:strapped`. The item's thinnest direction is its face's normal. That goes to the back of the forearm, the side away from the palm the hand measurement found. Its top goes towards the elbow, so it is upright when the arm hangs. Its back is set 0.4 sprite pixels off the arm's surface, 60% of the way from elbow to wrist. It is made 0.36 of the body's height tall and follows the forearm bone alone.
|
|
1293
|
+
- *Which way is its front.* Unlike the sword, a shield has a front and a top that its shape does not give away, so the file has to keep the frame of its sprites: upright, face to the viewer. `texture.py` fits the mesh to the sprites and leaves it in that frame.
|
|
1294
|
+
|
|
1295
|
+
**Result.**
|
|
1296
|
+
|
|
1297
|
+
- **The left hand holds the sword** on both bodies, the first with its finger bones and the second in its fist, with no change to the script:
|
|
1298
|
+
|
|
1299
|
+

|
|
1300
|
+
|
|
1301
|
+
- **The shield stands upright on the left forearm** of both, face outward, through the sword idle, the walk and the sword attack (first body above, second below):
|
|
1302
|
+
|
|
1303
|
+

|
|
1304
|
+
|
|
1305
|
+
- **Each file is valid:** 19,497 triangles and 2.8 MB for the first body, 19,494 and 2.7 MB for the second, with the shield as a sixth separate item. Godot 4.7.2 imports both with no errors. The viewer lists the shield among the things worn on both.
|
|
1306
|
+
- **The shield's paint is cleaner than the sword's.** Its broad flat faces take the sprites' colours well; the silhouette matches the sprites 92%.
|
|
1307
|
+
|
|
1308
|
+
Flaws:
|
|
1309
|
+
|
|
1310
|
+
- **The shield is carried, not used.** The library has no block or shield motions, so the left arm does what it does with nothing on it.
|
|
1311
|
+
- **A sword in the left hand cuts through the thigh in the idle,** for the same reason: every sword motion in the library is right-handed.
|
|
1312
|
+
- **The left hand does not grip anything.** The shield hangs from the forearm, and the straps on its back are paint.
|
|
1313
|
+
|
|
1314
|
+
Not checked: whether the shield passes through the cape or the body in motions that bring the arm across (nothing keeps a rigid item out of other meshes), a shield on the right arm, a round shield or a buckler held in the fist, the shield on the 64 pixel body, and both items in Godot's own renderer.
|
|
1315
|
+
|
|
1316
|
+
**Verdict.** Keep. Two kinds of rigid item now cover the common cases: `held` for what a hand closes round, `strapped` for what an arm carries.
|
|
1317
|
+
|
|
1318
|
+
## 50. Two hands on one grip
|
|
1319
|
+
|
|
1320
|
+
**Question.** Steps 47 to 49 hold things in one hand. A greatsword needs two. The animation library has no two-handed motions, so can its one-handed ones be made to carry a second hand?
|
|
1321
|
+
|
|
1322
|
+
**Setup.**
|
|
1323
|
+
|
|
1324
|
+
- *The greatsword.* One PixelLab object in eight directions at 128 pixels, for 25 generations, asked for with a grip long enough for two hands. Meshed by Hunyuan3D-2mv in a little over two minutes, coloured from the sprites (89.5% silhouette match) and thinned from 30,000 triangles to 1,499.
|
|
1325
|
+
|
|
1326
|
+

|
|
1327
|
+
|
|
1328
|
+
- *Where the hands go.* A new kind of item in `rig.py`, `Greatsword=greatsword.glb:RightHand:two-handed`. The hand named leads and sits just under the guard. The other goes under it, towards the pommel, by the breadth of the two hands: 70% of an open hand's length, or the width of a fist. That place is written into the file as a bone with no skin, `RightGrip2`, on the leading hand. The sword was made 0.8 of the body's height long.
|
|
1329
|
+
- *What the file now carries.* Each grip bone's node has the hand's grip line and palm direction in its `extras`, and `RightGrip2` has the handle's line and the name of the hand that belongs there, so a later step or an engine needs nothing else.
|
|
1330
|
+
- *Moving the other hand.* A new script, [`scripts/offhand.py`](../research/scripts/offhand.py), run on the animated file. At each of thirty moments a second it turns the other hand so its grip lies along the handle, thumb towards the guard, tries 48 rolls round the handle and keeps the one that bends the wrist least without jumping from the moment before. Each arm is then a triangle of two fixed sides from shoulder to wrist.
|
|
1331
|
+
- *The other hand's fingers* copy the leading hand's, mirrored, where both have finger bones.
|
|
1332
|
+
|
|
1333
|
+
**Result.**
|
|
1334
|
+
|
|
1335
|
+
- **Moving one arm is not enough.** The first version left the leading hand where the library put it. The other hand reached the grip in none of the twelve motions, falling 23 to 38 centimetres short: a one-handed sword is carried at the hip, further from the other shoulder than an arm is long.
|
|
1336
|
+
- **Pulling the grip to wherever both arms could reach** put the sword behind the back, arms crossed behind the body, in the sword idle.
|
|
1337
|
+
- **What works:** the whole grip is pulled the least distance that lets both arms reach it with both hands at least 22 centimetres in front of the spine, and each elbow is pointed down, outwards and a little back instead of where the one-handed motion had it. Sword idle, walk and sword attack, the first body above and the second below:
|
|
1338
|
+
|
|
1339
|
+

|
|
1340
|
+
|
|
1341
|
+
- **The first body's other hand is on the grip at every moment of all twelve motions.** The grip is pulled 43 to 67 centimetres from where the one-handed motion had it.
|
|
1342
|
+
- **The second body's fists overlap a little:** the handle is 28.3 sprite pixels and his two fists need 29. His hand is on the grip throughout ten motions, falls up to 1.2 centimetres short in 4% of the sword attack, and up to 7 centimetres short through most of the dance.
|
|
1343
|
+
- **The file is valid:** 17,997 triangles and 2.7 MB for the first body, 48 bones. Godot 4.7.2 imports it with no errors. The viewer has it as "Two hands on a greatsword".
|
|
1344
|
+
|
|
1345
|
+
Flaws:
|
|
1346
|
+
|
|
1347
|
+
- **Wrists bend too far in some motions.** On the first body the other wrist stays within 15 degrees in the sword idle and 50 in the walk and the attack, but reaches about 100 in the jog and sprint and 129 in the roll. A wrist manages about 80.
|
|
1348
|
+
- **The motions are still one-handed ones.** The body's weight, the swing and the footwork are those of a light sword; only the arms were changed.
|
|
1349
|
+
- **Nothing keeps the blade out of the body, the cape or the ground.**
|
|
1350
|
+
- **The old keys stay in the file** as unused data, which the validator notes and which adds a few tens of kilobytes.
|
|
1351
|
+
|
|
1352
|
+
Not checked: the left hand leading, a staff or a spear, the two-handed file in Godot's own renderer, and how the pulled grip looks through the whole of each motion beyond the three shown.
|
|
1353
|
+
|
|
1354
|
+
**Verdict.** Keep as a fallback that works in any engine. An engine with an arm solver should use the `RightGrip2` bone live, and real two-handed animations would beat both.
|
|
1355
|
+
|
|
1279
1356
|
## What has not worked, in one place
|
|
1280
1357
|
|
|
1281
1358
|
So nobody repeats them:
|
|
@@ -1310,7 +1387,7 @@ Two bugs worth remembering, because both produced plausible wrong pictures: glTF
|
|
|
1310
1387
|
- **Sixteen directions and lighting for the sprite cards** (step 31): the in-between views of step 13, and normals from the hidden mesh.
|
|
1311
1388
|
- **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.
|
|
1312
1389
|
- **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).
|
|
1313
|
-
- **Held items.**
|
|
1390
|
+
- **Held items.** Steps 47 to 50 put a sword in either hand, open or drawn as a fist, a shield on a forearm, and a greatsword in both hands. Still to do: a handle sized to the hand, wrist limits for the two-handed pass, and motions made for a shield, a left-handed sword or two hands.
|
|
1314
1391
|
- **A score that sees cleanliness.** Colour error against one drawing cannot tell a clean redraw from a torn render.
|
|
1315
1392
|
- **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.
|
|
1316
1393
|
- **Carve at a finer grid** than one voxel per pixel, so thin objects survive.
|
|
@@ -1406,6 +1483,8 @@ No public tool was found that takes several directional pixel sprites and return
|
|
|
1406
1483
|
- A-poses in step 21: 20 generations for the two states, 0.25 for importing the knight, 1.6 for sixteen joint estimates.
|
|
1407
1484
|
- The body and its five layers in step 26: 52.8 generations (2 for the body, 10 for each layer, 0.8 for the joints), read from the balance before and after.
|
|
1408
1485
|
- The sword of step 47: 25 generations for the eight directions, and six and a half minutes of GPU time for its mesh.
|
|
1486
|
+
- The shield of step 49: 25 generations for the eight directions, and eight and a half minutes of GPU time for its mesh.
|
|
1487
|
+
- The greatsword of step 50: 25 generations for the eight directions, and a little over two minutes of GPU time for its mesh.
|
|
1409
1488
|
- Nine meshes in step 27: about two minutes of GPU time each. Five paint runs in step 29: five to six minutes each.
|
|
1410
1489
|
|
|
1411
1490
|
## Running the scripts
|