@rig-c/pose
Joint positions over time in — bone keys on a rig-c rig out, checked before they are written.
rig-pose retarget wrote from it, drawn by rigc render; inset: forearm and cup at 2×. The swing is deliberately small — a sine of ±4° centred 2.5° toward her body, for reasons below. The clip is the whole motion, two swings in 3 s, and loops where the motion does.Skip to Install · Inputs and outputs · Limits · Docs
A pose model reads each frame alone, so joints shake from frame to frame, and every key would carry that shake. Mapping picture angles onto bones has traps of its own: setup rotations, and parents that turn their children. rig-pose cleans the sequence once, where it can be inspected, then turns each mapped bone to point along its segment — and refuses to write keys that do not land where the pose asked.
A dance beside its source pose
This example shows larger arm and leg movements alongside the source skeleton. The cup swing below follows a different rig and a smaller range of motion; Play still runs that swing live.
How the swing reached Character 1
A motion that fits the rig
This recorded swing and its measurements use @rig-c/pose 0.35.0 and rig-c 2.61.0. They are a pinned reproduction, separate from the current package version above.
The first try was a full arm-over-the-head wave. It passed every check — the gate, the landing tolerance, the fold test — and the render still showed the sleeve torn open at the shoulder once the arm went overhead. A pass is structural, so the motion has to suit the character and the rig: here, the coffee cup she is already holding, swung loosely like a pendulum from the elbow, written as two swings in three seconds: the forearm follows a sine with a 1.5 s period, eased at both ends, and the sequence was cleaned with --loop, so the motion returns to its first frame at 3 s and the hero clip above is all of it.
Getting that right took measuring rather than looking. Swung outward, the arm uncovered the edge of the trousers it hides in the painting, which See-through had to synthesize; swung inward, it slid under the shirt, because the arm part is drawn beneath topwear. And the hand-placed joints did not sit exactly on the rig's bones, so even "at rest" the retarget turned the upper arm 4.5° and the chest 2.6° away from how the rig was drawn. So the rest pose was aligned first — every track reads 0 at rest — and then the arm part was rendered alone and with the whole rig, counting, frame by frame, how many of its pixels end up covered by another part:
| Animation | Arm pixels covered (rim excluded), worst frame |
|---|---|
idle, as the rig was drawn | 926 |
| the first swing (upper arm and forearm, rest not aligned) | 1,854 |
| the previous swing (forearm only, aligned rest, outward half cut) | 1,242 |
| this swing (sine ±4° centred 2.5° in) | 1,295 |
What the extra ~370 px are: a thin strip along the inside edge of the sleeve, where its mesh meets the shirt. The sleeve and cuff stay in front.
The outward side got the same treatment. Counting pixels on the body side of the resting arm that turn into bare background — a hole in the trousers behind it — a ±6° swing opened up to 5,173 px at its outermost frame. The previous swing cut its outward half to 30% of the inward one (worst frame 1,124 px), which kept the trousers whole but made the swing a twitch. This one is a whole sine, centred toward the body instead: its worst frame opens 1,476 px, under the 1,500 px set before measuring (the breathing idle alone opens 1,138). Most of that count is the gap between forearm and leg widening, which is what a swing should do; the tear itself is a notch in the trouser edge just below the cuff, where See-through synthesized cloth the painting never showed. Swung symmetrically about the rest pose, the notch shows from ±4° (5,045 px at ±5°, 4,184 at ±4°, 3,117 at ±3°), so the swing is centred where the rig can take it. A wider swing about the rest pose waits on the rig: an arm cut free of the torso and a trouser edge that holds.
The map names two chains: the trunk (hip to neck) on the chest bone, and the right arm (shoulder, elbow, wrist) on the two sleeve bones. The rig has no left-arm bones (no sleeve_l in its rig.json), so that arm stays as painted, and the hand with the cup is not mapped: it turns with the forearm.
| Track the rig received | From the pose | Range over the loop |
|---|---|---|
sleeve_r0 rotate | shoulder → elbow | 0° (held) |
sleeve_r1 rotate | elbow → wrist | −1.49° (outward) to 6.49° (inward), a sine |
chest rotate | hip → neck | 0° (held) |
hip translate | hip | 0, 0 (held) |
Direction, not length. Each bone points the way its segment points in the picture but keeps the rig's own length (upper arm 300 px in the pose, 267 units on the rig; forearm 335 px and 303 units).


What it checked before writing
rig-pose retarget: 73 frame(s), 3.000s — 4 track(s); min-score 0.3, flip off, short off, bends refuse (tolerance 0°)
GATE rigc build --profile spine-html: green — 52 assertions: 26 measured (26 passed, 0 failed), 26 skipped, 0 not in profile "rig-play"
LAND bone "sleeve_r0" aim — worst |reached − asked| 0.0000764° at frame 0 (t=0.000s); the tolerance is 0.01°
LAND bone "sleeve_r1" aim — worst |reached − asked| 0.000559° at frame 0 (t=0.000s); the tolerance is 0.01°
FOLD rigc render --folds at 24 fps: no mesh folds
wrote swing.motion.json — animations: idle, swing
The rig is built with the new animation and gated before anything is written; every mapped bone, posed by rig-c's own poser, has to land within 0.01° of what the pose asked on every frame. The run also says what it left out: 26 IDLE-DROPPED lines name the breathing and hair tracks that were not carried into swing — which is why only the arm moves. And then someone still has to look: the torn first try passed all of these lines.
The joints were placed by hand on the painting (the way the getting-started guide's docs/KEYPOINTS.md describes); the swing is a three-second test motion made from them, not footage. Next, Core is the compiler that gated this build, Review is where a person checks a motion against footage, and Play runs this one live.
How it works
- Clean.
rig-pose cleanremoves spikes, fills low-score or occluded joints from their neighbours, smooths each joint and holds joints that have stopped.retargetreads only a sequencecleanwrote; COCO-17 input is converted with--coco. - Map. You write which bones carry which joints, chain by chain.
- Retarget. For every frame and every mapped bone, the bone is turned so it points the way its segment points, minus its setup angle and its parent's turn.
- Check. The gate must be green with and without the animation, every mapped bone must land on its angle, hinges must bend one way; otherwise nothing is written and every reason is printed.
- Say what it cannot decide. Lines such as
HOLD,END-ONandIDLE-DROPPEDname what to look at.
Key terms. body-18 — the 18 joints the sequence uses; r/l are the subject's sides. Chain — a limb in the map, as bones that descend from one another. Lands — a mapped bone within 0.01° of the angle the pose asks for. Cleaned record — the block clean writes into the sequence, which retarget requires.
Install
npm i -D @rig-c/pose
bun run rig-pose retarget --rig out/rig --map map.json --pose swing.pose.clean.json --out swing.motion.json --name swing --build swing-build
Installing @rig-c/pose provides the rig-pose executable used above. The unscoped convenience name rig-pose installs the same package. See package names and aliases.
The published package declares Bun 1.4.0 or later on PATH; @rig-c/core comes as a dependency.
Inputs and outputs
| In | Out |
|---|---|
A body-18 pose sequence, rig-pose-sequence/1 (COCO-17 with --coco) | A cleaned sequence carrying its cleaned record (rig-pose clean) |
A rig built with rig-c: the rig/ directory with rig.json and motion.json | A motion spec (--out, e.g. motion.json) with the bone keys |
A map, rig-pose-map/1 — which bones carry which joints | A JSON report, rig-pose-report/1 (--report), and a gated build (--build) |
For compare: a reference and a render sequence on one time base | compare.json and a compare.png sheet, differences per body unit, worst first |
Depth, projection and feet
The 1.2.1 reference documents these opt-in paths. The recorded swing above did not use them.
- Derived depth:
rig-pose clean --depth walk|runadds each limb segment's foreshortening ratio and a gait-derived sign. It estimates depth from 2D joint lengths and body orientation; it does not read which limb the picture draws in front at a crossing. A side-on frame can leave the sign undecided. - Draw order:
rig-pose retarget --draw-order depthkeys the legs' order from that depth, using the ankle for a walk and knee for a run. Ordering a forearm against the trunk also requires the rig'slayout.jsonand an explicit map binding. The flag refuses a sequence without depth; it does not invent a target layer from a part's name. - Foreshortening:
--leg-scale <min,max>scales mapped leg segments along their bones, and the trunk when its projected length changes, within declared bounds. This matches projected lengths; it does not rotate a 3D body. - Feet:
--plant-feetadjusts the hip to hold support on one floor;--stance <leg lengths>can bring a nearby free foot onto it. Bounds can leave a residual that the report names. Separately,--depth-scale <min,max>scales foot bones uniformly about their ankles from derived depth; its walk sign assumes a camera above the feet and uses picture-y ankle lead. It cannot recover absolute camera distance or guarantee the correct scale order at every crossing.
See derived depth, depth-based draw order and foreshortening and planted feet for the contracts and refusal codes.
Limits
- 1.x has a CLI contract, not the old 0.x prototype status. The supported surface is
rig-pose; the package exports no importable API. - The input is joint positions, not video. Pose extraction and camera fitting from pixels happen outside the shipped CLI; without a declared camera, the picture is read as a fixed camera.
- It remains a 2D retarget. Depth signs and draw-order keys are constrained inferences. Large turns and intense motion on a designed character can need replacement drawings declared in the map; a green structural gate does not supply missing art.
- No eyelid, mouth or finger keys. Body-18 has no hand points; head yaw/pitch inference does not provide expressions or lip-sync.
Go deeper
- Try it — a self-contained wave example in the repository
- Clean first:
rig-pose clean - What it does
- The pose:
rig-pose-sequence/1 - The map:
rig-pose-map/1 - Compare: the rig's render against the video
- What it does not do
- npm · CHANGELOG