pixelkiln 0.123.0 → 0.124.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  This is a research note, not a feature: nothing here is a PixelKiln command, and the scripts are rough. PixelKiln already generates an object or a character from eight directions. This note records every attempt to turn those eight pictures into a 3D model: what was tried, with what, and what came out.
4
4
 
5
- Last updated 16 November 2026.
5
+ Last updated 17 November 2026.
6
6
 
7
7
  ## Summary
8
8
 
@@ -22,6 +22,39 @@ Last updated 16 November 2026.
22
22
  | 12 | Carved shape cut back to the mesh | Our script | No better than carving alone | Drop. |
23
23
  | 13 | Have an image model redraw the model's rough renders | PixelLab `edit_image`, `inpaint_image`, `correct_pixelart` | Clean sprites at angles the generator never drew: sixteen directions from eight, for 10 generations | Keep. This is the best result so far, and it changes what the 3D model is for. |
24
24
  | 14 | Paint the redrawn views back onto the model | Our script | Smoother, still muddy | Drop for now. The model is a guide, not the final picture. |
25
+ | 15 | Flatten the texture to a few materials and light it in the renderer | Our script | No blotches, and no detail either | Partly. The lighting is worth keeping; the flattening loses too much. |
26
+ | 16 | Put the skeleton in the mesh, skin it, add a walk, export a rigged `.glb` | Our script | Valid glTF with 15 bones and a walk, for both characters | Keep. This is the first file here a 3D game can import and animate. |
27
+ | 17 | Install Hunyuan3D's paint stage on the RTX 3060 | Second ComfyUI, community node | Runs in 12 GB after one patch; about 40 seconds a pass | Keep. |
28
+ | 18 | Flat base with trusted sprite pixels laid back on top | Our script | Eyes and trim return; the tearing does not change | Drop. The tearing is in the shape, not the shading. |
29
+ | 19 | Use the Hunyuan3D mesh for the knight, not the carved shape | Hunyuan3D-2mv | Real horns, separate arms and legs; the same texturing reads far better | Keep for complex characters. No gain on the bare character. |
30
+ | 20 | Paint the mesh with the paint stage, once per sprite direction | Hunyuan3D-2 paint | Each sprite redrawn to fit the mesh; a clean texture from every side | Keep. The best texture in this note. |
31
+ | 21 | Redraw the character in an A-pose before meshing | PixelLab character state | Arms clear of the body in all eight views, for 10 generations a character | Keep. The mesh and the rig both need it. |
32
+ | 22 | Round the pixel edges off the pictures the mesh model sees | Our script, Hunyuan3D-2mv | The bare character goes from a figure made of boxes to a sculpted body with a face | Keep. The largest gain in shape since step 8. |
33
+ | 23 | Bake the painted views on this machine, with side views and colour correction | Our script | 24 views from 8 passes, no visible seams; the rim and colour-matching ideas made it worse | Keep the side views and the correction. Drop the other two. |
34
+ | 24 | Measure skin weights through the inside of the mesh | Our script | The cape hangs from the shoulders, not the legs; the walk lowers the arms | Keep. |
35
+ | 25 | Carry the sprites' palette in the file and snap to it when drawing | Our script, a shader in the viewer | Renders at sprite size read as sprites; the colour score still prefers the stitched texture | Keep the look. The score is the wrong judge. |
36
+ | 26 | A leaner bare body, with each item drawn as its own layer | PixelLab v3 character, PixelKiln layers | A slim figure in underwear and four clean item layers; the mesh is still stocky | Keep. The mesh inherits the sprite's four-heads-tall build. |
37
+ | 27 | Mesh each item on its own, or mesh the body wearing it and cut the item out | Hunyuan3D-2mv, our scripts | Alone, thin items collapse into slabs; cut from the worn mesh, all four hold their shape | Cut from the worn mesh. |
38
+ | 28 | The body and four items as separate meshes on one skeleton | Our script | One .glb, items switch on and off, all walk together | Keep. Painted in step 29. |
39
+ | 29 | Paint the body and each worn mesh before cutting the item out | Hunyuan3D paint stage, our bake | Clean armour, cape and skin in place of speckle; colours drift cooler and the gold is duller | Keep. The colour drift is handled in step 30. |
40
+ | 30 | Hide the skin under what is worn, and bake each item in its own colours | Our script | The body is six pieces, each hidden while its item is on; orange flecks in the walk turned out to be dulled gold snapped to skin colour, and are gone | Keep. |
41
+ | 31 | Draw the character as sprite cards on the skeleton, with no textured mesh shown | Our script, three.js | Crisp drawn pixels from any angle, walking, with items that switch off | Keep as a second way to show a character. Eight directions and open joints are the limits. |
42
+ | 32 | Redraw the sprites large with a local image model, and paint from those | SDXL with a tile control model, Hunyuan3D paint stage | Painted armour with real detail in place of enlarged pixels; 768 pixel views fit in 12 GB | Keep. The eight redraws do not agree on details, and colours move. |
43
+ | 33 | Make the redraws agree: one sheet for all eight, or each alone with the sprite's colours held | SDXL with a tile control model | Holding colours fixes the drift and keeps the detail; the one-sheet redraw agrees but is soft | Keep the colour hold. Drop the sheet. |
44
+ | 34 | Mesh from redrawn pictures in place of smoothed sprites | SDXL redraw, Hunyuan3D-2mv | A round skull, a face, ears, arms and legs with shape, where there were flat facets | Keep. The largest gain in the mesh since step 22. |
45
+ | 35 | Rebuild the body and all four items from redrawn pictures, end to end | SDXL redraw, Hunyuan3D-2mv and its paint stage, our scripts | A sculpted body and detailed helm, armour and cape on the same skeleton; one sleeve short, a gap at the hip, a teal fur collar | Keep as the viewer's model. The item masks still come from the sprites and no longer fit exactly. |
46
+ | 36 | Move each item's edge to where the paint puts it, and stop the bake shifting colours | Our scripts | Skin scraps and the hip gap are gone; the collar is grey again, the helm black, the underwear grey | Keep. One sleeve still ends at mid forearm. |
47
+ | 37 | Open the parts model in a game engine | Godot 4.7.2, headless | Ten skinned meshes, fifteen named bones, the walk, and each body piece's hide list all arrive | Keep. The first check outside three.js. |
48
+ | 38 | A second painter, MV-Adapter | MV-Adapter on SDXL, our own guide pictures | It runs and its front view is sharp and faithful; one pass takes 11 minutes and overfills the 12 GB card; the sides it invents are wrong | Drop on this card. Keep the scripts. |
49
+ | 39 | Sprites drawn at 256 pixels at the source | PixelLab v3 character and four states | An adult-proportioned figure and four worn versions, each agreeing across eight directions | Keep. The best source art so far; not yet meshed. |
50
+ | 40 | Rebuild everything from the 256 pixel sprites | PixelLab, SDXL redraw, Hunyuan3D-2mv and its paint stage, our scripts | An adult-proportioned, painted body and four detailed items on one skeleton; imports into Godot | Keep as the viewer's model. Still 80,000 triangles and one home-made skeleton. |
51
+ | 41 | Thin every part and bake the paint and a normal map onto the light mesh | Our script | 16,496 triangles for 79,819 and 2.1 MB for 6.3, with no visible loss in an unlit render | Keep. The viewer's model is the light one. |
52
+ | 42 | A standard humanoid skeleton | Our script, Godot's humanoid profile | Twenty-one bones; every bone Godot's profile requires is found by name, under the right parent | Keep. No stock animation has been put on it yet. |
53
+ | 43 | Put stock animations on the skeleton | Quaternius's Universal Animation Library (CC0), our script | Eleven library animations play on the knight: idle, walk, jog, sprint, sword attack, death and others | Keep. The character now moves like a game character. |
54
+ | 44 | Paint views from above and below as well | Hunyuan3D paint stage, our bake | The dark streaks on arm tops, shoulders and heads are gone | Keep. The viewer's model is rebuilt with it. |
55
+ | 45 | Bones for the cape, and a simulation that swings them | Our scripts | Twelve cape bones in three chains; the cape streams in a sprint, hangs in an idle and falls in a roll, baked into every animation | Keep. It works in any engine with no physics set up. |
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
+ | 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. |
25
58
 
26
59
  **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.
27
60
 
@@ -334,7 +367,7 @@ Top pair of rows: directions 1 to 8 as rendered from the model, then after `edit
334
367
 
335
368
  The redrawn in-between views are a clean, recognisable knight. They are also a little squat next to the drawn ones: the carve loses some of the horns' height and the head sits lower, and the redraw keeps the model's proportions. Editing by reference cleaned less than editing by instruction here.
336
369
 
337
- The sixteen directions are on the website as a viewer that turns the character, on the [paperdoll page](https://pixelkiln.griffen.codes/paperdoll#turnaround), with a switch to the raw model.
370
+ The sixteen directions are on the website as a viewer that turns the character, on the [3D characters page](https://pixelkiln.griffen.codes/3d#turnaround), with a switch to the raw model.
338
371
 
339
372
  **Verdict.** Keep, and change direction. The 3D model does not have to look good. It has to put the right shapes and rough colours in the right place from any angle, and an image model does the drawing. Eight new directions cost 10 generations.
340
373
 
@@ -352,6 +385,862 @@ Slightly smoother, still blotchy, and the score against the sprites got worse (c
352
385
 
353
386
  **Verdict.** Drop for now. Sixteen separate drawings disagree as much as eight did. A texture stitched from separate drawings of a 64-pixel figure comes out muddy however the stitching is done, which is the lesson of steps 9 to 14 together.
354
387
 
388
+ ## 15. Flat materials and light from the renderer
389
+
390
+ **Question.** The blotches on the stitched texture are each sprite's own hand-drawn shading. If the texture is reduced to flat colour and the light is added by the renderer instead, the same from every side, do they go?
391
+
392
+ **Setup.** `FLAT=<k>` in `texture.py` sorts the texels into k materials by colour (mostly hue, a little brightness), lets neighbours on the surface agree, and paints each material one colour taken from its lit side. The render then adds three flat bands of light from the upper left, using normals from a smoothed copy of the mesh, since the carved surface is bumpy at the scale of a voxel and raw normals break the bands into noise. `TOON=1` adds the same light without flattening.
393
+
394
+ **Result.** Each pair of rows is the model from the eight drawn directions and the eight between. Top pair: the bare character as two materials. Middle pair: the knight as nine materials. Bottom pair: the knight with its full stitched texture and the same light.
395
+
396
+ ![Flat materials with toon lighting, and the full texture with the same lighting](../website/public/research/3d/flat-toon.png)
397
+
398
+ - **The blotches are gone, and so is everything else.** The bare character is a clean clay figure with no face or muscle. The knight keeps its cape and fur and loses its trim, eyes and armour detail; skin and gold run together as orange patches.
399
+ - **Black armour came out brown at five materials** and dark grey at nine. Sorting by hue has little to work with on dark, unsaturated colours.
400
+ - **The full texture with renderer light (bottom pair) reads best of the three.** The light gives the form a consistent shape that helps hide the stitching.
401
+
402
+ **Verdict.** Keep the lighting, drop the flattening as a default. Flat colour would suit a simple object or a deliberately flat style. For a character, the detail has to come from somewhere better than eight disagreeing drawings, which is what step 17 is for.
403
+
404
+ ## 16. A skeleton in the mesh
405
+
406
+ **Question.** Can the carved, textured character leave here as something a 3D game can animate?
407
+
408
+ **Setup.** [`scripts/rig.py`](../research/scripts/rig.py).
409
+
410
+ - **Bones.** The 18 joints from step 6 become fifteen bones named the way engines name a humanoid: Hips, Spine, Head, and Upper Arm, Lower Arm, Hand, Upper Leg, Lower Leg, Foot on each side. For the knight, the joints estimated on the bare character were triangulated again in the knight's own frame (mean error 1.4 pixels).
411
+ - **Skin weights.** Each vertex follows up to four bones, weighted by how close it is to each. Distance alone would bind an arm hanging at the side to the spine, so a bone is penalised when the straight line from the vertex to it leaves the body.
412
+ - **A walk.** One nine-key loop: thighs and upper arms swing against each other, knees bend on the back swing.
413
+ - **The file.** A `.glb` in metres, y up, 1.8 m tall, with the texture inside it set to hard pixel edges, the skin, and the animation named `Walk`.
414
+
415
+ **Result.** Which bone each part of the surface follows most, from four sides:
416
+
417
+ ![Skin weights on the bare character, one colour per bone](../website/public/research/3d/rig-weights.png)
418
+
419
+ The walk, posed here with the file's own bones and weights and drawn from the front, three-quarters and side. Top three rows: the bare character. Bottom three: the knight.
420
+
421
+ ![Eight frames of the walk for both characters from three angles](../website/public/research/3d/rig-walk.png)
422
+
423
+ - **Both files pass the Khronos glTF validator** with no errors or warnings.
424
+ - **Sizes:** the bare character is 7,571 vertices and 10,460 triangles in 562 KB; the knight is 10,433 vertices and 15,120 triangles.
425
+ - **They load and play in three.js**, which is what the viewer on the [3D characters page](https://pixelkiln.griffen.codes/3d#mesh) uses. They were not opened in Blender, Unity, Godot or Unreal here.
426
+ - **The knight's cape follows the legs,** because it is bound to the nearest bones like everything else. A cape wants bones of its own or cloth simulation.
427
+ - **Dark patches open up on the inner thighs** as the legs part: that surface was never seen by any sprite and was filled in.
428
+ - **The hands, feet and head are single bones.** There are no fingers, toes, jaw or eyes.
429
+
430
+ **Verdict.** Keep. The rig is the part of this note closest to the goal: characters that can be animated and imported into 3D games. The mesh and skeleton are sound. The texture is what is holding the result back.
431
+
432
+ ## 17. Hunyuan3D's paint stage, installed
433
+
434
+ **Question.** Hunyuan3D has a second stage that textures a mesh from a reference image, consistently from every side. Can it run on the RTX 3060 used in step 8?
435
+
436
+ **Setup.** The ComfyUI already on that machine could not run it: its built-in Hunyuan3D nodes make shapes only, and the community node that adds the paint stage, [ComfyUI-Hunyuan3DWrapper](https://github.com/kijai/ComfyUI-Hunyuan3DWrapper), ships its compiled renderer for Python 3.12, where that install is Python 3.13. So a second ComfyUI went in beside the first, which was not touched:
437
+
438
+ - Python 3.12 in its own virtual environment, PyTorch 2.6.0 for CUDA 12.6, and the node's renderer wheel built for that pair.
439
+ - ComfyUI pinned to v0.3.27. The current release needs a newer PyTorch than the wheel was built for and fails on start.
440
+ - The paint model, `hunyuan3d-paint-v2-0`, which the node downloads on first use: 9.2 GB. The delight model was not used; the sprites carry no photographic lighting to remove.
441
+
442
+ **Result.**
443
+
444
+ - **The prebuilt renderer has no GPU code for this card.** It fails with "no kernel image is available for execution on the device": the wheel was compiled for a newer GPU generation. The same library has a CPU path that gives the same result, so one line in `custom_rasterizer/render.py` was changed to move its inputs to the CPU and its outputs back. Rasterising a 1024-pixel view on the CPU takes well under a second. No compiler or CUDA toolkit was installed.
445
+ - **It fits in 12 GB.** A full pass, six views at 512 pixels and 25 steps, takes about 40 seconds once the model is loaded, and about two minutes cold.
446
+ - **Given one front view, it invents the rest, and gets the back wrong.** The six views it painted for the knight from the south sprite alone: front, side, back, side, top, bottom. The back has a second face and chest where the cape should be.
447
+
448
+ ![Six views painted from one front reference; the back view shows a second face](../website/public/research/3d/paint-single-reference.png)
449
+
450
+ **Verdict.** Keep. It runs, it is fast, and its front view is the first picture in this note that is both faithful to the sprite and fitted to the mesh. Step 20 uses that.
451
+
452
+ ## 18. A flat base with the sprites laid back on top
453
+
454
+ **Question.** Step 15's flat materials were clean and featureless. If the flat texture is the base, and the sprites' own pixels are put back only where they can be trusted, is the result both clean and detailed?
455
+
456
+ **Setup.** `OVERLAY=<0 to 1>` in `texture.py`, with `FLAT`. A texel takes its sprite colour back when the surface faces the view at least that squarely, it is not on the sprite's rim or beside a jump in depth, the views that see it agree within `AGREE`, and its colour differs from the flat material by at least `DEV` (so soft painted shading stays out and eyes and trim come back).
457
+
458
+ **Result.** On the carved knight, 58% of texels were trusted. Colour error: 22.5 for the full stitched texture, 30.6 flat, 24.6 with the overlay.
459
+
460
+ - **The eyes, belt and gold trim come back** over a cleaner cape.
461
+ - **The torn areas look the same as before.** They sit exactly where the overlay trusts the sprites least, so they fall back to flat patches of the wrong material.
462
+ - **The flat row shows why.** With the detail gone, the carved knight is a lump: arms fused to the torso, legs fused together, horns reduced to stubs. Eight silhouettes cannot carve the gap between an arm and the body. No way of laying colour on that shape gives a clean arm.
463
+
464
+ **Verdict.** Drop. The tearing is in the shape, not the shading. This sent the work back to the mesh, in step 19.
465
+
466
+ ## 19. The generated mesh for the knight
467
+
468
+ **Question.** Step 11 found the carved shape better than the Hunyuan3D mesh for bulky subjects. Is that still true for a character with horns, a cape and limbs?
469
+
470
+ **Setup.** The knight's south, west, north and east sprites through the Hunyuan3D-2mv graph from step 8 (147 seconds), then the same staged texturing, fitted into the carve's camera.
471
+
472
+ **Result.** The drawn sprite, then the model from the front, a drawn diagonal and three in-between directions. Row 1: carved shape. Row 2: generated mesh. Row 3: generated mesh, flat. Row 4: generated mesh with step 18's overlay.
473
+
474
+ ![The knight on the carved shape and on the generated mesh, with full, flat and overlaid textures](../website/public/research/3d/mesh-source-overlay.png)
475
+
476
+ - **The generated mesh has what carving cannot give:** curved horns, arms away from the body, two legs, a cape that hangs behind.
477
+ - **The same texturing reads far better on it,** though it scores lower on shape (82% against 87%), because the model's proportions are its own.
478
+ - **On the bare character there is no gain.** Shape 86.8% against 90.5%, colour error 36.3 against 34.5, and more stray dark specks. A simple body carves well.
479
+ - **The rig script needed one fix for it.** Horns that reach past the carved hull were following the arm bones; everything above the ears is now bound to the head.
480
+
481
+ **Verdict.** Keep, for anything with parts that stand away from the body. The carved shape stays the better choice for simple, solid subjects, and its camera is still what fits the mesh to the sprites.
482
+
483
+ ## 20. The paint stage, once for each sprite
484
+
485
+ **Question.** Step 17's model paints a faithful, well-fitted front and a wrong everything else. There are eight sprites. Can each one be the front?
486
+
487
+ **Setup.** [`scripts/hunyuan3d_paint_turn.py`](../research/scripts/hunyuan3d_paint_turn.py). For each of the eight directions the mesh is turned to face the camera, that direction's sprite is the reference, the model paints its six views, and only the first is kept. Asked for one view alone the model returns grey noise; it was trained to paint six together. The eight kept views are then baked onto the unturned mesh with the node's own baking, each from the angle it was painted at, and the gaps are filled. About six minutes for a character.
488
+
489
+ **Result.** Top row: the eight sprites. Middle: the mesh turned to face each. Bottom: what the model painted.
490
+
491
+ ![Eight sprites, the mesh turned to each, and the eight painted views](../website/public/research/3d/paint-turn-views.png)
492
+
493
+ Every painted view is its sprite, redrawn to sit exactly on the mesh: the cape is on the back, the emblem is on the chest, the arms are where the mesh's arms are. This is the image-model redraw of step 13 with one thing added, which is that the model is told the shape.
494
+
495
+ The baked result against the stitched texture of step 10, on the same meshes, drawn large from the front, an in-between angle, a diagonal, the side, an in-between angle and the back. Top of each pair: stitched. Bottom: painted.
496
+
497
+ ![Stitched and painted textures on the knight and the bare character from six angles](../website/public/research/3d/paint-vs-stitched.png)
498
+
499
+ - **The tearing is gone.** Armour, belt, face and limbs are continuous from every angle, including the ones no sprite was drawn from.
500
+ - **The scores do not show it.** At sprite size, against the drawn sprites, the painted knight scores a colour error of 37.8 where the stitched one scores 31.1. The painted texture is a redraw, not a copy, and a render of it shrunk to 80 pixels picks up noise the stitched texture, made at that size, does not. The measure rewards copying pixels; step 13 met the same limit.
501
+ - **It is no longer pixel art on the surface.** The views are 512 pixels with soft-edged blocks. The texture is 1024 pixels, shrunk to 512 in the rigged files.
502
+ - **Light rims on the cape's edges,** where the grey ground of a painted view was baked onto the silhouette.
503
+ - **Seams where two views meet,** most visible on the bare character's arms and head, as blocks that do not line up.
504
+ - **Both characters were rigged again from the painted meshes** and pass the glTF validator: 23,565 vertices and 2.0 MB for the knight, 21,327 vertices and 1.9 MB for the bare character. These are the files in the viewer on the [3D characters page](https://pixelkiln.griffen.codes/3d#mesh).
505
+ - **Licence.** The paint model is published with the shape model, under the same Tencent licence and regional exclusion. The source files of its renderer name a non-commercial licence in their headers. Which terms apply to textures made with it was not settled here: treat these as a research result, and read the licence before shipping one in a game.
506
+
507
+ **Verdict.** Keep. A generated mesh, fitted to the sprites' camera, painted once per sprite and rigged is the best route found so far from eight sprites to an animated 3D character.
508
+
509
+ ## 21. An A-pose, drawn by the generator
510
+
511
+ **Question.** Every mesh so far was made from a character standing with its arms at its sides, so the arms fuse to the body or sit against it, and the rig has to guess where one ends and the other begins. 3D characters are modelled with the arms held out for this reason. Can the generator redraw ours that way?
512
+
513
+ **Setup.** PixelLab's `create_character_state` on each character, with the edit "standing in an A-pose: both arms straight and held out to the sides, 45 degrees away from the body, hands open and well clear of the hips, legs straight and slightly apart with a clear gap between them", and the palette locked to the source. The knight is a composite of paperdoll layers, not a PixelLab character, so its eight sprites were first imported as one with `create_character` (a reference image plus seven direction images; nothing is generated). Cost: 10 generations for each state, 0.25 for the import.
514
+
515
+ **Result.** Each pair is the character as it was and its A-pose.
516
+
517
+ ![The knight and the bare character, standing and in an A-pose, in eight directions](../website/public/research/3d/apose-sprites.png)
518
+
519
+ - **The character survives.** Helmet, horns, fur, cape, emblem and palette are the same; only the pose moved.
520
+ - **The eight views do not agree on the pose.** The knight's back view came out as a T-pose, arms level, while the other seven have them at 45 degrees. Triangulating the joints shows it: about 1.8 pixels of mean error on both characters, against 1.3 to 1.4 standing, and 4.5 at the wrists.
521
+ - **The generated mesh tolerates it.** Carving needs the views to agree; the mesh model reads four views as hints, and built one consistent pose from them.
522
+
523
+ **Verdict.** Keep. It is cheap, and steps 22 and 24 depend on it.
524
+
525
+ ## 22. Smooth pictures for the mesh model
526
+
527
+ **Question.** The first A-pose mesh of the bare character came out as a figure made of boxes, with a cube for a head. Why?
528
+
529
+ **Setup.** Since step 8 the four input pictures have been the 64 pixel sprites enlarged with hard edges, so every sprite pixel is a square eight pixels wide. Here they are enlarged with bicubic filtering instead, and the outline is cut through a blurred copy of the transparency so the stair steps round off. Nothing else changes. The fit in [`scripts/texture.py`](../research/scripts/texture.py) also gained `TURNS=0`: a bare, symmetric figure has the same outline from the front and the back, and the fit put this one in backwards until it was told the mesh already faces the way the south sprite does.
530
+
531
+ **Result.** Each pair is the mesh from hard-edged inputs, then from smooth ones. Top pair: the bare character. Bottom pair: the knight.
532
+
533
+ ![Meshes from hard-edged and from smoothed inputs, for both characters](../website/public/research/3d/mesh-hard-vs-smooth.png)
534
+
535
+ - **The model took the squares literally.** Given blocks, it built a block figure, 0.56 units deep where the smooth one is 0.61, with flat panels for a chest. Given a smooth picture it sculpts a head with a brow, ears, a chest, hands with fingers.
536
+ - **The knight changes less,** because its hard-edged mesh was already recognisable, but the cape gains folds and the limbs round off.
537
+ - **This was true all along.** The bare character's mesh in steps 8 and 19 was the block figure; step 19's finding that the generated mesh was "no gain" for it was measured on that.
538
+
539
+ **Verdict.** Keep. One resize, and the largest gain in shape since step 8.
540
+
541
+ ## 23. Baking the painted views here, with side views
542
+
543
+ **Question.** Step 20 left three faults in the texture: light rims on the cape, seams where two views meet, and only eight views to cover the whole surface. Baking was done inside the paint node, which offers no control over any of them.
544
+
545
+ **Setup.** [`scripts/bake.py`](../research/scripts/bake.py) does the bake on this machine in seconds. It finds where the mesh sits in each painted view from the node's own render of it (the two agree on 99% of pixels), then gives each texel a blend of the views that see it, weighted by how squarely the surface faces each view. Four things were tried on top:
546
+
547
+ - **Side views.** The paint model always paints six views at once, and step 20 threw five away. With `SPREAD=22` in [`scripts/hunyuan3d_paint_turn.py`](../research/scripts/hunyuan3d_paint_turn.py) two of the six cameras sit 22 degrees to either side of the sprite's own, and those are kept too: 24 views from the same eight passes, at no extra time.
548
+ - **Colour correction.** Each painted view is moved back to its sprite's mean and spread per channel, because the model redraws the sprite a little lighter and warmer than it is.
549
+ - **Rims.** Give a view no weight within a few pixels of its outline or of a jump in depth.
550
+ - **Colour matching.** Shift each view's colour so views agree where they overlap.
551
+
552
+ **Result.** The knight from the front, a diagonal, the side and the back. Top: eight views, colour corrected. Middle: 24 views. Bottom: eight views with the rim rule.
553
+
554
+ ![The knight baked from eight views, from 24 views, and with the rim rule](../website/public/research/3d/bake-settings.png)
555
+
556
+ - **Side views smooth the joins.** With 24 views no two neighbours are more than 23 degrees apart, and the cape and collar lose the blocks that did not line up.
557
+ - **The rim rule made it worse.** It pushes good views out near every edge and what replaces them is a view from the side, which has only its dark outline to offer there: speckles on the legs and helmet. The light rims of step 20 are gone without it. They came from the node's bake, not from the views.
558
+ - **Colour matching made it worse too.** The sprites are lit from the front, so back views are darker on purpose. Matching them moved colours by up to 34 levels, and the bare character's colour error went from 36.5 to 38.5.
559
+ - **Colour correction is a small gain:** colour error 37.4 to 36.5 on the bare character.
560
+
561
+ The result against step 20's, each pair the old model then the new, from the front, a diagonal, the side and the back:
562
+
563
+ ![Step 20's painted models and the new ones, for both characters](../website/public/research/3d/apose-painted.png)
564
+
565
+ **Verdict.** Keep the local bake, the side views and the colour correction. Rims and matching are still in the script, off.
566
+
567
+ ## 24. Skin weights measured through the mesh
568
+
569
+ **Question.** Step 16 bound each vertex to the nearest bones in a straight line, with a penalty when the line left the carved shape. The cape, which hangs beside the legs, followed the legs. And the rest pose is now an A-pose, so a walk that only swings the arms walks with them held out.
570
+
571
+ **Setup.** Three changes to [`scripts/rig.py`](../research/scripts/rig.py), used when it is given `-` in place of the carved voxels:
572
+
573
+ - **The mesh is filled in** on a grid of half sprite pixels, and distance from a vertex to a bone is the shortest path through the inside of the body. A cape is a long way from a leg by that measure: up to the collar and back down.
574
+ - **Elbows, wrists, knees and ankles move to the middle of the mesh's own limbs.** The joints were found on the sprites and the mesh is a redraw of them.
575
+ - **The walk lowers the arms first,** turning each upper arm from where it rests to hanging 12 degrees out from straight down, and swings them from there.
576
+
577
+ **Result.** Top row: which bone owns each part, by straight-line distance. Second row: through the mesh. Below: the walk from the front, three-quarters and the side.
578
+
579
+ ![Skin weights by straight line and through the mesh, and the knight's walk](../website/public/research/3d/rig-through-the-mesh.png)
580
+
581
+ - **The cape is one piece now,** owned by the spine at the top and the hips below, where the straight-line weights cut it into strips that followed each leg bone.
582
+ - **It is also rigid.** A leg swinging back passes through it. It wants bones of its own.
583
+ - **Both files pass the glTF validator** with no errors or warnings: 1.8 MB for the knight, 1.7 MB for the bare character.
584
+
585
+ **Verdict.** Keep.
586
+
587
+ ## 25. The pixel look, in the renderer
588
+
589
+ **Question.** The painted texture is a 512 pixel painting. Drawn small it should still read as pixel art, in the sprites' colours. Does that belong in the texture or in the renderer?
590
+
591
+ **Setup.**
592
+
593
+ - *In the file.* `PALETTE=<dir>:<name>` in `rig.py` stores 24 of the sprites' colours on the material, as glTF extras. The colours are picked by spreading them across everything the sprites use. Pillow's median cut was tried first and gave the knight eight near-blacks and no gold.
594
+ - *In the viewer.* The pixel look draws the scene into a small picture, then onto the screen with each pixel moved to the nearest stored colour and a dark line drawn inside the outline.
595
+ - *In the score.* [`scripts/render.py`](../research/scripts/render.py) gained `SAMPLE=mean`: each sprite-size pixel is the average of the surface under it, then snapped to the palette, which is what a renderer that filters its texture shows. Before, it took the commonest single colour, which is noise on a detailed texture.
596
+
597
+ **Result.** The bare character at sprite size. Row 1: the drawn sprites. Row 2: the stitched texture of step 10. Rows 3 and 4: the painted texture from the drawn directions and from the eight between.
598
+
599
+ ![The bare character at sprite size: sprites, stitched texture, painted texture](../website/public/research/3d/sprite-size-hero.png)
600
+
601
+ The knight: sprites, the painted model from the same directions, and from the eight between.
602
+
603
+ ![The knight at sprite size: sprites and the painted model](../website/public/research/3d/sprite-size-knight.png)
604
+
605
+ | | Stitched | Painted, commonest colour | Painted, averaged and snapped |
606
+ |---|---|---|---|
607
+ | Bare character, colour error | 30.0 | 36.7 | 35.1 |
608
+ | Knight, colour error | 30.7 | 37.3 | 36.7 |
609
+
610
+ - **The painted renders are shaded like sprites,** with a face and a lit side, in directions nobody drew. The stitched ones are flat.
611
+ - **The score still says the opposite.** It compares pixel against pixel, and the mesh's arms are not where the sprite's arms are (the outlines agree 83% and 78%), so a clean shaded arm one pixel over scores worse than a flat smear in the right place.
612
+ - **Snapping the texture itself was not pursued.** The texture's islands lie at every angle on the surface, so texture pixels cannot line up with screen pixels. The renderer is the place for it.
613
+
614
+ **Verdict.** Keep the palette in the file and the snap in the renderer. The score needs replacing before it can steer anything.
615
+
616
+ ## 26. A body made to be dressed
617
+
618
+ **Question.** Steps 19 to 25 meshed the knight with its armour on, as one piece. A game that swaps gear needs the reverse: one bare body, and each item a mesh of its own that any body can wear. That starts with a body. The bare character used so far also read as an infant once meshed: short, round and unclothed.
619
+
620
+ **Setup.**
621
+
622
+ - *The body.* PixelLab's v3 character at 64 pixels, through a PixelKiln manifest, with the base prompt from the [paperdoll guide](./PAPERDOLL.md) plus the pose: "bald adult human figure with adult proportions, slim and lean with a small head, broad shoulders and long legs ... standing straight in an A-pose with both arms held straight and out to the sides at 45 degrees". 2 generations.
623
+ - *The items.* Five PixelKiln `layer` assets over the body's eight directions: underwear, leg armour, a cuirass, a horned helm and a cape. Each is one masked inpaint that returns only the pixels it added. 10 generations each. The helm's first job failed at PixelLab and passed on a retry.
624
+ - *The joints.* `pixelkiln anchors`, 0.8 generations for the eight views.
625
+
626
+ **Result.** Row 1 is the body, rows 2 to 5 the layers for underwear, leg armour, cuirass and cape, and row 6 the body wearing the first three.
627
+
628
+ ![The bare body in eight directions, four item layers, and the body dressed](../website/public/research/3d/parts-layers.png)
629
+
630
+ - **The arms came out level in all eight views,** a T-pose and not the 45 degrees asked for. The views agree with each other, which step 21 could not get from an edit.
631
+ - **The layers are clean.** Nothing but the item in each, in every direction.
632
+
633
+ The body in underwear, meshed from smoothed inputs (step 22) and textured by stitching (step 10):
634
+
635
+ ![The body mesh from five directions](../website/public/research/3d/parts-body.png)
636
+
637
+ - **It no longer reads as an infant,** but it is stockier than the sprite. The sprite is about four heads tall, as pixel characters are so that a face fits in a dozen pixels, and the mesh model fills that build out. The outline matches the sprites 82.1%.
638
+
639
+ **Verdict.** Keep the body. An adult's seven or eight heads would need a sprite too tall to be a game sprite, so the build is the style's, not a fault to fix here.
640
+
641
+ ## 27. An item as its own mesh: alone, or cut from the body wearing it
642
+
643
+ **Question.** What is the best way to get a mesh of one item that fits the body?
644
+
645
+ **Setup.** Two routes, on the same four items.
646
+
647
+ - *Alone.* The item's layer, with no body, enlarged to fill the picture ([`scripts/smooth_inputs.py`](../research/scripts/smooth_inputs.py) with `FILL=1`), meshed by Hunyuan3D-2mv.
648
+ - *Cut from the worn mesh.* The body wearing that one item is meshed. A second set of sprites with the same outline is painted green where the item's layer has a pixel and magenta elsewhere. Texturing the mesh from those says which triangles are the item, and [`scripts/cut_item.py`](../research/scripts/cut_item.py) keeps them.
649
+
650
+ Every mesh is fitted in the body's camera frame, so each lands where it is worn. `texture.py` now starts a fit at the point in space where the item's sprites are, since a helm is nowhere near the middle of the frame.
651
+
652
+ The cut for the helm: the worn mesh, the same mesh textured from the mask sprites, and what is kept.
653
+
654
+ ![The body wearing the helm, the same mesh in green and magenta, and the helm alone](../website/public/research/3d/parts-cut-helm.png)
655
+
656
+ **Result.** Left: each item meshed alone. Right: each cut from the worn mesh. Rows are helm, cuirass, leg armour, cape.
657
+
658
+ ![Four items meshed alone, and the same four cut from the body wearing them](../website/public/research/3d/parts-alone-vs-cut.png)
659
+
660
+ | Item | Outline match, alone | Outline match, worn | Triangles kept by the cut |
661
+ |---|---|---|---|
662
+ | Helm | 71.2% | 74.9% | 8,992 of 29,999 |
663
+ | Cuirass | 76.5% | 81.4% | 10,811 |
664
+ | Leg armour | 62.5% | 82.3% | 11,830 |
665
+ | Cape | 61.7% | 84.3% | 15,427 |
666
+
667
+ The two outline columns are not like for like: alone, the mesh is compared with the item's layer, and worn, the whole dressed figure with its sprites.
668
+
669
+ - **Alone, the model does not know what it is looking at.** The leg armour became two flat boards and the cape three separate slabs. The helm became a box with horns, and the cuirass a solid torso.
670
+ - **Worn, the body tells it.** The leg armour wraps two legs, the cape hangs as one sheet from a collar, and the helm is round.
671
+ - **The cut is ragged at the edges** and leaves a fringe of skin-coloured triangles where an outline pixel was shared. Each cut also leaves 25 to 40 loose pieces, most of them crumbs.
672
+ - **A cut item is a shell.** It has no inside, which is what a game wants from clothing.
673
+
674
+ **Verdict.** Cut from the worn mesh. It costs one mesh per item either way, about two minutes each.
675
+
676
+ ## 28. A character assembled from parts
677
+
678
+ **Question.** Do a body and items made separately go together, and move together?
679
+
680
+ **Setup.** [`scripts/rig.py`](../research/scripts/rig.py) gained `ITEMS`: a list of item meshes to put on the body's skeleton.
681
+
682
+ - *Fit.* An item is drawn one pixel outside the body and meshed from a different run, so parts of it land inside the body's mesh: the first helm showed the face through its front. Each item vertex closer than 0.6 sprite pixels to the skin is moved out along the body's surface direction until it is that far above it. Triangles buried deep in the body that face inward are dropped.
683
+ - *Weights.* An item vertex takes the bone distances of the nearest point inside the body (step 24), so tight armour moves as the skin under it does. A slot can name the bones it may follow: the helm follows the head only, the cape the hips and spine only.
684
+ - *File.* One .glb with five meshes on one skeleton and one walk. The viewer shows a switch per mesh.
685
+
686
+ **Result.**
687
+
688
+ ![The body wearing all four items, from five directions](../website/public/research/3d/parts-assembled.png)
689
+
690
+ - **It reads as the knight,** from parts that were never meshed together. Nothing pokes through in the rest pose.
691
+ - **Items come off one at a time** in the viewer on the [3D characters page](https://pixelkiln.griffen.codes/3d#mesh), and the body under them is whole.
692
+ - **The file is 3.6 MB:** five meshes of up to 30,000 triangles and five 256 pixel textures. It passes the glTF validator with no errors or warnings.
693
+ - **The textures are the stitched ones of step 10,** noisy on the armour. Step 29 paints them.
694
+
695
+ Not checked: whether skin shows through armour at the extremes of the walk, an item on a second body, two items in the same slot, and any engine other than three.js.
696
+
697
+ **Verdict.** Keep. This is the shape a game can use: a body, a rack of items, one skeleton.
698
+
699
+ ## 29. Painting the parts
700
+
701
+ **Question.** Step 28's textures are stitched from the sprites and noisy. Does the paint stage of steps 20 and 23 work on parts?
702
+
703
+ **Setup.** The body and each of the four worn meshes went through `hunyuan3d_paint_turn.py` with `SPREAD=22` and `bake.py` at 1024 pixels, exactly as in step 23, each with its own sprites as references. The item is cut out afterwards with the same mask as before: painting changes the texture and not the triangles, so `cut_item.py` takes the painted mesh and the mask mesh from step 27 unchanged. About 40 seconds a direction, five to six minutes a mesh.
704
+
705
+ **Result.** The body, stitched and then painted:
706
+
707
+ ![The body with a stitched texture and with a painted one](../website/public/research/3d/parts-body-painted.png)
708
+
709
+ The assembled character, stitched and then painted:
710
+
711
+ ![The assembled knight with stitched textures and with painted ones](../website/public/research/3d/parts-painted.png)
712
+
713
+ - **The speckle is gone.** The armour has plates and trim, the cape has folds, the helm is one metal, and the body's black outline flecks are gone.
714
+ - **Colours drift.** The helm and underwear turn blue-grey, and the gold is duller with the chest crest fainter. Step 23's colour correction is on and does not hold them. The viewer's palette snap pulls them part of the way back.
715
+ - **Painting the worn mesh paints the item in context,** so the cuirass is shaded as something on a chest. The price is that each item's texture is 1024 pixels of which the item uses a third.
716
+ - **Orange flecks appear on the leg armour during the walk** in the viewer with the pixel look on. They were first taken for skin showing through. Step 30 shows they are not.
717
+ - **The file grew to 5.6 MB** with five 512 pixel textures. It passes the glTF validator with no errors or warnings.
718
+
719
+ **Verdict.** Keep the painted parts.
720
+
721
+ ## 30. Hiding the skin under an item
722
+
723
+ **Question.** Games hide the body under clothing so that skin cannot show through it in motion. Can the file say which skin each item hides?
724
+
725
+ **Setup.** `rig.py` now writes the body as one mesh per set of items that cover it.
726
+
727
+ - *Covered.* A body vertex is covered by an item when the item's surface is within 1.2 sprite pixels of it (`COVER`). A triangle is hidden by the item only when its corners and all their neighbours are covered, which leaves a rim of skin under the item's edge.
728
+ - *Loose items.* A third field in an item's entry, `loose`, marks one that hides nothing. The cape is loose: it swings away from the back it hangs behind.
729
+ - *In the file.* Each body piece is a node whose extras carry `"hiddenBy": ["Cuirass"]`. A piece is hidden while any item in its list is worn. The pieces share one material and texture.
730
+
731
+ **Result.** The body came out as six pieces:
732
+
733
+ | Piece | Triangles |
734
+ |---|---|
735
+ | Never hidden (face, neck, hands, edges) | 6,359 |
736
+ | Under the leg armour | 9,222 |
737
+ | Under the cuirass | 8,988 |
738
+ | Under both | 1,602 |
739
+ | Under the helm | 3,714 |
740
+ | Under the cuirass and the helm | 115 |
741
+
742
+ - **It works in the viewer.** With everything worn, 79% of the body is not drawn. Taking the cuirass and helm off brings the chest and head back.
743
+ - **The orange flecks of step 29 were still there,** which showed they were never skin. With the pixel look off there were none. The paint stage had dulled the gold trim, and the viewer's palette snap moved the dulled gold to the nearest stored colour, which was a skin tone.
744
+ - **Baking each item in its own colours fixes that.** `bake.py` already had `PALETTE`; each worn mesh is baked snapped to the 32 colours of that item's own layer, so the item carries no colour its sprite lacks. Top row: before. Bottom row: after. The helm is steel again and not blue.
745
+
746
+ ![The assembled knight before and after baking each item in its own sprite colours](../website/public/research/3d/parts-own-colours.png)
747
+
748
+ - **The gold is darker than the sprite's** after the snap, closer to olive on the arms. The paint stage's drift is reduced, not undone.
749
+ - **The file is 5.4 MB.**
750
+
751
+ Not checked: whether the rim of skin kept under an item's edge is enough when a limb bends far, and whether an engine reads the extras (three.js does; Godot and Unity each have their own way).
752
+
753
+ **Verdict.** Keep both. A wrong guess about the flecks cost a step, and the test that settled it was turning the pixel look off.
754
+
755
+ ## 31. Sprite cards on the skeleton
756
+
757
+ **Question.** Steps 26 to 30 show a painted mesh, and every flaw in the paint is on screen. The Cor Mundi Studios short (see [what other people are doing](#what-other-people-are-doing)) shows the sprites themselves, as a flat card per body part moved by a rig, with a mesh underneath that is never seen. Do the pieces made so far add up to that?
758
+
759
+ **Setup.** No new art and no generations.
760
+
761
+ - *Cutting.* [`scripts/cards.py`](../research/scripts/cards.py) draws the body mesh into each of the eight sprite views, coloured by the bone that owns each point (`rig.py` writes that with `SKIN=<file>`). Every sprite pixel takes the bone of the mesh under it, or of the nearest pixel that has one. Each sprite and each item layer is then cut into one piece per bone, reaching two pixels into its neighbours to cover the joints. The helm goes whole on the head and the cape whole on the spine.
762
+ - *The sheet.* 259 pieces from five layers pack into one 512 by 128 picture of 45 KB, with a list of where each piece is and how far its corner is from its bone's joint.
763
+
764
+ ![The packed pieces: capes and helms whole, then bodies, limbs and armour cut by bone](../website/public/research/3d/cards-atlas.png)
765
+
766
+ - *Drawing.* In the viewer each bone carries a card turned to face the camera. The camera's direction is taken into the bone's own frame, and the card shows the piece from the drawn view that best matches it. A view is preferred when it sees the bone as end-on or as side-on as the camera now does: an arm drawn sticking out sideways and then lowered by the walk is seen side-on from the character's side, so it uses the front view's arm, turned to hang down. The plain "nearest direction" rule picked the side view's arm, which is a foreshortened stub.
767
+ - *Order.* Cards sit at their bones, so the near arm is in front of the body and the far arm behind it with no rule. Item layers sit a few millimetres nearer the camera than the body. The cape moves behind or in front with the side the camera is on.
768
+ - *Motion.* The same fifteen bones and walk as the mesh. The file that carries them is the body mesh with a 64 pixel texture, 1.3 MB, most of which a real use would drop.
769
+
770
+ **Result.** Front, side and back standing, and the side walking, in the viewer with the pixel look on:
771
+
772
+ ![The knight drawn as sprite cards, from the front, side, back, and walking](../website/public/research/3d/cards-viewer.png)
773
+
774
+ - **It is the sprite, in motion, from any angle.** The emblem, the trim and the helm's eyes are the drawn pixels, with none of the paint stage's blur or colour drift.
775
+ - **Items switch on and off** as layers, as in the 2D builder, and the walk moves all of them.
776
+ - **It worked on the first run,** which says the camera fit, the joints and the bone ownership from the earlier steps agree with each other.
777
+ - **Between the eight directions the picture is one of the eight,** turned to face the camera, so the character snaps from view to view as it turns.
778
+ - **Pieces are rotated pictures,** so a lowered arm is the raised arm's pixels on a slant, and the joints overlap or open a little as limbs swing.
779
+ - **There is no lighting.** The short lights its cards from the hidden mesh; that was not tried.
780
+
781
+ Not checked: sixteen directions (step 13 could supply them), any engine other than three.js, and poses far from the drawn one.
782
+
783
+ **Verdict.** Keep, beside the painted mesh and not instead of it. The cards are sharper today; the mesh is the only one that can be lit, seen from above, or posed freely.
784
+
785
+ ## 32. Larger references, redrawn locally
786
+
787
+ **Question.** The goal from here is the best painted surface, not pixel art. The survey says the reference picture is the first cap: the paint stage has been shown a 46 pixel figure enlarged with hard edges. Can the sprites be redrawn large, for nothing, and does the paint improve?
788
+
789
+ **Setup.**
790
+
791
+ - *Redraw.* [`scripts/redraw.py`](../research/scripts/redraw.py) cuts the figure out of each sprite, enlarges it smoothly to 1024 pixels and has SDXL redraw it on the ComfyUI already used for meshes. The checkpoint (`sd_xl_base_1.0`) and a tile control model (`controlnet-union-sdxl-promax`) were already on the machine, so nothing was downloaded and no generations were spent. About 25 seconds a direction.
792
+ - *Settings.* A tile control held at 0.8 for every step, with the model allowed to change half the picture, returned the blurry enlargement unchanged. Letting the model change 90% while the control applies at 0.6 for the first half of the steps gives a redraw that keeps the layout. Left to right: the sprite, a cautious setting, the setting kept, and an anime checkpoint that flattened it.
793
+
794
+ ![The sprite and three redraws of it](../website/public/research/3d/hd-redraw-settings.png)
795
+
796
+ - *Paint.* The body wearing the cuirass, the same mesh as step 29, painted from the eight redraws and baked at 2048 pixels. Once with 512 pixel views as before, once with 768.
797
+
798
+ **Result.** The eight redraws:
799
+
800
+ ![Eight redrawn directions of the body wearing the cuirass](../website/public/research/3d/hd-redraws.png)
801
+
802
+ The mesh painted from the sprites (step 29), from the redraws at 512 pixel views, and from the redraws at 768:
803
+
804
+ ![The same mesh painted from sprites, from redraws, and from redraws with larger views](../website/public/research/3d/hd-painted.png)
805
+
806
+ - **The paint now has things in it:** plate edges, a collar, a crest with a shape, a face with brows and ears. Before, it was the sprite's pixels enlarged.
807
+ - **768 pixel views fit in 12 GB** and are a little sharper, at about 110 seconds a direction against 40.
808
+ - **The redraws do not agree with each other.** Each direction is redrawn alone, so the crest, the shoulder plates and the face differ from view to view, and the bake averages them. The back view came back still pixelated.
809
+ - **Colours move.** The black armour became grey steel and the skin paler. Nothing ties a redraw to the sprite's palette.
810
+ - **The mesh is now the limit you see.** Flat facets show on the head and limbs under a detailed texture.
811
+
812
+ Not done: the other items, the bare body, and the assembled model in the viewer, which still carries step 30's textures.
813
+
814
+ **Verdict.** Keep. The largest gain in texture quality so far, for no cost but GPU time. The next gains are in making the eight redraws agree and in a smoother mesh.
815
+
816
+ ## 33. Making the redraws agree
817
+
818
+ **Question.** Step 32's eight redraws each invent their own details and their own colours. Two fixes were tried.
819
+
820
+ **Setup.** Both are options of [`scripts/redraw.py`](../research/scripts/redraw.py).
821
+
822
+ - *One sheet* (`SHEET=1`). All eight figures are put on one 2048 by 1024 picture and redrawn together, so the model sees one character from eight angles. Each figure is then enlarged and sharpened alone, with the model allowed to change 35%.
823
+ - *Colours held* (`COLOUR=1`, now the default). The redraw's broad colour is swapped for the sprite's, region by region: a blurred copy of the redraw is taken out and a blurred copy of the enlarged sprite put in, leaving only the redraw's detail. The blur is a fortieth of the picture wide.
824
+
825
+ **Result.** The same mesh painted from: step 32's redraws; redraws made alone with colours held; one-sheet redraws with colours held.
826
+
827
+ ![The mesh painted from three sets of redraws](../website/public/research/3d/hd-painted-agree.png)
828
+
829
+ - **Holding the colours is the fix.** The armour is black again and the skin is the sprite's, with the plates, crest and face of step 32 intact. Because every view now shares the sprite's colours, the views also disagree less where they meet.
830
+ - **The sheet agrees and loses the rest.** At a quarter of the pixels a figure, the model drew a soft suit with gold swirls in place of plates, and a child's face. The sharpening pass cannot put back a design that was never drawn.
831
+
832
+ **Verdict.** Keep the colour hold, drop the sheet. Details still differ between directions; the bake blends them.
833
+
834
+ ## 34. A mesh from redrawn pictures
835
+
836
+ **Question.** The mesh model has been shown the sprites, enlarged smoothly (step 22). Its meshes have a faceted skull and lumpy limbs. Is that the model, or the pictures it is given?
837
+
838
+ **Setup.** The bare body's front, left, back and right sprites were redrawn at 1024 pixels as in step 32, with `OUTLINE=own`. By default a redraw is cut with the sprite's own enlarged outline, which keeps its stair steps: a head drawn in a dozen pixels has corners. `OUTLINE=own` keeps the outline the model drew, taking as ground whatever is near the ground colour and joined to the picture's border. The four redraws went to Hunyuan3D-2mv with nothing else changed.
839
+
840
+ Top: what the mesh model was given before. Bottom: the redraws.
841
+
842
+ ![The four smoothed sprites, and the four redraws, given to the mesh model](../website/public/research/3d/hd-mesh-inputs.png)
843
+
844
+ **Result.** Top: the mesh of step 26. Bottom: the mesh from the redraws.
845
+
846
+ ![The body mesh from smoothed sprites and from redrawn pictures](../website/public/research/3d/hd-mesh.png)
847
+
848
+ - **It was the pictures.** The new mesh has a round skull, a brow, nose and ears, a chest, shoulder blades, arms that taper, calves. The old one is a figure of flat panels.
849
+ - **The redraw's outline matters as much as its inside.** The model builds what the outline shows, and the sprite's outline is a staircase.
850
+ - **The back view's outline is still partly stepped,** where the redraw kept the sprite's edge.
851
+
852
+ Not done: fitting this mesh to the sprites, painting it, the worn meshes, or anything in the viewer. The redraws are no longer pixel for pixel on the sprites, so the fit of step 9 and the item cut of step 27 need checking against them.
853
+
854
+ **Verdict.** Keep. Next is to rebuild the body and items from redrawn pictures end to end.
855
+
856
+ ## 35. Everything rebuilt from redrawn pictures
857
+
858
+ **Question.** Steps 32 to 34 each improved one piece. Does the whole chain of steps 26 to 30 still hold when it starts from redrawn pictures?
859
+
860
+ **Setup.** One script ran, for the bare body and for the body wearing each of the four items:
861
+
862
+ 1. `redraw.py` on all eight directions, with the model's own outline and a white ground (`OUTLINE=own GROUND=255`). 25 to 45 seconds a direction.
863
+ 2. Hunyuan3D-2mv on the front, left, back and right redraws. About two minutes a mesh.
864
+ 3. `texture.py` to fit each mesh into the body's camera, against the sprites as before.
865
+ 4. The paint stage from the eight redraws with 768 pixel views, and `bake.py` at 2048 pixels. About 15 minutes a mesh.
866
+ 5. `cut_item.py` with the mask sprites of step 27, then `rig.py` as in step 30.
867
+
868
+ About two hours of GPU time, unattended, and no generations.
869
+
870
+ Two faults in our own scripts surfaced and were fixed:
871
+
872
+ - **The cut was throwing away good triangles.** It drops loose crumbs by counting connected triangles, but the unwrap splits vertices along its seams, so every patch of the unwrap counted as a separate piece and small patches were dropped as crumbs. It now joins vertices that are in the same place first. The four items went from 25 to 60 "pieces" each to 1 to 3. Steps 27 to 30 had this fault too; their holes were blamed on a ragged cut.
873
+ - **`rig.py` gained `ALIGN`,** which slides an item until it is evenly spaced round the body. Here it moved items less than half a sprite pixel, so the separate fits already agree; it is kept as a safeguard.
874
+
875
+ **Result.** The bare body, before and after:
876
+
877
+ ![The body of step 29 and the body rebuilt from redrawn pictures](../website/public/research/3d/rebuilt-body.png)
878
+
879
+ The cape, leg armour and helm, cut from their rebuilt worn meshes:
880
+
881
+ ![The rebuilt cape, leg armour and helm on their own](../website/public/research/3d/rebuilt-items.png)
882
+
883
+ The assembled character with hidden skin left out, step 30 above and the rebuild below:
884
+
885
+ ![The assembled knight of step 30 and the rebuild](../website/public/research/3d/rebuilt-assembled.png)
886
+
887
+ - **The body is sculpted and painted,** with a face, ears, muscle and a round skull. Dark smears run along the tops of the arms, where the redraws' outlines were baked in.
888
+ - **The helm and leg armour are the best pieces so far:** plates, rivets, trim and a visor, on smooth shapes.
889
+ - **One sleeve of the cuirass ends at mid forearm,** and there is bare skin at one hip between the cuirass and the leg armour. The item masks are still the sprites' layers, and a redrawn figure is not pixel for pixel where the sprite was, so the mask lands a pixel or two off on the new mesh.
890
+ - **The fur collar is teal.** This was first put down to the colour hold of step 33 not reaching outside the sprite. Step 36 shows the redraw is grey and the bake is what turns it teal.
891
+ - **The cuts carry scraps of skin** at the hands and neck, for the same reason as the short sleeve.
892
+ - **The file is 6.0 MB** with 512 pixel textures (10.8 MB at 1024), and passes the glTF validator with no errors or warnings.
893
+
894
+ In the viewer the rebuilt model loads, walks, and its items switch off. It is shown smooth by default now, with the pixel look as a switch.
895
+
896
+ **Verdict.** Keep as the viewer's model. The next fault to fix is the masks: they should be made from the redraws, not the sprites.
897
+
898
+ ## 36. Item edges from the paint, and a colour fault in the bake
899
+
900
+ **Question.** Step 35 left three faults: skin where an item should be, scraps of skin on the items, and a teal collar. Are the masks to blame, as supposed?
901
+
902
+ **Setup.**
903
+
904
+ - *Edges.* [`scripts/cut_item.py`](../research/scripts/cut_item.py) takes the bare body's painted mesh as `BODY`. The mask from the sprites still says roughly where the item is. Within three sprite pixels of the mask's edge the paint decides: a triangle painted as skin is left out, and a triangle is taken in when it is not skin and is painted unlike the bare body at the same place. Skin is learned from the body's own texture, as a spread of colour with brightness left out. Both meshes are in the same frame, so "the same place" is the nearest point of the body.
905
+ - *Why two tests.* The first version took in anything near the edge that was not skin, and the cuirass grew a skirt of underwear. The underwear is on both meshes, so comparing against the body leaves it alone.
906
+ - *Colour.* The collar was traced from sprite to redraw to painted view to texture. It is grey in all but the last.
907
+
908
+ **Result.** The cuirass cut with the sprite mask alone, and with the edge moved:
909
+
910
+ ![The cuirass cut by the sprite mask, and with its edge moved to where the paint puts it](../website/public/research/3d/masks-cuirass.png)
911
+
912
+ The assembled character: step 35 with the new edges, the same with the bake corrected, and the bare body.
913
+
914
+ ![The assembled knight with new edges, then with the bake's colour shift off, and the bare body](../website/public/research/3d/masks-and-colour.png)
915
+
916
+ - **The scraps of hand and neck are gone,** and so is the bare patch at the hip. Each cut moved about a thousand triangles each way.
917
+ - **The teal was `bake.py`'s `TONE`,** not the redraw. `TONE` moves each painted view's colours to match its reference's average, one channel at a time. It was added in step 23, when the references were sprites, as a small gain. A painted view of the back shows more red cape than its reference does, so matching averages takes red out of everything else and grey fur goes teal. With it off the collar is grey, the helm is black and not blue, and the underwear is grey. The blue cast noted in steps 29 and 32 was the same fault. `TONE` is now off unless asked for.
918
+ - **One cuirass sleeve still ends at mid forearm.** The worn mesh's arm is thinner than the body's there, and the edge rule only reaches three pixels.
919
+
920
+ **Verdict.** Keep both. The viewer's model is rebuilt with them, 6.0 MB.
921
+
922
+ ## 37. The model in a game engine
923
+
924
+ **Question.** Every check so far has been three.js or the glTF validator. Does a game engine read the file the way it was meant?
925
+
926
+ **Setup.** The viewer's `parts.glb` of step 36 in an empty Godot 4.7.2 project, imported headless (`--headless --import`), then a script that loads the scene and lists what it finds.
927
+
928
+ **Result.**
929
+
930
+ - **It imports with no errors or warnings.**
931
+ - **One skeleton of fifteen bones,** with their names: Hips, Spine, Head, and upper, lower and end bones for each arm and leg.
932
+ - **Ten meshes, all skinned to it:** six pieces of body and four items, 79,216 triangles in all.
933
+ - **The walk arrives** as an animation named Walk, 0.9 seconds, eight tracks.
934
+ - **The hide lists survive.** Godot puts each node's glTF extras in its metadata, so `"hiddenBy": ["Cuirass"]` can be read by a script, as in step 30.
935
+
936
+ Not checked: how it looks drawn in Godot (this ran with no screen), Godot's humanoid retargeting against these bone names, Unity, and Unreal.
937
+
938
+ **Verdict.** Keep. The file is a working rigged character in one engine. What it lacks to be an asset is in the survey below: triangle count, unwrap, a standard skeleton, materials.
939
+
940
+ ## 38. A second painter: MV-Adapter
941
+
942
+ **Question.** The survey named MV-Adapter as the likeliest local step up from Hunyuan3D's paint stage. Does it run on a 12 GB card, and is it better?
943
+
944
+ **Setup.**
945
+
946
+ - *Install.* A clone of [MV-Adapter](https://github.com/huanngzh/MV-Adapter) in its own folder and Python 3.12 environment on the same machine, with PyTorch 2.6 and diffusers 0.31, and three downloads: SDXL base in half precision, a fixed VAE, and the adapter `mvadapter_ig2mv_sdxl`. Its requirements list nvdiffrast, which needs a compiler, and CV-CUDA, which is Linux only; the machine is Windows with neither. Both were left out.
947
+ - *What replaces them.* The model is guided by six pictures of where the mesh's surface is and which way it faces. [`scripts/mvadapter_paint_turn.py`](../research/scripts/mvadapter_paint_turn.py) draws those itself, with MV-Adapter's own six cameras, and [`scripts/mvadapter_remote.py`](../research/scripts/mvadapter_remote.py) runs only the model. The bake is `bake.py`, as for the other painter.
948
+ - *Run.* The body wearing the cuirass, turned to face the front, with the front redraw of step 35 as the reference. 30 steps.
949
+
950
+ **Result.** The reference, the four views round the figure that the model painted, and one of the guide pictures:
951
+
952
+ ![A reference picture, four views painted by MV-Adapter, and a guide picture](../website/public/research/3d/mvadapter-views.png)
953
+
954
+ - **It works with our guide pictures.** The painted front view sits on the mesh and follows the reference closely: plates, crest, face.
955
+ - **It does not fit.** At 768 pixels it filled all 12 GB and made no progress in 25 minutes. Its option to keep parts of the model off the GPU failed inside its own reference step. At 640 pixels it finished one pass in 689 seconds with 12.9 GB in use, more than the card has, so part of it ran from ordinary memory. Hunyuan3D's paint stage takes 110 seconds for a pass at 768.
956
+ - **The sides it invents are wrong,** as with the other painter in step 17: a black head from the side and the back, and the chest's crest repeated on the back. The one-direction-at-a-time trick would discard them, at eight passes and an hour and a half a mesh.
957
+
958
+ Not done: a bake from its views, its smaller SD2.1 variant, or a comparison against Hunyuan3D on the same finished mesh.
959
+
960
+ **Verdict.** Drop on this card. Its front view is no better than what step 35 has, and it is six times slower. The scripts stay for a machine with 16 GB or more.
961
+
962
+ ## 39. Sprites drawn larger at the source
963
+
964
+ **Question.** Steps 32 to 36 enlarge 64 pixel sprites with an image model that redraws each direction alone. The generator that drew the sprites can draw them four times larger itself. Is that a better start?
965
+
966
+ **Setup.** PixelLab's v3 character at 256 pixels, with step 26's body prompt, underwear included and a T-pose asked for: 9 generations. Then four states of that character, one for each item ("wearing a black steel plate cuirass ...", and so on), which keep the same figure and redraw all eight directions.
967
+
968
+ **Result.** The bare body, then the cuirass, leg armour, cape and helm:
969
+
970
+ ![Five sets of eight directions at 256 pixels: the body and four worn versions](../website/public/research/3d/sprites-256.png)
971
+
972
+ - **The figure is an adult,** about seven heads tall, where the 64 pixel one is four. Step 26 put the squat build down to the style; it was the size. At 64 pixels a face needs a quarter of the height.
973
+ - **The eight directions agree,** in pose and in detail, because one model drew them together. That is what step 33 could not get from redraws.
974
+ - **Each worn version is the same figure in the same pose,** so comparing it with the bare one says where the item is.
975
+ - **These are whole figures, not layers.** The items are not separate pictures as in step 26.
976
+ - **The helm's horns are short.** A state cannot have a canvas larger than 256 pixels, and the head is near the top.
977
+
978
+ Not done: meshing, painting or rigging from these.
979
+
980
+ **Verdict.** Keep. Rebuild from these next.
981
+
982
+ ## 40. Everything rebuilt from the 256 pixel sprites
983
+
984
+ **Question.** Step 39's sprites are larger, adult in build and agree across directions. Does the chain of steps 35 and 36 give a better character from them?
985
+
986
+ **Setup.** The same script as step 35, with these differences:
987
+
988
+ - *Sources.* The five 256 pixel sets of step 39. They are redrawn at 1024 pixels by `redraw.py` with its usual settings; a gentler setting that let the model change little kept the pixel edges. Left to right: the sprite, the gentle redraw, the one used.
989
+
990
+ ![A 256 pixel sprite and two redraws of it](../website/public/research/3d/redraw-256.png)
991
+
992
+ - *Fitting.* Carving and fitting ran on half-size copies, 128 pixels, to keep the carve to a few seconds. Distances given in sprite pixels were scaled to match: items sit 1.5 above the skin, skin counts as covered within 3, and an item's edge may move 7.
993
+ - *Masks.* There are no item layers here, only worn figures. A pixel is the item where the worn sprite differs from the bare one by more than 70 across red, green and blue, tidied and with specks under 150 pixels dropped. Step 36's edge rule does the rest.
994
+ - *Joints.* PixelLab's skeleton estimate on the eight bare sprites, 0.8 generations.
995
+
996
+ About two hours of GPU time, unattended.
997
+
998
+ **Result.** The assembled character with hidden skin left out, and the bare body:
999
+
1000
+ ![The rebuilt knight and the bare body from five directions](../website/public/research/3d/rebuilt-256.png)
1001
+
1002
+ The four items on their own:
1003
+
1004
+ ![The cuirass, leg armour, cape and helm cut from their worn meshes](../website/public/research/3d/rebuilt-256-items.png)
1005
+
1006
+ - **The body is an adult.** Long legs, a small head, shoulders, a face, with muscle painted and shaped. Compare step 36's.
1007
+ - **The armour reads as armour:** separate plates on the legs, a shaped helm with a visor, trim that follows edges.
1008
+ - **The fits are no worse:** the meshes match the sprites' outlines 81 to 86%.
1009
+ - **The masks needed the edge rule.** It took in 1,000 to 4,300 triangles an item, most on the cape, and left out up to 900 of skin.
1010
+ - **Dark streaks run along the tops of the arms** on the bare body, and the cape has a few pinholes.
1011
+ - **In the viewer it loads, walks and its items switch off.** Seen there with the cuirass and helm off: the head, chest and arms come back whole.
1012
+ - **In Godot 4.7.2 it imports as before:** fifteen bones, ten skinned meshes, 79,819 triangles, the walk.
1013
+ - **The file is 6.3 MB** with 512 pixel textures, 11.4 MB with 1024. It passes the glTF validator with no errors or warnings.
1014
+
1015
+ Not checked: the walk from every side, whether items clip at the extremes of the stride, the pixel look on this model.
1016
+
1017
+ **Verdict.** Keep as the viewer's model. The look is no longer the weakest part. What separates this from an asset is now in the survey: triangle count, unwrap, skeleton, materials.
1018
+
1019
+ ## 41. A light mesh with the paint and relief baked on
1020
+
1021
+ **Question.** The survey's first gap is triangle count: step 40's model is about 30,000 triangles a part, spread evenly, in an unwrap of hundreds of pieces. How much can go without the picture changing?
1022
+
1023
+ **Setup.** [`scripts/thin.py`](../research/scripts/thin.py), on the body and on each cut item of step 40.
1024
+
1025
+ - *Thin.* The mesh's split vertices are joined, then it is reduced to a target count with quadric decimation: 6,000 triangles for the body, 3,000 for the cuirass and the leg armour, 2,500 for the cape, 2,000 for the helm.
1026
+ - *Unwrap.* A fresh xatlas unwrap of the light mesh, told to grow each piece four times as readily as its default, with six pixels of padding.
1027
+ - *Bake.* Every texel of the light mesh takes the colour of the nearest point on the dense mesh that faces the same way, from three million points sampled on it. Facing the same way keeps the two sides of the cape from swapping.
1028
+ - *Relief.* The same lookup gives the dense mesh's smooth normal, stored against the light mesh's own normal and tangent as a normal map in the OpenGL convention glTF asks for. `rig.py` writes matching tangents, and now keeps the normals a part arrives with.
1029
+ - *File.* `rig.py` gained `JPEG`: textures as JPEG at a given quality. Colour is 1024 pixels for the body and 512 for items, normal maps 512, quality 90.
1030
+
1031
+ The body's colour texture and normal map after thinning:
1032
+
1033
+ ![The light body's colour texture and its normal map](../website/public/research/3d/thin-maps.png)
1034
+
1035
+ **Result.** The assembled character, dense above and light below, drawn unlit:
1036
+
1037
+ ![The dense and the light model from five directions](../website/public/research/3d/thin-dense-vs-light.png)
1038
+
1039
+ | | Dense (step 40) | Light |
1040
+ |---|---|---|
1041
+ | Triangles, body and four items | 79,819 | 16,496 |
1042
+ | Unwrap pieces, body | not counted | 157 |
1043
+ | File | 6.3 MB | 2.1 MB |
1044
+
1045
+ - **The two are hard to tell apart** in an unlit render. The fur collar is a little softer.
1046
+ - **It takes seconds:** about seven for the body.
1047
+ - **In the viewer it loads and walks,** lit with the normal map. In Godot 4.7.2 it imports with the same skeleton and walk.
1048
+ - **It passes the glTF validator** with no errors or warnings.
1049
+ - **The normal map is nearly flat,** with facet-sized speckle. The dense mesh has little relief the light one lacks, and what it has is partly the generator's noise. A real gain here needs relief from somewhere else, such as a normal map drawn from the paint.
1050
+ - **The unwrap is still many pieces,** 44 to 224 a part. It is automatic, and no artist would call it clean.
1051
+
1052
+ Not checked: the lit look beside the dense model, how the light mesh bends at elbows and knees compared with the dense one, and a hand-made or quad retopology.
1053
+
1054
+ **Verdict.** Keep. A fifth of the triangles and a third of the file for no visible cost.
1055
+
1056
+ ## 42. A standard humanoid skeleton
1057
+
1058
+ **Question.** The skeleton of step 16 has fifteen bones. Engines put stock animations on a character by matching its bones to a standard humanoid. Is ours one?
1059
+
1060
+ **Setup.** `rig.py` now builds twenty-one bones unless told `BONES=15`. The six added are the ones a standard humanoid has besides: Chest, Neck, a Shoulder for each arm and Toes for each foot. They are placed from the joints already known: the spine is split in three, the neck runs from the neck joint to under the ears, each shoulder from near the neck to the shoulder joint, and the toes from the ball of the foot forward. The names are those Unity's and Godot's humanoid profiles use. Weights come as before, measured through the mesh.
1061
+
1062
+ The check is Godot's own `SkeletonProfileHumanoid`, which lists 56 bones (fingers, eyes and jaw among them) and marks which are required. A script asks whether each is in the imported skeleton by name, and whether it hangs from the parent the profile gives.
1063
+
1064
+ **Result.**
1065
+
1066
+ - **All seventeen bones the profile requires are found,** by name, with no mapping written.
1067
+ - **Four optional ones are found too:** Chest, Neck and both Toes.
1068
+ - **Every bone found hangs from the parent the profile expects.**
1069
+ - **The walk still plays.** The thinned body on the new skeleton:
1070
+
1071
+ ![The light body walking on the twenty-one bone skeleton](../website/public/research/3d/humanoid-walk.png)
1072
+
1073
+ Not done: putting a stock animation on it. That needs an animation library to test with, which means a download, and Godot's retargeting also resets each bone's rest direction, which was not run. Fingers, eyes and jaw are not built. Unity and Unreal were not tried.
1074
+
1075
+ **Verdict.** Keep. The names and the tree are right for one engine's profile. Whether a stock animation looks right on it is the next test.
1076
+
1077
+ ## 43. Stock animations on the skeleton
1078
+
1079
+ **Question.** Step 42 says the skeleton has the right names. Does an animation made for another character look right on it?
1080
+
1081
+ **Setup.**
1082
+
1083
+ - *The library.* [Quaternius's Universal Animation Library](https://quaternius.com/packs/universalanimationlibrary.html), standard edition: 43 animations on a 65 bone humanoid named as Unreal's mannequin is (`pelvis`, `spine_01`, `upperarm_l`), as one .glb. CC0. A 15 MB download from itch.io. It is not in this repository.
1084
+ - *The problem.* The two skeletons differ in bone count, proportions and rest pose, and the library's bones carry rotations at rest where ours carry none. Keyframes cannot be copied.
1085
+ - *The method.* [`scripts/retarget.py`](../research/scripts/retarget.py) pairs our 21 bones with 21 of the library's. For each bone at each moment it takes the library bone's turn away from its rest pose, in world space, and gives it to our bone. Before that, each of our limbs is turned to point the way the library's points at rest, so the two rest poses need not agree. The hips also travel, by the library's hip movement scaled to our hip height (1.023 here). Sampled 30 times a second.
1086
+ - *The viewer* gained a picker for whatever animations a file carries.
1087
+
1088
+ **Result.** Idle, walk, jog, sword attack and death, in the viewer:
1089
+
1090
+ ![The knight in five stock animations](../website/public/research/3d/stock-animations.png)
1091
+
1092
+ - **They read as what they are.** The idle stands with arms at the sides, the walk and jog stride, the attack lunges, the death falls and lies on the ground.
1093
+ - **Eleven animations add 220 KB** to the file, which is 2.3 MB with them.
1094
+ - **The armour and cape follow** through all of them, since items are skinned to the same bones.
1095
+ - **It passes the glTF validator** with no errors or warnings.
1096
+
1097
+ Not checked: feet sliding on the ground, hands (the character has no finger bones, so a grip is a flat hand), the cape through a roll, the animations in Godot, and the other 32 in the library.
1098
+
1099
+ **Verdict.** Keep. A standard skeleton plus a retarget gives the character a library of motion for nothing.
1100
+
1101
+ ## 44. Views from above and below
1102
+
1103
+ **Question.** Since step 23 the body has had dark smears along the tops of its outstretched arms, and dark patches on shoulders and the top of the head. Why, and can the painter fix them?
1104
+
1105
+ **Setup.**
1106
+
1107
+ - *The cause.* Every camera in a paint pass is level with the character. Nothing looks down on the top of a level arm, so its texels are seen only edge-on, where a painted view shows the figure's dark outline.
1108
+ - *The fix.* Each pass paints six views and three were kept (the sprite's, and one to each side). Two of the spare cameras now look from 45 degrees above and below the sprite's direction: `TOP=45` in `hunyuan3d_paint_turn.py`, five views kept a pass, forty a mesh. The paint node takes only 20, 45 or 90 degrees; 40 fails.
1109
+ - *The bake.* `bake.py` reads each view's tilt. It tries the tilt both ways up when it places a view, as it already does for mirroring, and keeps the one that matches the node's own render.
1110
+
1111
+ A pass for the south sprite: the level view, the view from above, the view from below, and the node's render of the mesh from above.
1112
+
1113
+ ![A level painted view, one from above, one from below, and the mesh seen from above](../website/public/research/3d/top-views-painted.png)
1114
+
1115
+ **Result.** The body seen from 35 degrees above, before and after:
1116
+
1117
+ ![The body from above with level views only, and with views from above and below](../website/public/research/3d/top-views-body.png)
1118
+
1119
+ The assembled character from the same height, before and after:
1120
+
1121
+ ![The assembled knight from above, before and after](../website/public/research/3d/top-views-assembled.png)
1122
+
1123
+ - **The smears are gone** from the arms and shoulders, and the top of the head is skin.
1124
+ - **The model invents the top views plausibly:** the reference shows a front, and it paints the same figure seen from above.
1125
+ - **Time is unchanged,** about 110 seconds a direction, since the six views were being painted anyway.
1126
+ - **The viewer's model is rebuilt from these textures,** thinned and animated as in steps 41 to 43: 16,498 triangles, 2.3 MB, valid, and it imports into Godot 4.7.2 with twelve animations.
1127
+ - **Godot found a clash.** It drops a trailing `_Loop` from animation names, so the library's `Walk_Loop` collided with our own `Walk`. `retarget.py` now renames ours `First_Walk`.
1128
+
1129
+ Not checked: the rebuilt model in the browser, and undersides such as the soles and under the chin.
1130
+
1131
+ **Verdict.** Keep. `TOP=45` should be the usual setting.
1132
+
1133
+ ## 45. A cape that swings
1134
+
1135
+ **Question.** The cape has been one stiff sheet since step 24, turning with the spine. Can it hang and swing like cloth, in a file any engine can play?
1136
+
1137
+ **Setup.**
1138
+
1139
+ - *Bones.* `CHAINS="Cape=3x4"` in `rig.py` gives the item called Cape three columns of four links, named `Cape1_1` to `Cape3_4`, each column hung from the chest. The top fifth of the item, the fur collar, stays on the body. Below it each vertex follows the two links it lies between in the two columns it lies between, so the sheet bends smoothly down and across with at most four bones a vertex.
1140
+ - *Motion.* Engines swing such bones live with spring bones, each its own way, and glTF has no standard for it. [`scripts/sway.py`](../research/scripts/sway.py) does it once and stores the answer: for every animation in the file it simulates each chain as a string of points and writes the result as rotation keys for the cape bones.
1141
+ - *The simulation.* The top point is pinned to the chest. The rest fall under gravity, keep nine tenths of their speed each step, keep their distance from the point above, are pulled slightly towards where they hang at rest, and are pushed out of capsules round the legs and the trunk. Four steps a frame at thirty frames a second. A looping animation is run three times round and the last pass kept, so the end meets the start.
1142
+
1143
+ **Result.** In the viewer: idle, two frames of the sprint from the side, and the roll.
1144
+
1145
+ ![The cape hanging in an idle, streaming behind a sprint, and falling during a roll](../website/public/research/3d/cape-sway.png)
1146
+
1147
+ | Animation | How far the cape's hem swings from rest |
1148
+ |---|---|
1149
+ | Idle, sword idle, walk | 4 to 6 cm |
1150
+ | First walk | 13 cm |
1151
+ | Sprint, jog | 38 and 42 cm |
1152
+ | Roll, death | 48 and 49 cm |
1153
+ | Jump start | 71 cm |
1154
+ | Sword attack | 92 cm |
1155
+
1156
+ - **It reads as cloth.** The cape trails a sprint, settles in an idle, and hangs towards the ground through a roll.
1157
+ - **The legs no longer pass through it** in the frames looked at; the capsules hold it off them.
1158
+ - **It costs 12 bones and about 130 KB** of keys over twelve animations. The file is 2.5 MB and passes the glTF validator with no errors or warnings.
1159
+ - **Godot 4.7.2 imports it:** 33 bones, twelve animations, and the humanoid profile still finds its seventeen.
1160
+
1161
+ Not checked: the cape against the arms, which have no capsules; every frame of every animation; and how a live spring bone set-up in an engine compares. The stiffness and damping were set by eye in two tries.
1162
+
1163
+ **Verdict.** Keep. Baking the swing into the animations is the portable choice; an engine's own cloth can replace it where wanted, since the bones are there.
1164
+
1165
+ ## 46. The same items on a second body
1166
+
1167
+ **Question.** Parts are separate so that they can be reused. Every item so far has been worn only by the body it was cut on. Does one fit another body?
1168
+
1169
+ **Setup.**
1170
+
1171
+ - *The body.* PixelLab's v3 character at 256 pixels: "heavyset and broad with a barrel chest, a thick waist, wide shoulders, thick strong arms and thick legs". It came back with the arms down, which fuses them to the trunk when meshed, so a state of it was asked for in a T-pose and used. 9 generations, then 10 to 25 for the state (not read back), and 1.6 for joints, 0.8 of them wasted on the arms-down drawing.
1172
+
1173
+ ![The second body in eight directions, in a T-pose](../website/public/research/3d/second-body-sprites.png)
1174
+
1175
+ - *His mesh.* Redrawn, meshed, painted with views from above and below, thinned and rigged as in steps 40 to 44. Nothing was drawn or meshed for him but his own body.
1176
+ - *The items.* The thinned cuirass, leg armour, cape and helm of step 44, made on the first body. [`scripts/refit.py`](../research/scripts/refit.py) describes each point of an item against the first body's bones, as how far along a bone and how far out from it, and puts it the same share of the way along the second body's bone. `rig.py` then fits the item to his skin and gives it his weights, as for any item.
1177
+ - *How far out.* The second body's limbs are measured as thicker than the first's, by the typical distance of each bone's own vertices from its line: 3.0 sprite pixels at a typical bone.
1178
+
1179
+ **Result.** The first try scaled each point's distance from the bone by the ratio of the two bodies' thickness, about two here:
1180
+
1181
+ ![The items scaled by the ratio of thickness: a collar blown up, a torn cape, bent horns](../website/public/research/3d/second-body-scaled.png)
1182
+
1183
+ - **Scaling by ratio fails for anything that stands off the body.** The fur collar, already well clear of the shoulders, doubled in size. The cape tore as it was pushed back to the skin, and the helm's horns bent, pulled at by the neck and shoulder bones.
1184
+
1185
+ The second try moves each point out by the difference in thickness, so an item keeps its clearance from the skin, and describes the helm against the head alone and the cape against the trunk alone (`ONLY`). The bare body above, dressed below:
1186
+
1187
+ ![The second body bare, and wearing the first body's four items](../website/public/research/3d/second-body.png)
1188
+
1189
+ - **All four items fit.** The cuirass spans the barrel chest, the leg armour wraps the thick legs, the collar sits on the shoulders at its own size, and the helm keeps its shape.
1190
+ - **The items moved 6 to 13 sprite pixels** typically to get there, on a figure about 117 tall.
1191
+ - **It animates like the first:** the same twelve motions, the cape on its chains. In the viewer it loads, walks, and is the "Second body" model.
1192
+ - **It is one file of 2.4 MB,** 16,495 triangles, valid, and imports into Godot 4.7.2 with 33 bones.
1193
+ - **The cuirass is stretched,** not remade: its trim lines are wider apart on him, and the crest is larger.
1194
+ - **The forearm guards stop short of the wrists,** as on the first body.
1195
+
1196
+ Not checked: a body that differs in height more than build, a woman's build, a child's, and whether hidden skin is right under every item on him.
1197
+
1198
+ **Verdict.** Keep. One set of items, two bodies, for the cost of one more body. This is the claim the design rests on, and it holds for a body this different.
1199
+
1200
+ ## 47. Finger bones, and a sword in the hand
1201
+
1202
+ **Question.** The skeleton stopped at the hand, so a grip was a flat hand and nothing could be held (steps 42 and 43). Do the hands of a mesh from 256 pixel sprites carry enough to close round a handle, and can a separately made item be put in one?
1203
+
1204
+ **Setup.**
1205
+
1206
+ - *What the mesh has.* The first body's hand is a mitten: the four fingers as one slab, and a thumb standing apart. That matches what the [skeletons guide](./SKELETONS.md) measured on the sprites: a 256 pixel hand carries a wrist, knuckles, a fingertip and a thumb, and no more.
1207
+ - *Finding the bones.* `rig.py` measures each hand on the filled mesh. Going back from the fingertips the hand is one piece, then two once the thumb's tip is passed, then one again at the web between thumb and fingers. The web is taken as 58% of the hand's length back from the fingertips, which gives the wrist, the knuckles at 56% and three finger joints. The thumb's line runs from near the wrist to its tip.
1208
+ - *The bones.* Three for the thumb and three for the fingers' one chain, a hand, under the names Godot's and Unity's humanoid profiles give the thumb and the middle finger. A seventh, `LeftGrip` or `RightGrip`, carries no skin: it marks where a grip goes, just under the palm.
1209
+ - *Motion.* The animation library poses its fingers: fists in the walk and idle, a closed right hand and an open left in the sword animations (read from its file). `retarget.py` now turns a hand as a whole so that its palm faces the way the library's does, then carries the library's thumb and middle finger over.
1210
+ - *The sword.* One PixelLab object, a longsword upright in eight directions at 128 pixels, for 25 generations. Its front, left, back and right went to Hunyuan3D-2mv (six and a half minutes), the mesh was coloured from the eight sprites and thinned from 29,999 triangles to 1,499.
1211
+
1212
+ ![A longsword in eight directions](../website/public/research/3d/sword-sprites.png)
1213
+
1214
+ - *Holding it.* A new kind of item in `rig.py`, `Sword=sword.glb:RightHand:held`. The item's longest line is laid across the palm, leaving on the thumb's side. Its grip, half way between one end and the guard (the widest place near an end), goes to the hand's grip point. It is made half the body's height long and follows the hand bone alone.
1215
+
1216
+ **Result.** The left hand at rest with its bones, from above and from the front, and closed by the library's idle:
1217
+
1218
+ ![A hand with a thumb chain and a finger chain, and the same hand closed into a fist](../website/public/research/3d/hand-bones.png)
1219
+
1220
+ - **The hands were found** on the first body: 9.9 and 10.8 sprite pixels long, on a figure 113 tall. The wrist joint estimated on the sprites sat in the palm, and moved 2.0 and 2.7 pixels back.
1221
+ - **A fist closes** with a tunnel between fingers and thumb, which is where a handle goes.
1222
+ - **The sword is held.** In the library's sword attack the knight lunges with the blade forward, the grip in his closed right hand between pommel and guard:
1223
+
1224
+ ![The dressed knight lunging with the sword, and the hand on the grip](../website/public/research/3d/held-sword.png)
1225
+
1226
+ - **It is one file of 2.6 MB,** 17,997 triangles, valid, with the sword as a sixth separate mesh. The viewer loads it, plays the sword attack, and lists the sword among the things worn.
1227
+ - **Godot 4.7.2 imports it** with 47 bones: 21 for the body, 14 for the hands, 12 for the cape. Its humanoid profile finds the twelve finger bones by name, as optional bones.
1228
+ - **The 64 pixel body gets none.** Its hand has no thumb apart, and `rig.py` says so and leaves the skeleton as it was.
1229
+ - **Nor does the second body** of step 46: PixelLab drew his hands as closed fists. A held item needs the finger bones' measurements, so he cannot be given the sword yet.
1230
+ - **`refit.py` now uses the bones two bodies share,** since one may have finger bones and the other not. The helm it gives the second body is unchanged; the cuirass differs by 3 pixels at most, at the wrists that moved.
1231
+
1232
+ Flaws:
1233
+
1234
+ - **The sword's colour has black patches,** where the sprites' outlines were projected onto it.
1235
+ - **The grip is thicker than the fist's tunnel** and the pommel is large: the sword is scaled by its length alone.
1236
+ - **The two hands differ in length** by a pixel, since each is measured on its own.
1237
+ - **The closed hand is coarse.** A hand is about fifty triangles a bone after thinning, so knuckles crease unevenly.
1238
+ - **The fingers stay closed when the sword is taken off** in the viewer: the grip is part of each animation.
1239
+
1240
+ Not checked: the left hand holding something, two-handed grips, a shield, the held sword in Godot's own renderer, and whether Godot's or Unity's retargeting drives a one-chain hand sensibly.
1241
+
1242
+ **Verdict.** Keep, for the painted path. A thumb and one chain is what the mesh shows, and it is enough to hold a sword through a stock attack.
1243
+
355
1244
  ## What has not worked, in one place
356
1245
 
357
1246
  So nobody repeats them:
@@ -365,19 +1254,40 @@ So nobody repeats them:
365
1254
  - Intersecting the carved shape with the generated mesh (step 12).
366
1255
  - `correct_pixelart` on a torn render (step 13).
367
1256
  - Projecting image-model redraws back onto the model (step 14).
1257
+ - Flattening a character's texture to a few materials (step 15).
1258
+ - Laying trusted sprite pixels over a flat base (step 18).
1259
+ - Asking the paint stage for a single view (step 20): grey noise.
1260
+ - Letting the paint stage invent the sides from one front reference (step 17).
1261
+ - Enlarging sprites with hard pixel edges for the mesh model (step 22): it builds a figure out of boxes.
1262
+ - Keeping painted views away from their own outlines, and shifting views to agree in colour (step 23).
1263
+ - Median cut for a sprite palette (step 25): most of the colours go to near-blacks.
368
1264
 
369
1265
  Two bugs worth remembering, because both produced plausible wrong pictures: glTF's axes turned into ours by swapping two of them is a mirror image, which silhouettes cannot detect; and a mesh whose faces point inward gets no texture at all, only fill.
370
1266
 
371
1267
  ## What is next
372
1268
 
1269
+ - **Hold the paint stage's colours** to the sprites' (step 29): the gold dulls and the dark metal turns blue.
1270
+ - **A smaller file.** Repack each cut item's texture to the part it uses, and thin the meshes.
1271
+ - **Tidy the cut's edge,** which is ragged and carries a fringe of skin colour.
1272
+ - **More bodies.** Step 46 puts the items on one heavier man. A much shorter or taller body, and other builds, are untested.
1273
+ - **Higher quality paint.** The texture does not have to be pixel art: aim for the best painted surface the models can give, and pixelate afterwards if wanted. Step 32 starts it. Steps 33 to 35 continue it. Step 36 fixes the item edges and a colour fault. Still to do: the short sleeve, a second painter (MV-Adapter), and repacking each item's texture so it uses the whole picture and the file shrinks.
1274
+ - **Towards game-ready** (see the survey below): a smaller file; sprites drawn at 256 pixels at the source; a thinned mesh with the paint and a normal map baked onto it; a standard humanoid skeleton and stock animations; metal and roughness; bones and springs for the cape.
1275
+ - **Sixteen directions and lighting for the sprite cards** (step 31): the in-between views of step 13, and normals from the hidden mesh.
373
1276
  - **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.
374
1277
  - **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).
375
- - **Held items.** Carve them separately, upright, and place them on the model the way the paperdoll layers place them on the sprite.
1278
+ - **Held items.** Step 47 puts a sword in the right hand. Still to do: a hand drawn as a fist, the left hand, a shield, two hands on one grip, and a handle sized to the hand.
376
1279
  - **A score that sees cleanliness.** Colour error against one drawing cannot tell a clean redraw from a torn render.
377
1280
  - **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.
378
1281
  - **Carve at a finer grid** than one voxel per pixel, so thin objects survive.
379
1282
  - **Remove baked shading.** The sprites are drawn lit from one side, and that light is now painted on the model.
380
- - **Use the rig.** The skeleton from step 6 has not been attached to a mesh.
1283
+ - **Open the rigged file in real engines.** Blender, Godot, Unity and Unreal each have their own expectations of a humanoid.
1284
+ - **More animations, and bones for capes and held items.**
1285
+ - **Bones for the cape,** now that it is one piece (step 24), and a check that a leg swinging back does not pass through it.
1286
+ - **A pose the eight views agree on.** The knight's A-pose has one view in a T-pose (step 21). Drawing the pose from a skeleton, not a sentence, might fix it.
1287
+ - **A score that forgives a pixel of offset** (step 25), so a clean render is not marked below a smear.
1288
+ - **A licence-clean route.** TRELLIS or TripoSG for the mesh, MV-Adapter for the paint, UniRig for the bones. Their licences were not checked here.
1289
+ - **Paint the carved shape too,** for the simple subjects where carving beats the generated mesh.
1290
+ - **Sprite normal maps.** PixelLab can draw a normal map for a sprite. Baked onto the mesh the same way, it would add surface relief the low-polygon mesh lacks. Not tried.
381
1291
  - Can the eight-view input of the hosted Hunyuan3D 3.1 use all eight sprites? (Unverified; see below.)
382
1292
 
383
1293
  ## What other people are doing
@@ -410,6 +1320,42 @@ No report was found of any of these being tested on pixel art.
410
1320
 
411
1321
  **The Discord pipeline.** The thread that started this described: build the character from tubes or capsules, or generate a mesh with Hunyuan or Meshy; unwrap it "as a folded piece of paper"; retexture the unwrapped image with an image model; carve hair and clothes as separate pieces; remove baked shadows and highlights; render with a toon or pixel shader. None of it could be checked against a public source. Step 7 here tested the tubes part, steps 9 to 11 the unwrap and texture part, and step 13 the image model, on the rendered views and not on the unwrapped texture.
412
1322
 
1323
+ **Painting a mesh you already have.** From a second survey on 17 November 2026, for step 29's question of how to get a better texture. Nothing here was run; figures are as their sources give them, and several sources disagree.
1324
+
1325
+ | Option | Runs where | What it takes | Licence | Fit for a 12 GB card |
1326
+ |---|---|---|---|---|
1327
+ | Hunyuan3D-Paint 2.0 | Local, installed (step 17) | One reference per pass, 512 pixel views | Tencent community licence, regional limits | Runs today |
1328
+ | [MV-Adapter](https://github.com/huanngzh/MV-Adapter), image to texture | Local, has ComfyUI nodes | A mesh and a reference image; 768 pixel views on SDXL, then RealESRGAN upscaling and LaMa inpainting | Apache-2.0 | README suggests the SD2.1 variant under 10 GB and SDXL above 16 GB |
1329
+ | [Hunyuan3D 2.1](https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1) paint | Local | Reference image; base colour, metal and roughness maps | Tencent community licence, regional limits | Official figure is 21 GB for texture. [A low-memory route exists](https://github.com/kijai/ComfyUI-Hunyuan3DWrapper/issues/165) by offloading; no 12 GB report was found |
1330
+ | [TRELLIS.2](https://docs.comfy.org/tutorials/3d/trellis2), texture only | Local, native in ComfyUI | A mesh and one image | MIT | Claims range from 6 GB in a low-memory mode to 24 GB. *Unverified.* One image only, so the back is invented (the fault of step 17) |
1331
+ | [Meshy Retexture](https://docs.meshy.ai/api/retexture) | Hosted, paid | An uploaded mesh and reference images; 2K to 8K textures | Closed | No card needed. About 10 credits a task. *Unverified pricing.* |
1332
+ | UniTEX, MaterialMVP, MVPainter, RomanTex | Research code | Mesh and reference image | Not checked | Not checked |
1333
+
1334
+ - **The reference is the first cap, whichever painter is used.** Every option paints what its reference shows, and ours is a 64 to 80 pixel sprite enlarged with hard edges. A redraw of each direction as a large, detailed picture would raise the ceiling for all of them.
1335
+ - **MV-Adapter is the likeliest local step up:** larger views, a permissive licence, and it sits on SDXL, so style models and edge or depth guides apply.
1336
+ - **The turn-per-sprite trick of step 20 should carry over** to any painter that takes a reference and a mesh, since it only decides which way the mesh faces. It does not carry over to TRELLIS.2, which paints the whole surface at once.
1337
+
1338
+ **From a painted mesh to a game-ready asset.** From a third survey on 17 November 2026. The model of step 36 looks right and is not yet what a studio would call an asset. This lists what is missing, and what exists for each gap. Nothing here was run; most sources are vendor pages or the authors' own papers, and are marked where a claim could not be checked.
1339
+
1340
+ | Gap | Where the model stands | What exists |
1341
+ |---|---|---|
1342
+ | Triangle count and edge flow | 16,496 triangles after thinning (step 41), from 79,819; still no loops at the joints | [AutoRemesher](https://www.cgchannel.com/2026/07/get-free-retopology-tool-autoremesher-and-its-blender-bridge/) (free, MIT, all-quad, a target count); QuadriFlow in Blender; [CurioMesh](https://github.com/CurioCrafter/CurioMesh) (GPLv3, Blender). Guides put a rigged game character at 10,000 to 100,000 triangles. Then the paint is baked from the dense mesh onto the light one, with a normal map for the lost relief |
1343
+ | Unwrap | Hundreds of small pieces from xatlas, and each item's texture mostly empty | A fresh unwrap of the light mesh with few seams; one packed texture per character or per item |
1344
+ | Skeleton | Twenty-one bones under standard humanoid names, matched by Godot's profile (step 42); a thumb and one finger chain a hand where the mesh shows a thumb (step 47) | A standard humanoid skeleton so that stock animations fit. [Mixamo](https://helpx.adobe.com/creative-cloud/faq/mixamo-faq.html) rigs an uploaded humanoid in a T-pose for free and has a large animation library; it wants one joined mesh, and is described as unmaintained. Open models: [UniRig](https://dl.acm.org/doi/abs/10.1145/3730930) (MIT code; its checkpoints and data have their own terms), [Puppeteer](https://arxiv.org/pdf/2508.10898), RigAnything, Anymate (Apache-2.0). No memory figures were found for any of them. *Unverified.* |
1345
+ | Animation | Eleven stock animations retargeted from a CC0 library (step 43), and one walk made by formula | Mixamo's library; [HY-Motion 1.0](https://arxiv.org/abs/2512.23464) (Tencent, open weights, text to human motion, a community licence). Its skeleton and export formats were not checked |
1346
+ | Materials | Base colour only, with the redraw's lighting painted in | Roughness and metal maps: Hunyuan3D 2.1's paint stage (21 GB), MaterialMVP, and 2026 work that estimates materials from several views together ([ReLi3D](https://arxiv.org/abs/2603.19753), Intrinsic Image Fusion). A crude start costs nothing: metal and rough values per item |
1347
+ | Parts | Cut from a worn mesh by a sprite mask and a colour test (steps 27 and 36) | Generators that make parts natively: [Hunyuan3D-Part](https://x.com/TencentHunyuan/status/1971491034044694798) (open, segments a mesh into parts and regenerates each whole), [OmniPart](https://arxiv.org/pdf/2507.06165) (planned from 2D part masks, which the paperdoll layers are), PartCrafter. None was checked for clothing or for a 12 GB card |
1348
+ | References that agree | Eight directions redrawn one at a time (step 33); sprites at 256 pixels from the generator (step 39) | Models that turn one picture into consistent views: Qwen-Image-Edit with a multiple-angles LoRA, a Flux Kontext turnaround LoRA. Or draw the sprites larger at the source: PixelLab's v3 character goes to 256 pixels, four times step 26's |
1349
+ | Cloth | The cape hangs from twelve bones and its swing is baked into each animation (step 45) | A chain of bones down the cape with spring physics in the engine, or the engine's cloth |
1350
+ | Delivery | A 2.1 MB .glb that imports into Godot (steps 37 and 41) | Import tests in Godot, Unity and Unreal; mesh and texture compression (meshopt, KTX2); levels of detail |
1351
+ | A yardstick | None | [Meshy's API](https://docs.meshy.ai/api/pricing) takes an uploaded mesh and sells each step: retexture 10 credits, remesh 5, rigging 5 with a walk and a run, an animation 3. One character through all of it would show what a paid pipeline returns. A paid plan is said to be needed for the API. *Unverified.* |
1352
+
1353
+ - **The largest gaps are not in the paint.** A studio would reject this model first for its triangle count, its unwrap and its home-made skeleton, and only then look at the texture.
1354
+ - **A standard skeleton is worth more than any one animation,** because it makes every stock animation usable.
1355
+ - **Several gaps close with no new model:** thinning the mesh and re-baking, a normal map from the dense mesh, values for metal and roughness, compression, an engine import test.
1356
+
1357
+ **Sprite cards on a 3D skeleton.** [A short from Cor Mundi Studios](https://www.youtube.com/shorts/84clZXpwRc0) (28 seconds, read from its transcript on 17 November 2026) shows a 2.5D player character in Unreal Engine 5. Each body part is a flat card with its own sprite sheet in sixteen directions. Under the cards is a 3D mesh that is not what the player sees: it carries the lighting and the bones, and the bones tell each card where to be and which direction to show. The picture stays hand-drawn pixels and the motion comes from a rig. Step 31 tries it with eight directions and no lighting.
1358
+
413
1359
  No public tool was found that takes several directional pixel sprites and returns a mesh.
414
1360
 
415
1361
  ## Cost so far
@@ -419,6 +1365,13 @@ No public tool was found that takes several directional pixel sprites and return
419
1365
  - Hunyuan3D: nothing but about two minutes of GPU time per mesh, after a 4.93 GB download.
420
1366
  - Staged texturing: nothing. About six seconds a mesh on a laptop.
421
1367
  - Image-model redraws in steps 13 and 14: 50.1 generations for six calls.
1368
+ - The paint stage: no generations. A 9.2 GB download, then about six minutes of GPU time per character.
1369
+ - The rebuild of step 40: 0.8 generations for joints, and about two hours of GPU time.
1370
+ - The 256 pixel body and four states in step 39: 9 generations for the body; the states are quoted at 10 to 25 each and were not read back.
1371
+ - A-poses in step 21: 20 generations for the two states, 0.25 for importing the knight, 1.6 for sixteen joint estimates.
1372
+ - 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.
1373
+ - The sword of step 47: 25 generations for the eight directions, and six and a half minutes of GPU time for its mesh.
1374
+ - Nine meshes in step 27: about two minutes of GPU time each. Five paint runs in step 29: five to six minutes each.
422
1375
 
423
1376
  ## Running the scripts
424
1377
 
@@ -447,6 +1400,59 @@ python3 research/scripts/texture.py <folder> <name> <mesh.glb> <out-folder>
447
1400
  DUMP=1 node --experimental-strip-types research/scripts/carve.ts <folder> <name> <out-folder>
448
1401
  MODE=vote VOX=<out-folder>/<name>.vox CAMERA=<out-folder>/<name>.camera.json python3 research/scripts/texture.py <folder> <name> - <out-folder>
449
1402
 
1403
+ # A rigged, animated .glb. The rig file comes from carve.ts run with an anchors file.
1404
+ python3 research/scripts/rig.py <name.textured.glb> <name.rig.json> <name.vox> <name.camera.json> <out.glb> <preview.png>
1405
+
1406
+ # Texture a mesh with Hunyuan3D's paint stage, one pass per sprite direction. Needs the second ComfyUI of step 17.
1407
+ python3 research/scripts/hunyuan3d_paint_turn.py <name.textured.glb> <folder> <name> <out-folder>
1408
+
1409
+ # The same, keeping two side views from each pass and leaving the bake to bake.py.
1410
+ SPREAD=22 STAGE=paint python3 research/scripts/hunyuan3d_paint_turn.py <name.textured.glb> <folder> <name> <out-folder>
1411
+ python3 research/scripts/bake.py <name.textured.glb> <out-folder>/<name>.views.json <bake-folder> <name>
1412
+
1413
+ # Rig a mesh through its own inside, with the sprites' palette stored in the file.
1414
+ PALETTE=<folder>:<name> TEX=512 python3 research/scripts/rig.py <name.baked.glb> <name.rig.json> - - <out.glb> <preview.png>
1415
+
1416
+ # A character from parts (steps 26 to 28). Sprites and layers share one canvas size; the camera is the body's.
1417
+ python3 research/scripts/smooth_inputs.py <art> <base> <in> worn base,<underwear-layer>,<item-layer>
1418
+ python3 research/scripts/hunyuan3d.py <in> worn <mesh-folder>
1419
+ TURNS=0 CAMERA=<body.camera.json> python3 research/scripts/texture.py <sprites> <worn> <mesh-folder>/worn-mv.glb <tex>
1420
+ TURNS=0 CAMERA=<body.camera.json> python3 research/scripts/texture.py <sprites> <mask> <mesh-folder>/worn-mv.glb <tex>
1421
+ python3 research/scripts/cut_item.py <tex>/<worn>.textured.glb <tex>/<mask>.textured.glb <item.glb>
1422
+ ITEMS="Helm=<helm.glb>:Head;Cape=<cape.glb>:Hips,Spine;Cuirass=<cuirass.glb>" python3 research/scripts/rig.py <body.textured.glb> <body.rig.json> - - <out.glb>
1423
+
1424
+ # Sprite cards (step 31): the bone that owns each vertex, then the sprites cut into pieces per bone.
1425
+ SKIN=<skin.npz> python3 research/scripts/rig.py <body.textured.glb> <body.rig.json> - - <skeleton.glb>
1426
+ LAYERS="Body=<body>;Cape=<cape>:Spine:behind;Helm=<helm>:Head" python3 research/scripts/cards.py <skin.npz> <body.camera.json> <sprites> <out-prefix>
1427
+
1428
+ # Redraw sprites large with a local image model, then paint from the redraws with larger views (step 32).
1429
+ python3 research/scripts/redraw.py <sprites> <name> <redraw-folder> "<what the character is>"
1430
+ VIEW=768 SPREAD=22 STAGE=paint python3 research/scripts/hunyuan3d_paint_turn.py <name.textured.glb> <redraw-folder> <name> <out-folder>
1431
+ python3 research/scripts/bake.py <name.textured.glb> <out-folder>/<name>.views.json <bake-folder> <name> 2048
1432
+
1433
+ # A light copy of a painted part, with its paint and a normal map baked on (step 41), then rigged small.
1434
+ TEX=512 python3 research/scripts/thin.py <painted.glb> <light.glb> 3000
1435
+ ITEMS="Helm=<helm-light.glb>:Head" JPEG=90 TEX_NORMAL=512 python3 research/scripts/rig.py <body-light.glb> <body.rig.json> - - <out.glb>
1436
+
1437
+ # Add stock animations from a humanoid library to a rigged character (step 43).
1438
+ python3 research/scripts/retarget.py <character.glb> <library.glb> <out.glb>
1439
+
1440
+ # Give a hanging item chains of bones, then swing them through every animation (step 45).
1441
+ CHAINS="Cape=3x4" ITEMS="Cape=<cape.glb>:Hips,Spine,Chest:loose" python3 research/scripts/rig.py <body.glb> <body.rig.json> - - <character.glb>
1442
+ python3 research/scripts/sway.py <animated.glb> <out.glb>
1443
+
1444
+ # Reshape an item made on one body for another (step 46). The skin files come from rig.py with SKIN=<file>.
1445
+ ONLY=Head python3 research/scripts/refit.py <helm.glb> <first.skin.npz> <second.skin.npz> <helm-for-second.glb>
1446
+
1447
+ # Draw textured meshes large, one row each.
1448
+ python3 research/scripts/look.py <sheet.png> <a.glb> <b.glb>
1449
+
1450
+ # The paint stage as published: one front reference, six invented views.
1451
+ python3 research/scripts/hunyuan3d_paint.py <mesh.glb> <reference.png> <out-folder> <name>
1452
+
1453
+ # Render any textured mesh from sixteen directions at sprite size and score it.
1454
+ python3 research/scripts/render.py <textured.glb> <folder> <name> <sheet.png>
1455
+
450
1456
  # Score the second row of a sheet against the first.
451
1457
  python3 research/scripts/score.py <sheet.png>
452
1458
  ```