pixelkiln 0.126.0 → 0.128.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 +36 -3
- package/docs/RESEARCH_3D.md +91 -1
- package/package.json +1 -1
package/docs/CHARACTERS_3D.md
CHANGED
|
@@ -232,7 +232,8 @@ the palm of the hand named, puts its grip at that hand's grip point, and makes
|
|
|
232
232
|
it `HELD_LENGTH` of the body's height long (default 0.5). The file's own
|
|
233
233
|
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
|
-
to back, blade to the front,
|
|
235
|
+
to back, blade to the front, a little short of square to the forearm
|
|
236
|
+
(`FIST_LEAN`, 80 degrees), and the guard is kept clear of the fist's side.
|
|
236
237
|
|
|
237
238
|
Either hand works: name `LeftHand` for the left.
|
|
238
239
|
|
|
@@ -250,6 +251,36 @@ elbow, so it stands upright when the arm hangs, and it is made
|
|
|
250
251
|
lays it across the arm. It follows the forearm alone and needs no hand
|
|
251
252
|
bones.
|
|
252
253
|
|
|
254
|
+
Two hands on one grip takes the `two-handed` kind and one more script:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
HELD_LENGTH=0.8 ITEMS="Greatsword=<greatsword.glb>:RightHand:two-handed" python3 research/scripts/rig.py <body-light.glb> <body.rig.json> - - <character.glb>
|
|
258
|
+
python3 research/scripts/retarget.py <character.glb> <library.glb> <animated.glb>
|
|
259
|
+
python3 research/scripts/offhand.py <animated.glb> <two-handed.glb>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The hand named leads and sits under the guard. `rig.py` leaves a bone,
|
|
263
|
+
`RightGrip2`, where the other hand belongs. `offhand.py` then goes through
|
|
264
|
+
every animation: it pulls the grip in front of the body until both arms can
|
|
265
|
+
reach it, bends both arms to meet it, and stores the result as keys. It
|
|
266
|
+
prints, for each animation, how far the grip was pulled, whether the hand
|
|
267
|
+
ever fell short and how far a wrist bends. Run it after `retarget.py` and
|
|
268
|
+
before `sway.py`. An engine with its own arm solver can use the `RightGrip2`
|
|
269
|
+
bone and skip the script.
|
|
270
|
+
|
|
271
|
+
Those are one-handed motions bent to fit. For motions made for two hands,
|
|
272
|
+
run one more script after it:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
python3 research/scripts/wield.py <two-handed.glb> <with-great-motions.glb>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
It adds `Great_Idle`, `Great_Walk`, `Great_Jog` and `Great_Attack`: the
|
|
279
|
+
sword's path is written in the script, both arms are solved to it, and the
|
|
280
|
+
legs and trunk come from the stock idle, walk and jog. It prints how far each
|
|
281
|
+
wrist bends, how far the blade is off its edge and whether a hand fell short.
|
|
282
|
+
To add a motion, add an entry to `MOTIONS` at the top of the script.
|
|
283
|
+
|
|
253
284
|
Then animate as in step 8. `retarget.py` carries the library's thumb and
|
|
254
285
|
middle finger over, so the hand is a fist in a walk and closed round the grip
|
|
255
286
|
in a sword attack. A fist has no fingers to move and holds as drawn.
|
|
@@ -288,8 +319,10 @@ swing. See step 31 of the research note.
|
|
|
288
319
|
redraw's lighting is painted in.
|
|
289
320
|
- **Separate fingers, eyes and a jaw** in the skeleton. The four fingers
|
|
290
321
|
move as one, and only on the painted path.
|
|
291
|
-
- **Held items beyond
|
|
292
|
-
|
|
322
|
+
- **Held items beyond swords and a shield.** A shield gripped in the fist is
|
|
323
|
+
untried, the grip is not sized to the hand, there are four motions made for two hands
|
|
324
|
+
and the rest are stock one-handed ones bent to fit, which can bend a wrist
|
|
325
|
+
too far,
|
|
293
326
|
and the animation library has no left-handed or shield motions, so a shield
|
|
294
327
|
is carried, not used. A fist cannot open, so it cannot let go or change its hold.
|
|
295
328
|
- **Many bodies.** The items have been worn by two: the one they were cut on
|
package/docs/RESEARCH_3D.md
CHANGED
|
@@ -57,6 +57,8 @@ Last updated 17 November 2026.
|
|
|
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
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. |
|
|
61
|
+
| 51 | Motions made for two hands | Our scripts | Four two-handed motions (a guard, a walk, a jog and a cut) made by writing down the sword's path and solving both arms to it. Wrists stay within 52 degrees on the first body, where the bent one-handed motions reached 100 | Keep. Use these where a motion exists, and step 50's bent ones for the rest. |
|
|
60
62
|
|
|
61
63
|
**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.
|
|
62
64
|
|
|
@@ -1314,6 +1316,93 @@ Not checked: whether the shield passes through the cape or the body in motions t
|
|
|
1314
1316
|
|
|
1315
1317
|
**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.
|
|
1316
1318
|
|
|
1319
|
+
## 50. Two hands on one grip
|
|
1320
|
+
|
|
1321
|
+
**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?
|
|
1322
|
+
|
|
1323
|
+
**Setup.**
|
|
1324
|
+
|
|
1325
|
+
- *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.
|
|
1326
|
+
|
|
1327
|
+

|
|
1328
|
+
|
|
1329
|
+
- *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.
|
|
1330
|
+
- *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.
|
|
1331
|
+
- *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.
|
|
1332
|
+
- *The other hand's fingers* copy the leading hand's, mirrored, where both have finger bones.
|
|
1333
|
+
|
|
1334
|
+
**Result.**
|
|
1335
|
+
|
|
1336
|
+
- **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.
|
|
1337
|
+
- **Pulling the grip to wherever both arms could reach** put the sword behind the back, arms crossed behind the body, in the sword idle.
|
|
1338
|
+
- **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:
|
|
1339
|
+
|
|
1340
|
+

|
|
1341
|
+
|
|
1342
|
+
- **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.
|
|
1343
|
+
- **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.
|
|
1344
|
+
- **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".
|
|
1345
|
+
|
|
1346
|
+
Flaws:
|
|
1347
|
+
|
|
1348
|
+
- **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.
|
|
1349
|
+
- **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.
|
|
1350
|
+
- **Nothing keeps the blade out of the body, the cape or the ground.**
|
|
1351
|
+
- **The old keys stay in the file** as unused data, which the validator notes and which adds a few tens of kilobytes.
|
|
1352
|
+
|
|
1353
|
+
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.
|
|
1354
|
+
|
|
1355
|
+
**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.
|
|
1356
|
+
|
|
1357
|
+
## 51. Motions made for two hands
|
|
1358
|
+
|
|
1359
|
+
**Question.** Step 50 bent one-handed motions until the second hand reached the grip, and the wrists paid for it. Its verdict was that real two-handed motions would be better. Where do they come from?
|
|
1360
|
+
|
|
1361
|
+
**Looked for first.** A free library that has them. [Quaternius's second animation library](https://quaternius.com/packs/universalanimationlibrary2.html) (CC0) lists sword combos, shield idles, farming and parkour in its free edition, and no two-handed weapon. The greatsword packs a search turned up are paid and made for one engine's skeleton. Nothing was downloaded.
|
|
1362
|
+
|
|
1363
|
+
**Setup.** A new script, [`scripts/wield.py`](../research/scripts/wield.py), makes them. It goes the other way round from step 50: the path of the sword is written down, and both arms are solved to it.
|
|
1364
|
+
|
|
1365
|
+
- *What is written.* For each motion, a few moments: where the grip is and which way the handle points, in a frame that rides on the chest and is measured in arm lengths, and how far the spine leans. The script draws a smooth curve through them.
|
|
1366
|
+
- *What is taken.* The legs, hips, spine and head of a stock motion the file already carries: the idle, the walk and the jog.
|
|
1367
|
+
- *What is solved.* At thirty moments a second the leading hand goes on the grip and the other on the `RightGrip2` bone of step 50. Each hand may still roll round the handle. The leading hand's roll is chosen for a straight wrist and a blade whose edge, not its flat, faces the way it is swung; the other's for a straight wrist. A loop is solved twice round so that it ends on the roll it starts with. If an arm cannot reach, the grip is pulled in by what it fell short.
|
|
1368
|
+
- *The four motions.* `Great_Idle`, a guard with the blade upright before the body; `Great_Walk` and `Great_Jog`, the same guard carried; `Great_Attack`, 1.4 seconds: the sword goes up over the right shoulder, cuts down to the front with the trunk leaning 24 degrees into it, and returns.
|
|
1369
|
+
- *How the poses were picked.* Each key pose was tried against a few dozen neighbours on both bodies, and the one with the straightest wrists kept.
|
|
1370
|
+
|
|
1371
|
+
**Result.**
|
|
1372
|
+
|
|
1373
|
+

|
|
1374
|
+
|
|
1375
|
+
How far a wrist bends at most, in degrees. Step 50's figures are for the motion the new one replaces, as measured then.
|
|
1376
|
+
|
|
1377
|
+
| | Step 50, first body | First body | Second body |
|
|
1378
|
+
|---|---|---|---|
|
|
1379
|
+
| Idle on guard | 15 (sword idle) | 28 | 56 |
|
|
1380
|
+
| Walk | 50 | 29 | 58 |
|
|
1381
|
+
| Jog | about 100 | 52 | 56 |
|
|
1382
|
+
| Attack | 50 | 42 | 69 |
|
|
1383
|
+
|
|
1384
|
+
- **Both hands are on the grip throughout,** on both bodies. The second body's grip is pulled in 5 centimetres in the guard and 10 in the jog, because his chest is broad for his arms; his hand is 2 millimetres short at one point of the attack.
|
|
1385
|
+
- **The loops close:** the arms at the last moment are within 4 degrees of the first.
|
|
1386
|
+
- **The files are valid.** The first body's is 17,997 triangles and 2.9 MB with sixteen motions; the four new ones add about 200 KB. Godot 4.7.2 imports both bodies' files with no errors and finds the 17 bones its humanoid profile requires. The viewer's greatsword model now opens on the new walk.
|
|
1387
|
+
|
|
1388
|
+
Three things were learned on the way:
|
|
1389
|
+
|
|
1390
|
+
- **A closed hand cannot lay a handle along its forearm.** The first attack ended with the arms out and the blade level, and the leading wrist bent 90 degrees. The cut now lands with the blade rising from the hands, and wrists stay within 42.
|
|
1391
|
+
- **This body cannot raise a sword over its head.** Its arms are short for its head, so hands "above the head" were at its chin and the blade went through the helm. The sword is raised over the leading shoulder instead, which also gave straighter wrists (16 degrees on the first body, against 33 or more before the brow).
|
|
1392
|
+
- **A fist's shape does not say how it holds a handle.** Step 48 took the grip's line from the fist's widest side. On the second body that line leaned 25 degrees towards the elbow, the wrong way, and the motions bent his wrist 60 to 90 degrees. `rig.py` now sets a fist's hold 80 degrees to the forearm, thumb end away from the elbow (`FIST_LEAN`). His wrists came down to the figures above, and step 50's bent motions improved with it: the sword attack from 1.2 centimetres short to 0.8, the dance from 7 to 4. His sword-and-shield model on the site is rebuilt with the new hold; his sword sits a little flatter in the idle.
|
|
1393
|
+
|
|
1394
|
+
Flaws:
|
|
1395
|
+
|
|
1396
|
+
- **The blade is not edge-on.** It sits 25 to 30 degrees off its edge on the first body and 40 to 50 on the second, because a straight wrist and a true edge pull against each other and the script splits the difference (`EDGE`).
|
|
1397
|
+
- **The second body's raised blade passes through the fur on his shoulder,** and nothing keeps the blade out of the body, the cape or the ground on either.
|
|
1398
|
+
- **Only the arms and the lean of the spine were made.** The attack stands on the idle's feet: there is no step, no turn of the hips, no weight. The jog carries the guard; it has no carry of its own.
|
|
1399
|
+
- **Four motions.** Death, the roll, the hit and the jump are still step 50's bent ones.
|
|
1400
|
+
- **The poses were picked on these two bodies.** A body with other proportions gets the pull-in and whatever wrists follow.
|
|
1401
|
+
|
|
1402
|
+
Not checked: how the motions read in play in an engine, the whole of each motion beyond the four moments pictured and the script's own figures, the left hand leading, and a staff or spear.
|
|
1403
|
+
|
|
1404
|
+
**Verdict.** Keep. For a motion that exists in this form, it beats bending a one-handed one: the wrists stay inside what a wrist does and the sword goes where it was told. It is not a replacement for an animator or for captured motion.
|
|
1405
|
+
|
|
1317
1406
|
## What has not worked, in one place
|
|
1318
1407
|
|
|
1319
1408
|
So nobody repeats them:
|
|
@@ -1348,7 +1437,7 @@ Two bugs worth remembering, because both produced plausible wrong pictures: glTF
|
|
|
1348
1437
|
- **Sixteen directions and lighting for the sprite cards** (step 31): the in-between views of step 13, and normals from the hidden mesh.
|
|
1349
1438
|
- **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.
|
|
1350
1439
|
- **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).
|
|
1351
|
-
- **Held items.** Steps 47 to
|
|
1440
|
+
- **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. Still to do: a handle sized to the hand, footwork and weight for the two-handed attack, a staff or spear, and motions made for a shield or a left-handed sword.
|
|
1352
1441
|
- **A score that sees cleanliness.** Colour error against one drawing cannot tell a clean redraw from a torn render.
|
|
1353
1442
|
- **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.
|
|
1354
1443
|
- **Carve at a finer grid** than one voxel per pixel, so thin objects survive.
|
|
@@ -1445,6 +1534,7 @@ No public tool was found that takes several directional pixel sprites and return
|
|
|
1445
1534
|
- 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.
|
|
1446
1535
|
- The sword of step 47: 25 generations for the eight directions, and six and a half minutes of GPU time for its mesh.
|
|
1447
1536
|
- The shield of step 49: 25 generations for the eight directions, and eight and a half minutes of GPU time for its mesh.
|
|
1537
|
+
- The greatsword of step 50: 25 generations for the eight directions, and a little over two minutes of GPU time for its mesh.
|
|
1448
1538
|
- Nine meshes in step 27: about two minutes of GPU time each. Five paint runs in step 29: five to six minutes each.
|
|
1449
1539
|
|
|
1450
1540
|
## Running the scripts
|