Characters from a bought model to a library package
tools/character turns a figure bought or exported from Character Creator into a library character on the engine's 87-joint skeleton, so every clip of the library plays on it, and publishes it as a package. Nothing in it knows a game: names, paths and poses are parameters, and tools/character/examples/ holds the configs of one figure (tunic, trousers, boots, helmet, rifle). Each tool's header lists its arguments. Anything that renders runs on the NVIDIA card (FERRET_CHROME is the chrome-headless-shell pinned to it); the work files stay outside the repository.
- The reference skeleton.
skeleton-dump.mjs <figure.glb> joints87.jsonwrites the 87 joints (names, parents, world matrices) of any library figure (the skin with 87 joints is taken). - The conversion.
blender -b figure.blend -P tools/character/cc-to-87.py -- joints87.json raw.glb joints.json [config.json]puts the figure on that skeleton (config: the armature, the meshes, the ride of a prop).blender_export_fixes.pyfixes what Blender's exporter gets wrong: textures that darken through float images, and solid opacity maps left linked. - The finishing.
fix-joints.mjs raw.glb joints.json joints87.json out.glb --config fix.jsongives every joint the 87's world orientation at the figure's own place (the clips' local rotations then turn his bones about the same axes) and fixes the inverse binds, then:export-fixes.mjs: every garment comes out BLEND though its map is solid (drawn blended it writes no depth and the skin shows through): solid ones become OPAQUE, real cut-outs MASK, corneas stay BLEND; a garment with roughness 0 (a mirror) gets an estimate per kind of material; the body triangles a garment covers are not drawn, with a ring of skin kept under every edge of the cloth (cut at the edge itself the neck showed teeth above the collar);sling.mjs: a prop (a rifle) is slung on the back and its strap laid along the cloth surface, skin-weighted so it follows the body.--no-culland--no-propkeep the whole body or drop the prop (for variants).
- Variants.
refit-parts.mjs spec.jsonputs the parts of another figure made on the same mannequin on this body: heads and caps rigidly (scaled by the head ratio), garments pushed out of the body by their thickness with their own weights, an outer garment hiding the ones under it, the body hidden under everything the variant wears. - The package.
publish-character.sh out.glb <id> <work> --poses poses.json [--vat vat.json]:pack-tiers.mjs(desktop with the textures as they are, mobile at 1024 px), the desktop maps as KTX2 UASTC (no decoding in the browser, a quarter of the video memory, about 2.5 times faster to load in the A/B below), the impostors baked from the mobile tier (the same meshes), the crowd's VAT bake shipped in the package (bake-vat.mjs, see Crowds and far views), the package built and, unless--no-install, put into the local library. - Checks.
pose-sheet.mjs figure.glb out.png clip:seconds ... --clips clips.glbposes the figure and photographs it (POSBONES=pelvistakes only the pelvis' translation, scaled to the figure;CAMY,CAMRframe a close-up);ktx-ab.mjs a.glb b.glb --lib <game's lib>loads the same figure with JPEG/PNG and with KTX2 maps, alternating, and prints parse and ready times;ui-check.mjs webgl2|webgpu --game <folder>opens a built game in a graphics mode and checks the begin button, a click and Escape.