A picture drawn by hand gets bones. Open a PNG of a character, pick a skeleton, drag its joints onto the drawing, and the character walks, runs, bites and breathes fire at once: nothing is animated by hand. Steps 38 to 42 made their characters in Blender scripts and kept them only as packed atlases; now every rigged character of the library is a folder of plain pictures and a short rig.json, so anyone can draw a new one or change an old one in a paint program. The toolbox learns to rig a picture on a skeleton template.
Play it · How to draw your own figures · Source: collection-spielwerk/43-knochenwerkstatt · Toolbox 6.3.0 or later
The workbench
There is nothing to win or lose. The drawing lies in the middle with its skeleton over it, the character plays on a small stage at the right. The editor fills its window: the side panels keep their width and the bench takes the rest, zoomed to the drawing.
- Bild öffnen … or a drop onto the workbench opens a PNG, a few layers, a folder's files or a zip. Layers of different sizes share the largest: a smaller one is padded onto it, in the middle and standing on the bottom edge, ready to be moved into place. Kobold and Stachelwolf open the two examples.
- Zweibeiner, Vierbeiner, Wurm and Flieger lay a skeleton onto the drawing, as tall as it is.
- Drag a joint (the dots) onto its place in the drawing, and the orange line under the feet. The rig is made again at once.
- Gewichte colours each pixel by the bone it follows; Knochen shows or hides the skeleton. Each layer row has an eye (●) that shows or hides the layer, and the bones only hidden layers follow go with it. Drag a row's name up or down to move the layer. Click it to select the layer: its bones light up, and a click on a bone gives it to the layer or takes it away. Its bones key (Rumpf ▾) opens a list over the bench: the skeleton's parts (Rumpf, Kopf, Arm vorne, ...), then the bigger groups older drawings used (Hinten, Körper, Vorne), the current one marked ✓ and bones picked one by one as "n Knochen (eigene Auswahl)" at the top; a click or a tap picks, Esc or a click beside it closes it. A picture of one layer follows every bone (ganze Figur). The list shows as many rows as fit and scrolls through the rest (the wheel, ▲ and ▼).
- A part drawn a little off its bones is moved back by eye: with its layer selected, Shift+drag on the bench moves only that layer's picture, the arrow keys by 1 pixel and Shift+arrow by 10; the joints stay. The row says how far ("5 head · verschoben 0, −3") and Lage zurücksetzen puts it back. The PNG stays as drawn: the distance goes into
rig.jsonasoffsets, andrig_from_picturemoves the pixels before it rigs them, in the editor and inlibrary.mjs rigalike. - Ersetzen on a row, or a PNG dropped onto the row, swaps that layer's picture for another: an arm drawn again, a new head. A picture of another size lands on the middle of the old part; a bigger one than the bench grows it, every layer and the joints alike, so nothing moves. Its bones, its place and the joints stay; Zurück brings the old picture back.
- The clip keys play the character: Stehen, Gehen, Rennen, Biss, Feuer, Klaue, and for a Zweibeiner also Springen and Winken.
- Zurück undoes a drag, a template change, a layer move, a bone pick, a moved picture or a replaced part. Vorlage downloads the skeleton's draw-over sheets as a zip: the whole figure and one per layer, all the same size and shaped like the figure (388 × 578 for a Zweibeiner, 548 × 414 for a Vierbeiner). Exportieren downloads the folder as a zip; dropped back in, it opens unchanged.
- The monster kits of step 42 are not edited here: their parts are pictures in the kit's source folder, built with
library.mjs rig.
Controls:
- Mouse or touch: drag the joints, press the keys.
- Mouse: drag a layer's row to move it, click it to pick its bones on the skeleton, Shift+drag on the bench to move the selected layer's picture, turn the wheel over the rows to scroll them, drop a PNG on a row to replace that layer.
- Keyboard: ↑, ↓ and Enter in an open bones list, 1 to 8 for the clips, G for the weights, K for the skeleton, T for the next template, Backspace or Ctrl+Z to undo, Alt+↑ and Alt+↓ to move the selected layer, the arrow keys (with Shift 10 pixels) to move its picture, Esc to let go of it.
Draw your own character or monster
-
Optional: a guide. Pick the skeleton and press Vorlage: a zip of sheets with the joints, the ground line and a scale in pixels, one per part (its own bones strong, the rest faint) and one for the whole figure, named as the editor opens them. The zip itself is to draw on: dropped back in unchanged, the editor says so. Drawn on them and exported at their full size, the layers open with the joints where the sheets show them. With a character open, it lies faint under the joints, the way to draw a new skin for it.
-
Draw in any paint program (PhotoLine, for example) on a transparent background: the character whole, standing still, seen from the side and facing right, the feet on one line. Each part on a layer of its own, so it can be drawn again alone later; export every layer as a PNG, best all of the same size (a cropped one opens in the middle on the bottom edge and is moved into place with Shift+drag), numbered back to front:
- Zweibeiner:
1-far_arm.png,2-far_leg.png,3-near_leg.png,4-torso.png,5-head.png,6-near_arm.png; - Vierbeiner:
1-far_hind_leg.png,2-far_front_leg.png,3-tail.png,4-torso.png,5-head.png,6-near_hind_leg.png,7-near_front_leg.png; - Flieger:
1-far_wing.png,2-far_leg.png,3-tail.png,4-torso.png,5-head.png,6-near_leg.png,7-near_wing.png; - Wurm:
1-torso.png,2-head.png; or, for anything simple, one picture.
Fewer layers work too: the older
1-back.png,2-body.png,3-front.png(the far side, the body with head and tail, the near side) still follow their bones. With these names each layer moves only with its own bones. - Zweibeiner:
-
Open the PNGs together (or drop them) and click the skeleton's key. Drag every joint onto its place: shoulder, elbow, hip, knee, ankle, toes, neck, jaw, the tail. Drag the orange line under the feet.
-
Watch the clips. Where something stretches, move the joint next to it. Gewichte shows which bone pulls which pixel; a layer's bones list, or its bones clicked on the skeleton, keeps an arm from following a leg.
-
Export the folder. In the owner's asset library the same editor saves it straight in (
library.mjs rig), and a game loads it like any puppet:catalogue_images: { wolf: "drawn/monster/<name>" }in itssrc/assets.ts, thenlogic.load_puppet("wolf").
New in the toolbox: drawn characters
The problem. The characters of steps 38 to 42 were made by Blender scripts: every part rendered alone, packed into one atlas, the bones and pivots written into JSON. A person drawing a monster in a paint program had no way in, and changing a hat meant changing a script. The owner asked how to add a monster drawn by hand. The answer is a whole picture plus a rig editor.
A skeleton template. Each of the four skeletons is plain data: the joints a person drags (with German titles), the bones between them, the anchors (soles, mouth, hands) and the chains with their roles, the same roles step 42's generator uses. A template also names its parts, one layer each: an arm, a leg, the torso, the head, the tail, a wing. With an arm and a leg on one picture the arm's pixels bound to the leg as well, and the run stretched part of the grid to eight times its length; with the limbs on layers of their own the Kobold stretches at most 2.3 times on a run. Since 0.1.4 every part is its own layer, so one arm can be drawn again and swapped alone; the bigger groups of before (back, body, front) stay as groups, and folders drawn with them follow the same bones (template_layer_bones). All fifteen rigged items of the library build the same from their folders after the change.
From joints to a rig. rig_from_picture fits the template to the placed joints (bone lengths and angles), paints a bone map for every layer (each pixel in the colour of the nearest bone it may follow), cuts each layer to its pixels and packs them with their maps into one atlas. The result is step 41's soft skin, so the drawing bends as one skin. The movement comes from the template: step 42's gaits and attacks, made from the fitted bones' measurements, and for a Zweibeiner step 38's keyed clips, their angles carried over onto the new rest pose with the hip lifted so the feet still stand.
const built = rig_from_picture({
layers: [{ name: "back", pixels: back }, { name: "body", pixels: body }, { name: "front", pixels: front }],
joints: placed, // { pelvis: [210, 250], neck: [330, 205], ... } picture pixels
template: "vierbeiner",
});
const rig = PuppetRig.from_data(built.rig); // idle, walk, run, bite, fire, claw
rig.image = canvas_of_pixels(built.pixels);
const wolf = rig.puppet("walk");
Every rigged item is a source folder. <item>/source/ in the library holds one picture per character, per layer, per part or per piece and a short rig.json (kit.json for a kit), and build_rig_source builds the atlas and the catalogue's rig from it. The packing is fixed (shelves sorted by height and name, 4 pixels apart), so the same folder always gives the same bytes; split_rig_atlas takes a built atlas apart into a folder again. The Blender scripts of steps 38 to 42 now write these folders instead of atlases. All twelve of their characters, kits and sheets came out of the new path with the same rig, key for key, and the same atlas, pixel for pixel, so the games did not notice.
The draw-over sheet. template_sheet draws a template on a canvas in the skeleton's own shape (upright for a Zweibeiner, wide for a Vierbeiner): the bones, the joints with their names, a scale and the ground line, and optionally a character faint under it. With bones it is one layer's sheet, those bones strong and the rest faint.
What it costs. After a joint moves, the Kobold's rig (six layers, 340 × 450 pixels, its grid and eight clips) is made again in 16 ms in headless Chromium.
Tests. The toolbox's tests check that a picture rigged on the Zweibeiner runs step 38's run with its feet on the ground, that a moved joint changes only the bones next to it, that a layer limited to the far leg never binds to the near leg, and that every kind of source folder (a puppet's parts, a soft skin, a wardrobe, a mark sheet, a part kit) splits off a built atlas and builds back into the same rig and pixels. The step's tests draw a figure in code for every template and check every clip for tears and folds, the undo, the layers, a folder that goes out and comes back, and a layer's moved picture (the same rig from the bench, from its folder and from build_rig_source). The browser check opens the Kobold from the library, drags joints, plays every clip, downloads the sheet, exports the zip and opens it again into the same rig and the same atlas, nudges the Kobold's head with the arrows and Shift+drag and resets it, then draws a monster of its own, drops it on the workbench, rigs it as a Vierbeiner and makes it walk and bite.
The modules are in src/canvas/puppet/: SkeletonTemplate.ts, RigPicture.ts, RigSource.ts and TemplateSheet.ts. The docs are the "Drawn characters" section of docs/puppet.md.
From earlier steps
- The soft skin from step 41: a drawn character is one, with its bone maps painted from the joints.
- The gaits, attacks and part kits from step 42: a drawn monster gets them from its template.
- The puppets, rigs and keyed clips from step 38: a drawn Zweibeiner jumps and waves like the wanderer.
- The clothes and marks from step 39 and step 40: their sheets are source folders now too.
- The
ActionMapfrom step 30: the keys.
The scaffold, start screen, intro and scaling are explained in Spielwerk 00: The workbench.
Embed it
<script src="https://www.game-object.de/tce-elements/tobidot/dll-tce-assets"></script>
<script src="https://www.game-object.de/tce-elements/tobidot/tce-knochenwerkstatt"></script>
<tce-knochenwerkstatt></tce-knochenwerkstatt>
| Attribute | Values | Default |
|---|---|---|
init-intro |
true / false: play the GO logo intro |
true |
init-workshop |
true / false: in the asset workshop ("Speichern" instead of "Exportieren", no example opened) |
false |
Next
Previous: Spielwerk 42: Bestiarium · Next: Spielwerk 44: Knopper Klopper · All steps
Comments