FERRETGame engine over Babylon.js
Ferret

Humans

Skill ferret-humans · download all skills · SKILL.md

When to use#

A character, an NPC crowd, a proof figure, a face from a description or a photograph, clothes from words, a species (wolf, orc, android) or a god.

The model#

A figure is one HumanSpec (seed, kit, body, face axes, skin, eyes, hair, outfit, motion, kitOptions). buildFigure(data, spec, tier) makes the geometry; tiers are full, L0d..L3m. The skeleton is 87 joints (kits append tails and ears after them) so every cc-clips clip plays. Convention: body faces +z, left is +x, quaternions xyzw.

Steps (by commands: the same ones a person, a test and an agent use)#

  1. Open the viewer with ?humans (read-only; headless: startServer({humans:true})), or register the commands yourself: registerHumansCommands({register}, data).
  2. humans.create {id, words, outfit, recipe?, proof?, seed}; humans.set {id, path:'/body/age', value} (JSON pointer, refused when invalid); humans.dress {id, words}; humans.preset {id, recipe|uniform|proof}; humans.randomise.
  3. From a picture: humans.fromPicture {words, mediapipe|landmarks, image, regions, garments} (landmarks fit the face axes; colours come from pixels); humans.compare reports colour and landmark distances.
  4. Look: humans.show {id, tier, clip, expression, light, camera}, humans.sheet {ids}, humans.screenshot. Check: humans.validate, humans.report {id, tier} (triangles, bytes, build ms, garment penetration), humans.describe, humans.diff.
  5. Ship: humans.bake {id, tier, path} gives a glb (87+ joint nodes, skin, PBR materials, fabric textures, 51 ARKit morph targets on the head, sockets and chains in scene extras); humans.save; humans.code is the share code.
  6. Crowds: planCrowd + bakeVariant (vertex animation, thin instances); 1000 people at L3d cost about 1 ms on an RTX 3050.

Check afterwards#

humans.validate has no errors, humans.report penetration fraction is small, the glb loads and a knee bend moves the skin (tools/humans/p11-glb.mjs).

What usually goes wrong#

  • Bending a CC bone about local X: X is the bone axis, so it twists. Hinge about Z.
  • Colours in specs and kits are linear; do not gamma them again under image processing.
  • Ferret.humans is its own namespace in the library bundle (names clash with other packages).
  • Giants: use kitOptions.scale, the shape pack caps height near 2.3 m.

Files#

  • reference/humans.md — People and anthropomorphic characters from a spec: faces from words or a picture, bodies, clothes, hair, kits (animal-headed, fantasy, reptilian, robot, Greek, Egyptian, Norse), gait clips, crowds, glb bake, the humans.* commands and the ?humans viewer.
  • reference/api-humans.md — every export of @ferret/humans with signature and doc comment
  • reference/api-humans-2.md — every export of @ferret/humans with signature and doc comment
  • reference/api-humans-3.md — every export of @ferret/humans with signature and doc comment
  • reference/commands.md — 18 commands of these packages with their arguments