Skip to content

Motion capture for any creature from one AI video: two cameras in one frame, a DINOv2 joint reader, the rig fitted in both views, a GLB out.

diptych: motion capture for any creature from one AI video

rehan-remadea27c27b0e3ba
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
new file mode 100644
index 0000000..46a3267
--- /dev/null
+++ b/.claude-plugin/marketplace.json
@@ -0,0 +1,17 @@
+{
+ "name": "diptych",
+ "description": "diptych by Patch: motion capture for any creature from one AI video.",
+ "owner": {
+ "name": "Patch",
+ "url": "https://patch.gg"
+ },
+ "plugins": [
+ {
+ "name": "diptych",
+ "source": "./",
+ "description": "Skills to rig a creature, film it with two cameras in one AI clip, train its joint reader, capture the move as a GLB, and train the MiniMax H3 LoRA.",
+ "category": "gamedev",
+ "tags": ["animation", "motion-capture", "creature", "blender"]
+ }
+ ]
+}
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
new file mode 100644
index 0000000..9d22013
--- /dev/null
+++ b/.claude-plugin/plugin.json
@@ -0,0 +1,14 @@
+{
+ "name": "diptych",
+ "displayName": "diptych",
+ "version": "0.1.0",
+ "description": "Motion capture for any creature from one AI video: two cameras in one frame, a DINOv2 joint reader trained on the creature, the rig fitted in both views, a GLB out. Skills for rigging, filming, training, capturing and the H3 LoRA.",
+ "author": {
+ "name": "Patch",
+ "url": "https://patch.gg"
+ },
+ "homepage": "https://github.com/Patch-gg/diptych",
+ "repository": "https://github.com/Patch-gg/diptych",
+ "license": "Apache-2.0",
+ "keywords": ["animation", "motion-capture", "mocap", "creature", "rigging", "blender", "dinov2", "video-generation", "gamedev"]
+}
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..3479dc4
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,2 @@
+# Copy to .env (git ignores it) or export it. Used by mocap/fal.py for video generation and LoRA training on fal.ai.
+FAL_KEY=
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2814013
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+# keys
+.env
+# Python
+.venv/
+__pycache__/
+*.pyc
+# everything the pipeline writes: datasets, readers, clips, renders, fal log
+runs/
+# meshes and built rigs (meshes come from tools/fetch_examples.sh or your own generator; rigs from tools/rig.sh)
+assets/*/model.glb
+assets/*/prep/
+assets/*/rigged/*.blend
+assets/*/rigged/*.blend1
+assets/*/rigged/testpose*.png
+*.part
+# Patch's brand kit (Patch Pixel is Patch's own typeface): link or copy it here to rebuild the README art
+brand-kit
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..826e78c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,186 @@
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="docs/readme/header-evening.png">
+ <img alt="patch. diptych. any creature. any move." src="docs/readme/header-day.png" width="800">
+</picture>
+
+<br><br>
+
+<img alt="A dragon roars; an AI video shows it from the front and the side at once; every joint is found in both views; the two views stand up as walls and pin each joint in 3D; the rig lands on the points; a fire demon, a spider and a wolf move the same way." src="docs/diptych.gif" width="800">
+
+**@patch_gg** · dragon, giant spider, fire demon, wolf · one AI clip per move, $0.26 each, read and fitted in under
+a minute.
+
+diptych turns one AI video into an animation for any rigged creature, wings, tails and eight legs included. A video
+model films the creature from two cameras in one frame, front on the left and side on the right. A joint reader
+trained on that one creature finds every joint in both views. A joint sits at the same height in both, so the pair
+pins it in 3D, and the rig is fitted to those joints frame by frame and exported as a GLB.
+
+The method is [@CanItCode](https://www.youtube.com/watch?v=AS92HYsEBqo)'s; the MiniMax H3 LoRA step is
+[@Graalitoo](https://x.com/Graalitoo/status/2112548557576380659)'s idea. This repo is our working version of both, with
+the agent skills to run it.
+
+## how it works.
+
+| | |
+|---|---|
+| <img src="docs/steps/step-1.png" width="320" alt="A concept picture of a dragon, an arrow, and the textured 3D model it became."> | **1 · a 3d model.**<br>One picture becomes a textured mesh at real size.<br><sub><picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/bfl-white.png"><img src="docs/readme/marks/bfl-black.png" height="14" alt=""></picture> flux 3 picture, <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/tripo-white.png"><img src="docs/readme/marks/tripo-black.png" height="14" alt=""></picture> tripo h3.1 mesh · $0.40</sub> |
+| <img src="docs/steps/step-2.png" width="320" alt="The dragon as a faint x-ray with its white skeleton inside."> | **2 · a skeleton.**<br>Bones placed on grid views, skinned in <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/blender-white.png"><img src="docs/readme/marks/blender-black.png" height="14" alt=""></picture> Blender.<br><sub>42 bones: legs, wings, tail</sub> |
+| <img src="docs/steps/step-3.png" width="320" alt="The dragon with each leg and wing painted its own colour, the right wing labelled."> | **3 · limb colours.**<br>Every limb its own colour, so left and right never swap.<br><sub>6 limbs, 6 colours</sub> |
+| <img src="docs/steps/step-4.png" width="320" alt="The dragon from above, one camera at its face and one at its right flank."> | **4 · two cameras.**<br>One camera at the front, one at the side, both views in one frame; a video model animates both at once from a prompt.<br><sub><picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/minimax-white.png"><img src="docs/readme/marks/minimax-black.png" height="14" alt=""></picture> minimax h3 max on <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/fal-white.png"><img src="docs/readme/marks/fal-black.png" height="14" alt=""></picture> fal · 5 s, $0.26</sub> |
+| <img src="docs/steps/step-5.png" width="320" alt="A random training pose of the dragon in both views with its true joints drawn on."> | **5 · teach a reader.**<br>A vision model learns this one dragon from random poses whose joints are known; its average miss falls from 40 px to 6 px.<br><sub><picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/meta-white.png"><img src="docs/readme/marks/meta-black.png" height="14" alt=""></picture> dinov2 · 2,200 poses · 20 min on one gpu</sub> |
+| <img src="docs/steps/step-6.png" width="320" alt="The AI clip with a white skeleton drawn over the dragon in both views."> | **6 · read every joint.**<br>The reader finds every joint in both views, in every frame.<br><sub>50 joints · 10 s a clip</sub> |
+| <img src="docs/steps/step-7.png" width="320" alt="The two views stood up as walls at a right angle, the nose ringed on both, and the two lines meeting at the nose in 3D."> | **7 · two views, 3d.**<br>Stand the two views up as walls at a right angle: each joint is where its two lines meet. The front gives side to side, the side gives nose to tail.<br><sub>x from the front, y from the side, z from both</sub> |
+| <img src="docs/steps/step-8.png" width="320" alt="The rig as an x-ray, its bones landed on the 3D points, stray points in grey."> | **8 · the rig follows.**<br>The rig bends its bones onto the points, ignores the strays, and exports for any engine.<br><sub>glb, 24 fps, no hand edits · under a minute a clip</sub> |
+
+[docs/PIPELINE.md](docs/PIPELINE.md) has the file-by-file version.
+
+## quick start.
+
+You need an NVIDIA GPU with CUDA (24 GB to train a reader; reading and fitting need much less), Python 3.11,
+[Blender](https://www.blender.org) 5.x on your `PATH` (or `BLENDER=/path/to/blender`), and a [fal](https://fal.ai) key
+to make new clips.
+
+```bash
+git clone https://github.com/Patch-gg/diptych && cd diptych
+python3.11 -m venv .venv
+.venv/bin/pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cu128
+.venv/bin/pip install -r requirements.txt
+cp .env.example .env # then add your FAL_KEY; git ignores .env
+```
+
+Fit the dragon's roar on the CPU, no Blender or downloads needed. The repo carries the joints its reader found in the
+clip; this fits the rig to them (about 20 seconds) and prints how well the two views agree:
+
+```bash
+mkdir -p runs/dragon/clips/roar
+MOCAP_CREATURE=assets/dragon .venv/bin/python -m mocap.solve examples/dragon_roar/det.npz \
+ assets/dragon/rigged/rig_info.json runs/dragon/clips/roar/motion.json
+```
+
+The whole capture, from the AI clip to a GLB, with an example creature's mesh, trained reader and clip from the
+[release](https://github.com/Patch-gg/diptych/releases/tag/examples-v1) (13 MB mesh, 355 MB reader, 4 MB clip):
+
+```bash
+tools/fetch_examples.sh dragon --readers --clips
+tools/prep.sh dragon && tools/rig.sh dragon # real size, skeleton, skin, limb paint, reference frame
+tools/capture.sh dragon runs/dragon/videos/roar/s1/h3max.mp4 roar
+# runs/dragon/clips/roar/render/animation.glb, and showcase.mp4 to compare it with the clip
+```
+
+A new move for the same dragon (two clips, about $0.52 on fal):
+
+```bash
+.venv/bin/python tools/make_prompt.py assets/dragon "the dragon whips its tail from side to side, then stands still." prompts/dragon/tailwhip.txt
+tools/film.sh dragon tailwhip h3max 1,2
+tools/capture.sh dragon runs/dragon/videos/tailwhip/s1/h3max.mp4 tailwhip
+```
+
+## your own creature.
+
+Copy the closest example in `assets/` (wolf: four legs; dragon: four legs and wings; spider: eight legs; demon: two
+legs, two arms, wings and a tail), put your mesh at `assets/<name>/model.glb`, and work through:
+
+```bash
+tools/prep.sh <name> # set "prep" in creature.json first: real size, facing -Y
+# place joints in assets/<name>/rig.json on the grid views; check with: tools/rig.sh <name> preview
+tools/rig.sh <name> # build, skin, paint, reference frame
+tools/dataset.sh <name> # 2,200 random poses, about 25 min
+tools/train.sh <name> # the joint reader, about 20 min
+tools/film.sh <name> <move> # after tools/make_prompt.py writes prompts/<name>/<move>.txt
+tools/capture.sh <name> runs/<name>/videos/<move>/s1/h3max.mp4 <move>
+```
+
+The skills below walk an agent (or you) through each step, with the checks that tell a good capture from a bad one.
+
+## agent skills.
+
+diptych is a [Claude Code](https://code.claude.com) plugin and its own marketplace:
+
+```
+/plugin marketplace add Patch-gg/diptych
+/plugin install diptych@diptych
+```
+
+| skill | for |
+|---|---|
+| `diptych` | the method, setup, which step comes next, costs |
+| `diptych-rig` | mesh, facing and scale, placing joints in rig.json, building and painting the rig, framing |
+| `diptych-film` | writing the prompt, generating clips on fal, checking them before capture |
+| `diptych-reader` | rendering the dataset, training the reader, the exam in centimetres |
+| `diptych-capture` | reading, fitting, the quality gates, fixing bad fits, showcase renders |
+| `diptych-lora` | training and testing the MiniMax H3 LoRA on fal |
+
+They're plain [Agent Skills](https://agentskills.io) (`skills/<name>/SKILL.md`), so other agents can load them from that
+folder too.
+
+## results.
+
+| creature | skeleton | reader error, front / side (px) | how well the views agree (1 = same footfalls) |
+|---|---|---|---|
+| wolf, 1.6 m | 30 bones, 36 joints | 6.9 / 3.8 | trot 0.94 · exam: 0.94 cm mean 3D joint error |
+| dragon, 3 m | 42 bones, 50 joints, wings | 6.2 / 5.5 | take off 1.00, roar 0.93, swipe 0.85, walk 0.81 |
+| giant spider, 2.4 m span | 28 bones, 40 joints, 8 legs | 2.9 / 3.6 | rear up 0.99, bite 0.96, pounce 0.89 |
+| fire demon, 3.6 m | 38 bones, 46 joints, wings, tail | 8.4 / 9.4 | wing beat 0.99, slam 0.84, roar 0.73 (feet planted) |
+
+Reader error is the held-out mean on the 720-row frame; the demon stands 412 px tall, so its 8.4 px is about 2% of its
+height. Every clip in the table is MiniMax H3 Max. The exam renders a made-up motion with known joints in the same
+studio and reads it back.
+
+## what it costs.
+
+| | |
+|---|---|
+| a mesh, Tripo H3.1 with HD texture | $0.40 |
+| a 5 s two-camera clip, MiniMax H3 Max | about $0.26 (H3: $0.30) |
+| training renders, 2,200 poses x 2 views | about 25 min on one RTX 4090 |
+| the joint reader, 20 epochs | 17-20 min, 12 GB |
+| reading a clip / fitting it | 10 s / under a minute (20 s for the dragon's roar on a CPU) |
+| the H3 LoRA, 1,200 steps on fal | about $12, about 2 h |
+
+Prices on fal as of October 2026.
+
+## limits.
+
+- **Eight-legged walking doesn't fit.** The two views disagree about which legs are up (0.36-0.49). Big single
+ gestures work best: rearing, roaring, slamming, taking off, pouncing.
+- **Lying down doesn't fit.** The reader learns from random poses inside the joint limits, which don't include lying on
+ a side; the wolf's death and lie-down clips failed.
+- **Skeletons are placed by hand** on grid views (`tools/prep.sh`, `tools/rig.sh preview`). UniRig could do it; its
+ install pulls prebuilt flash-attn wheels.
+- **Video models drift.** Plain MiniMax H3 swapped the limb colours on 2 of 5 wolf clips; with the LoRA, 0 of 5 (one
+ seed per move: a first read, not a benchmark). Seedance 2.5 played the views out of step on a trot.
+- **The LoRA's data is AI-derived.** Its training clips re-render motions solved from AI clips, so the halves are in
+ sync by construction but the motion itself is AI-made. Real dog mocap exists (AI4Animation) under a non-commercial
+ licence.
+- **Ground contact is wolf- and dragon-shaped.** The solver's ground term knows paw names `fpaw`, `ftoe`, `hpaw`,
+ `htoe`; other creatures fit without it.
+- **Fur and cloth** need extra bones: springs (`apply_motion.py --springs`) or tracked tips (the wolf's tracked fur read
+ 7-28° swings from the video).
+
+## licence.
+
+Apache-2.0, see [LICENSE](LICENSE). The Patch name, mark, wordmark and Patch Pixel belong to Patch and aren't covered
+by it. Other companies' marks in this README belong to their owners and are shown only to credit their tools (icons
+from [lobe-icons](https://github.com/lobehub/lobe-icons), MIT, and [Simple Icons](https://simpleicons.org), CC0).
+MiniMax H3's open weights carry a community licence and hosted use on fal goes through fal's terms: check both before
+shipping what you make with them. The wolf LoRA in the release (`lora-wolf-twocam-h3.safetensors`) is a LoRA on
+MiniMax H3, so MiniMax H3's community licence applies to it, not Apache-2.0.
+
+## credits.
+
+- The two-camera method is [@CanItCode](https://www.youtube.com/watch?v=AS92HYsEBqo)'s, and the H3 LoRA step is
+ [@Graalitoo](https://x.com/Graalitoo/status/2112548557576380659)'s.
+- <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/meta-white.png"><img src="docs/readme/marks/meta-black.png" height="16" alt=""></picture> DINOv2 by Meta (with registers, Apache-2.0) is the reader's backbone.
+- <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/tripo-white.png"><img src="docs/readme/marks/tripo-black.png" height="16" alt=""></picture> Tripo H3.1 made the meshes, from concept pictures by
+ <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/bfl-white.png"><img src="docs/readme/marks/bfl-black.png" height="16" alt=""></picture> Black Forest Labs' FLUX 3.
+- <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/minimax-white.png"><img src="docs/readme/marks/minimax-black.png" height="16" alt=""></picture> MiniMax H3 and H3 Max made the clips, all run on
+ <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/fal-white.png"><img src="docs/readme/marks/fal-black.png" height="16" alt=""></picture> fal.
+- <picture><source media="(prefers-color-scheme: dark)" srcset="docs/readme/marks/blender-white.png"><img src="docs/readme/marks/blender-black.png" height="16" alt=""></picture> Blender rigs, renders and exports everything.
+- Made by [Patch](https://patch.gg) ([@patch_gg](https://x.com/patch_gg)).
+
+<br>
+
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="docs/readme/footer-evening.png">
+ <img alt="patch.gg. Mashups, mods and browser games." src="docs/readme/footer-day.png" width="500">
+</picture>
diff --git a/assets/demon/creature.json b/assets/demon/creature.json
new file mode 100644
index 0000000..2018f9d
--- /dev/null
+++ b/assets/demon/creature.json
@@ -0,0 +1,21 @@
+{
+ "name": "demon",
+ "noun": "fire demon",
+ "prep": {"length_m": 3.6, "rotz_deg": -73, "axis": "z"},
+ "layout": {"W_FRONT": 640, "W_SIDE": 640, "M_PER_PX": 0.0085, "GROUND_V": 640},
+ "paint": {
+ "AL": {"color": "#F53CD1", "bones": ["upperarm_L", "forearm_L", "hand_L"]},
+ "AR": {"color": "#2F6BFF", "bones": ["upperarm_R", "forearm_R", "hand_R"]},
+ "LL": {"color": "#FFD21F", "bones": ["thigh_L", "shin_L", "foot_L", "toe_L"]},
+ "LR": {"color": "#19D3E0", "bones": ["thigh_R", "shin_R", "foot_R", "toe_R"]},
+ "WL": {"color": "#FF7A1A", "bones": ["wing_arm_L", "wing_fore_L", "finger1_L", "finger2_L", "finger3_L"]},
+ "WR": {"color": "#2BD94A", "bones": ["wing_arm_R", "wing_fore_R", "finger1_R", "finger2_R", "finger3_R"]}
+ },
+ "feet": ["ball_L", "ball_R", "handtip_L", "handtip_R"],
+ "describe": "a towering fire demon of charred black obsidian rock with glowing orange lava cracks, curved horns, a long tail",
+ "colour_code": "left arm pink, right arm blue, left leg yellow, right leg cyan, left wing orange, right wing green",
+ "count": "Exactly two arms, two legs, two wings, one tail, one head. No flames, no smoke, no weapon.",
+ "flank": "side",
+ "limbs": "limbs",
+ "camera": {"cam": "-6.4,-7.1,1.8", "target": "0,-0.1,2.1", "lens": 32}
+}
diff --git a/assets/demon/rig.json b/assets/demon/rig.json
new file mode 100644
index 0000000..802624f
--- /dev/null
+++ b/assets/demon/rig.json
@@ -0,0 +1,659 @@
+{
+ "note": "Fire demon (original), metres, faces -Y, its left is +X; symmetric, so _L mirrors to _R.",
+ "joints": {
+ "hips": [
+ 0.03,
+ -0.78,
+ 1.48
+ ],
+ "spine1": [
+ 0.02,
+ -0.82,
+ 1.8
+ ],
+ "spine2": [
+ 0.01,
+ -0.88,
+ 2.1
+ ],
+ "chest": [
+ 0.0,
+ -0.95,
+ 2.4
+ ],
+ "neck": [
+ 0.0,
+ -0.98,
+ 2.7
+ ],
+ "head": [
+ 0.0,
+ -1.05,
+ 2.92
+ ],
+ "head_top": [
+ 0.0,
+ -1.25,
+ 3.18
+ ],
+ "clav_L": [
+ 0.15,
+ -0.95,
+ 2.48
+ ],
+ "shoulder_L": [
+ 0.62,
+ -0.92,
+ 2.45
+ ],
+ "elbow_L": [
+ 0.86,
+ -0.74,
+ 1.92
+ ],
+ "wrist_L": [
+ 0.98,
+ -0.94,
+ 1.4
+ ],
+ "handtip_L": [
+ 1.02,
+ -1.02,
+ 1.05
+ ],
+ "hip_L": [
+ 0.38,
+ -0.8,
+ 1.55
+ ],
+ "knee_L": [
+ 0.42,
+ -0.94,
+ 0.9
+ ],
+ "ankle_L": [
+ 0.48,
+ -0.68,
+ 0.34
+ ],
+ "ball_L": [
+ 0.58,
+ -0.92,
+ 0.08
+ ],
+ "toetip_L": [
+ 0.6,
+ -1.16,
+ 0.04
+ ],
+ "wroot_L": [
+ 0.3,
+ -0.55,
+ 2.7
+ ],
+ "welbow_L": [
+ 0.72,
+ -0.6,
+ 3.05
+ ],
+ "wwrist_L": [
+ 1.1,
+ -0.78,
+ 3.5
+ ],
+ "f1_L": [
+ 2.36,
+ -0.26,
+ 3.3
+ ],
+ "f2_L": [
+ 2.24,
+ -0.08,
+ 2.76
+ ],
+ "f3_L": [
+ 1.75,
+ 0.0,
+ 2.4
+ ],
+ "tail1": [
+ 0.0,
+ -0.45,
+ 1.2
+ ],
+ "tail2": [
+ 0.22,
+ -0.12,
+ 1.12
+ ],
+ "tail3": [
+ 0.4,
+ 0.2,
+ 0.88
+ ],
+ "tail4": [
+ 0.62,
+ 0.5,
+ 0.7
+ ],
+ "tail5": [
+ 0.88,
+ 0.8,
+ 0.68
+ ],
+ "tail6": [
+ 1.1,
+ 1.05,
+ 0.78
+ ],
+ "tail_tip": [
+ 1.36,
+ 1.35,
+ 0.62
+ ]
+ },
+ "bones": [
+ [
+ "pelvis",
+ "hips",
+ "spine1",
+ null
+ ],
+ [
+ "spine1",
+ "spine1",
+ "spine2",
+ "pelvis"
+ ],
+ [
+ "spine2",
+ "spine2",
+ "chest",
+ "spine1"
+ ],
+ [
+ "chest",
+ "chest",
+ "neck",
+ "spine2"
+ ],
+ [
+ "neck",
+ "neck",
+ "head",
+ "chest"
+ ],
+ [
+ "head",
+ "head",
+ "head_top",
+ "neck"
+ ],
+ [
+ "clavicle_L",
+ "clav_L",
+ "shoulder_L",
+ "chest"
+ ],
+ [
+ "upperarm_L",
+ "shoulder_L",
+ "elbow_L",
+ "clavicle_L"
+ ],
+ [
+ "forearm_L",
+ "elbow_L",
+ "wrist_L",
+ "upperarm_L"
+ ],
+ [
+ "hand_L",
+ "wrist_L",
+ "handtip_L",
+ "forearm_L"
+ ],
+ [
+ "thigh_L",
+ "hip_L",
+ "knee_L",
+ "pelvis"
+ ],
+ [
+ "shin_L",
+ "knee_L",
+ "ankle_L",
+ "thigh_L"
+ ],
+ [
+ "foot_L",
+ "ankle_L",
+ "ball_L",
+ "shin_L"
+ ],
+ [
+ "toe_L",
+ "ball_L",
+ "toetip_L",
+ "foot_L"
+ ],
+ [
+ "wing_arm_L",
+ "wroot_L",
+ "welbow_L",
+ "chest"
+ ],
+ [
+ "wing_fore_L",
+ "welbow_L",
+ "wwrist_L",
+ "wing_arm_L"
+ ],
+ [
+ "finger1_L",
+ "wwrist_L",
+ "f1_L",
+ "wing_fore_L"
+ ],
+ [
+ "finger2_L",
+ "wwrist_L",
+ "f2_L",
+ "wing_fore_L"
+ ],
+ [
+ "finger3_L",
+ "wwrist_L",
+ "f3_L",
+ "wing_fore_L"
+ ],
+ [
+ "tail1",
+ "tail1",
+ "tail2",
+ "pelvis"
+ ],
+ [
+ "tail2",
+ "tail2",
+ "tail3",
+ "tail1"
+ ],
+ [
+ "tail3",
+ "tail3",
+ "tail4",
+ "tail2"
+ ],
+ [
+ "tail4",
+ "tail4",
+ "tail5",
+ "tail3"
+ ],
+ [
+ "tail5",
+ "tail5",
+ "tail6",
+ "tail4"
+ ],
+ [
+ "tail6",
+ "tail6",
+ "tail_tip",
+ "tail5"
+ ]
+ ],
+ "limits_deg": {
+ "pelvis": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "spine1": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "spine2": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "chest": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "neck": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "head": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "clavicle": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -20,
+ 20
+ ]
+ ],
+ "upperarm": [
+ [
+ -90,
+ 90
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -80,
+ 40
+ ]
+ ],
+ "forearm": [
+ [
+ -140,
+ 10
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "hand": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "thigh": [
+ [
+ -110,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "shin": [
+ [
+ -10,
+ 140
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "foot": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -20,
+ 20
+ ]
+ ],
+ "toe": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ],
+ "wing_arm": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -70,
+ 70
+ ]
+ ],
+ "wing_fore": [
+ [
+ -70,
+ 70
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -70,
+ 70
+ ]
+ ],
+ "finger1": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "finger2": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "finger3": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "tail1": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail2": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail3": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail4": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail5": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail6": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ }
+}
\ No newline at end of file
diff --git a/assets/demon/rigged/rig_info.json b/assets/demon/rigged/rig_info.json
new file mode 100644
index 0000000..d119d06
--- /dev/null
+++ b/assets/demon/rigged/rig_info.json
@@ -0,0 +1,2262 @@
+{
+ "bones": [
+ {
+ "name": "pelvis",
+ "parent": -1,
+ "matrix_local": [
+ [
+ 0.9995195865631104,
+ -0.03099379502236843,
+ 3.3178366720676422e-09,
+ 0.029999999329447746
+ ],
+ [
+ -0.0038443063385784626,
+ -0.1239752396941185,
+ -0.9922778606414795,
+ -0.7799999713897705
+ ],
+ [
+ 0.030754454433918,
+ 0.9918011426925659,
+ -0.1240348219871521,
+ 1.4800000190734863
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.32264524698257446,
+ "head_joint": "hips",
+ "tail_joint": "spine1",
+ "limits_deg": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "spine1",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9994663000106812,
+ -0.0326685756444931,
+ -3.67592889460866e-09,
+ 0.019999999552965164
+ ],
+ [
+ -0.006406839936971664,
+ -0.196011483669281,
+ -0.9805806279182434,
+ -0.8199999928474426
+ ],
+ [
+ 0.03203417360782623,
+ 0.9800572395324707,
+ -0.1961161494255066,
+ 1.7999999523162842
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3061045706272125,
+ "head_joint": "spine1",
+ "tail_joint": "spine2",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "spine2",
+ "parent": 1,
+ "matrix_local": [
+ [
+ 0.9994736313819885,
+ -0.032444264739751816,
+ 5.122413604397025e-11,
+ 0.009999998845160007
+ ],
+ [
+ -0.007372292689979076,
+ -0.22710980474948883,
+ -0.9738411903381348,
+ -0.8799999952316284
+ ],
+ [
+ 0.031595561653375626,
+ 0.9733285307884216,
+ -0.22722941637039185,
+ 2.0999999046325684
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.30822089314460754,
+ "head_joint": "spine2",
+ "tail_joint": "chest",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "chest",
+ "parent": 2,
+ "matrix_local": [
+ [
+ 1.0000001192092896,
+ -6.618200345392955e-12,
+ 8.293850584095708e-08,
+ -1.862645149230957e-09
+ ],
+ [
+ 8.006360729950757e-08,
+ -0.09950380027294159,
+ -0.9950370788574219,
+ -0.949999988079071
+ ],
+ [
+ 1.1013604250820208e-08,
+ 0.9950370788574219,
+ -0.09950381517410278,
+ 2.4000000953674316
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3014962077140808,
+ "head_joint": "chest",
+ "tail_joint": "neck",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "neck",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 1.0000001192092896,
+ 0.0,
+ 1.3328003944934608e-07,
+ -1.8646404420508134e-09
+ ],
+ [
+ 1.2454336228984175e-07,
+ -0.3032033145427704,
+ -0.9529257416725159,
+ -0.9800000190734863
+ ],
+ [
+ 4.3165272245460073e-08,
+ 0.9529257416725159,
+ -0.3032033443450928,
+ 2.700000047683716
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.23086796700954437,
+ "head_joint": "neck",
+ "tail_joint": "head",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "head",
+ "parent": 4,
+ "matrix_local": [
+ [
+ 1.0000001192092896,
+ -3.552713678800501e-15,
+ 1.884864389012364e-07,
+ -1.8646404420508134e-09
+ ],
+ [
+ 1.4693621608330432e-07,
+ -0.6097108125686646,
+ -0.7926238179206848,
+ -1.0499999523162842
+ ],
+ [
+ 1.1767652097205428e-07,
+ 0.7926238179206848,
+ -0.6097108125686646,
+ 2.9200000762939453
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3280244469642639,
+ "head_joint": "head",
+ "tail_joint": "head_top",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "clavicle_L",
+ "parent": 3,
+ "matrix_local": [
+ [
+ -0.06370015442371368,
+ 0.9959506392478943,
+ -0.0634421855211258,
+ 0.15000000596046448
+ ],
+ [
+ 0.9979689717292786,
+ 0.0635712668299675,
+ -0.004049636423587799,
+ -0.949999988079071
+ ],
+ [
+ -1.341104507446289e-07,
+ -0.0635712742805481,
+ -0.9979772567749023,
+ 2.4800000190734863
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4719109833240509,
+ "head_joint": "clav_L",
+ "tail_joint": "shoulder_L",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -20,
+ 20
+ ]
+ ]
+ },
+ {
+ "name": "clavicle_R",
+ "parent": 3,
+ "matrix_local": [
+ [
+ -0.06370016187429428,
+ -0.9959506988525391,
+ 0.0634421780705452,
+ -0.15000000596046448
+ ],
+ [
+ -0.9979689717292786,
+ 0.0635712519288063,
+ -0.00404965877532959,
+ -0.949999988079071
+ ],
+ [
+ 1.6391277313232422e-07,
+ -0.0635712742805481,
+ -0.9979772567749023,
+ 2.4800000190734863
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4719109833240509,
+ "head_joint": "clav_R",
+ "tail_joint": "shoulder_R",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -20,
+ 20
+ ]
+ ]
+ },
+ {
+ "name": "upperarm_L",
+ "parent": 6,
+ "matrix_local": [
+ [
+ 0.9190768599510193,
+ 0.39407846331596375,
+ -1.1548399925231934e-07,
+ 0.6200000643730164
+ ],
+ [
+ -0.12672853469848633,
+ 0.2955588698387146,
+ 0.9468815326690674,
+ -0.9200000166893005
+ ],
+ [
+ 0.3731456398963928,
+ -0.8702567219734192,
+ 0.32158228754997253,
+ 2.450000047683716
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.609015703201294,
+ "head_joint": "shoulder_L",
+ "tail_joint": "elbow_L",
+ "limits_deg": [
+ [
+ -90,
+ 90
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -80,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "upperarm_R",
+ "parent": 7,
+ "matrix_local": [
+ [
+ 0.9190769791603088,
+ -0.3940785825252533,
+ 2.3096799850463867e-07,
+ -0.6200001239776611
+ ],
+ [
+ 0.12672848999500275,
+ 0.29555895924568176,
+ 0.9468815922737122,
+ -0.9200000166893005
+ ],
+ [
+ -0.37314572930336,
+ -0.8702569603919983,
+ 0.3215823471546173,
+ 2.450000047683716
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.609015703201294,
+ "head_joint": "shoulder_R",
+ "tail_joint": "elbow_R",
+ "limits_deg": [
+ [
+ -90,
+ 90
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -80,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "forearm_L",
+ "parent": 8,
+ "matrix_local": [
+ [
+ 0.9775813221931458,
+ 0.2105587273836136,
+ -7.382826083812688e-08,
+ 0.8600000143051147
+ ],
+ [
+ 0.0755862444639206,
+ -0.3509311079978943,
+ 0.9333455562591553,
+ -0.7400000095367432
+ ],
+ [
+ 0.19652408361434937,
+ -0.9124209880828857,
+ -0.35897892713546753,
+ 1.9200000762939453
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.569912314414978,
+ "head_joint": "elbow_L",
+ "tail_joint": "wrist_L",
+ "limits_deg": [
+ [
+ -140,
+ 10
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "forearm_R",
+ "parent": 9,
+ "matrix_local": [
+ [
+ 0.9775814414024353,
+ -0.21055877208709717,
+ -1.3550902622228023e-09,
+ -0.8600001335144043
+ ],
+ [
+ -0.07558615505695343,
+ -0.35093116760253906,
+ 0.9333456754684448,
+ -0.7399999499320984
+ ],
+ [
+ -0.1965240091085434,
+ -0.9124211668968201,
+ -0.35897910594940186,
+ 1.9199998378753662
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5699122548103333,
+ "head_joint": "elbow_R",
+ "tail_joint": "wrist_R",
+ "limits_deg": [
+ [
+ -140,
+ 10
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "hand_L",
+ "parent": 10,
+ "matrix_local": [
+ [
+ 0.9938509464263916,
+ 0.11072715371847153,
+ 3.288121774858155e-09,
+ 0.9800000190734863
+ ],
+ [
+ 0.024672765284776688,
+ -0.22145448625087738,
+ 0.9748584032058716,
+ -0.9399999380111694
+ ],
+ [
+ 0.10794338583946228,
+ -0.9688637852668762,
+ -0.22282461822032928,
+ 1.4000000953674316
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3612479269504547,
+ "head_joint": "wrist_L",
+ "tail_joint": "handtip_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "hand_R",
+ "parent": 11,
+ "matrix_local": [
+ [
+ 0.9938510656356812,
+ -0.11072719842195511,
+ -2.555574951657036e-08,
+ -0.9800001382827759
+ ],
+ [
+ -0.024672728031873703,
+ -0.22145456075668335,
+ 0.9748585224151611,
+ -0.9399999380111694
+ ],
+ [
+ -0.10794328898191452,
+ -0.9688639640808105,
+ -0.2228248119354248,
+ 1.3999998569488525
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.36124783754348755,
+ "head_joint": "wrist_R",
+ "tail_joint": "handtip_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "thigh_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9981953501701355,
+ 0.06005025655031204,
+ -2.2689537360065515e-08,
+ 0.3800000250339508
+ ],
+ [
+ 0.012644065544009209,
+ -0.21017611026763916,
+ 0.9775823354721069,
+ -0.800000011920929
+ ],
+ [
+ 0.05870402604341507,
+ -0.9758176207542419,
+ -0.2105560302734375,
+ 1.5499999523162842
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6661081314086914,
+ "head_joint": "hip_L",
+ "tail_joint": "knee_L",
+ "limits_deg": [
+ [
+ -110,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "thigh_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9981954097747803,
+ -0.06005031242966652,
+ -3.759069855391317e-08,
+ -0.3800000548362732
+ ],
+ [
+ -0.012644276022911072,
+ -0.21017612516880035,
+ 0.9775825142860413,
+ -0.800000011920929
+ ],
+ [
+ -0.05870409309864044,
+ -0.9758175611495972,
+ -0.2105560004711151,
+ 1.5499999523162842
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6661081314086914,
+ "head_joint": "hip_R",
+ "tail_joint": "knee_R",
+ "limits_deg": [
+ [
+ -110,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "shin_L",
+ "parent": 14,
+ "matrix_local": [
+ [
+ 0.9953112006187439,
+ 0.09672389179468155,
+ 3.4047630492750613e-08,
+ 0.41999998688697815
+ ],
+ [
+ -0.04073146730661392,
+ 0.4191369414329529,
+ 0.907009482383728,
+ -0.940000057220459
+ ],
+ [
+ 0.08772943168878555,
+ -0.9027563333511353,
+ 0.4211110770702362,
+ 0.8999999165534973
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6203223466873169,
+ "head_joint": "knee_L",
+ "tail_joint": "ankle_L",
+ "limits_deg": [
+ [
+ -10,
+ 140
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "shin_R",
+ "parent": 15,
+ "matrix_local": [
+ [
+ 0.9953112602233887,
+ -0.09672390669584274,
+ -5.607471464941227e-08,
+ -0.4200000464916229
+ ],
+ [
+ 0.04073122888803482,
+ 0.4191369414329529,
+ 0.9070097804069519,
+ -0.940000057220459
+ ],
+ [
+ -0.08772943168878555,
+ -0.9027563333511353,
+ 0.42111095786094666,
+ 0.8999999165534973
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6203223466873169,
+ "head_joint": "knee_R",
+ "tail_joint": "ankle_R",
+ "limits_deg": [
+ [
+ -10,
+ 140
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "foot_L",
+ "parent": 16,
+ "matrix_local": [
+ [
+ 0.9623073935508728,
+ 0.2719641625881195,
+ -1.1369309049769072e-07,
+ 0.47999998927116394
+ ],
+ [
+ 0.1844680905342102,
+ -0.6527140140533447,
+ 0.7348040342330933,
+ -0.6800000667572021
+ ],
+ [
+ 0.19984015822410583,
+ -0.7071068286895752,
+ -0.6782799363136292,
+ 0.3399999737739563
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3676954507827759,
+ "head_joint": "ankle_L",
+ "tail_joint": "ball_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -20,
+ 20
+ ]
+ ]
+ },
+ {
+ "name": "foot_R",
+ "parent": 17,
+ "matrix_local": [
+ [
+ 0.9623074531555176,
+ -0.2719641625881195,
+ 1.872606247843578e-07,
+ -0.4800000488758087
+ ],
+ [
+ -0.18446846306324005,
+ -0.6527141332626343,
+ 0.7348041534423828,
+ -0.6800000667572021
+ ],
+ [
+ -0.19984009861946106,
+ -0.7071068286895752,
+ -0.6782798171043396,
+ 0.3399999737739563
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3676954209804535,
+ "head_joint": "ankle_R",
+ "tail_joint": "ball_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -20,
+ 20
+ ]
+ ]
+ },
+ {
+ "name": "toe_L",
+ "parent": 18,
+ "matrix_local": [
+ [
+ 0.9966385960578918,
+ 0.08192341774702072,
+ -1.494053947226348e-07,
+ 0.5799999833106995
+ ],
+ [
+ 0.08080894500017166,
+ -0.9830785989761353,
+ 0.16439947485923767,
+ -0.9200000762939453
+ ],
+ [
+ 0.013468001037836075,
+ -0.16384652256965637,
+ -0.9863937497138977,
+ 0.08000001311302185
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.244130939245224,
+ "head_joint": "ball_L",
+ "tail_joint": "toetip_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "toe_R",
+ "parent": 19,
+ "matrix_local": [
+ [
+ 0.9966387748718262,
+ -0.08192335814237595,
+ 1.7771054672266473e-07,
+ -0.5800000429153442
+ ],
+ [
+ -0.08080919831991196,
+ -0.9830788969993591,
+ 0.16439920663833618,
+ -0.9200000762939453
+ ],
+ [
+ -0.013467978686094284,
+ -0.16384634375572205,
+ -0.9863937497138977,
+ 0.08000004291534424
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.24413087964057922,
+ "head_joint": "ball_R",
+ "tail_joint": "toetip_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "wing_arm_L",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.6439962983131409,
+ 0.7650287747383118,
+ 9.497203734554205e-08,
+ 0.30000001192092896
+ ],
+ [
+ 0.10819154977798462,
+ -0.09107483923435211,
+ -0.9899492859840393,
+ -0.5499999523162842
+ ],
+ [
+ -0.7573396563529968,
+ 0.6375237107276917,
+ -0.14142149686813354,
+ 2.700000047683716
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5489990711212158,
+ "head_joint": "wroot_L",
+ "tail_joint": "welbow_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "wing_arm_R",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.6439962983131409,
+ -0.7650287747383118,
+ -8.104793636221075e-08,
+ -0.30000001192092896
+ ],
+ [
+ -0.10819154977798462,
+ -0.0910748615860939,
+ -0.9899493455886841,
+ -0.550000011920929
+ ],
+ [
+ 0.757339596748352,
+ 0.6375237703323364,
+ -0.14142151176929474,
+ 2.700000047683716
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.548999011516571,
+ "head_joint": "wroot_R",
+ "tail_joint": "welbow_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "wing_fore_L",
+ "parent": 22,
+ "matrix_local": [
+ [
+ 0.7869555950164795,
+ 0.6170099377632141,
+ 4.0127197564743255e-08,
+ 0.7200000882148743
+ ],
+ [
+ 0.229151651263237,
+ -0.2922677993774414,
+ -0.9284765720367432,
+ -0.5999999642372131
+ ],
+ [
+ -0.5728792548179626,
+ 0.7306697368621826,
+ -0.37139061093330383,
+ 3.049999952316284
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.615873396396637,
+ "head_joint": "welbow_L",
+ "tail_joint": "wwrist_L",
+ "limits_deg": [
+ [
+ -70,
+ 70
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "wing_fore_R",
+ "parent": 23,
+ "matrix_local": [
+ [
+ 0.7869555354118347,
+ -0.6170098781585693,
+ -1.1696435819885664e-08,
+ -0.7200000286102295
+ ],
+ [
+ -0.2291516363620758,
+ -0.2922677993774414,
+ -0.9284766316413879,
+ -0.6000000238418579
+ ],
+ [
+ 0.5728791952133179,
+ 0.7306697368621826,
+ -0.37139058113098145,
+ 3.049999952316284
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6158733367919922,
+ "head_joint": "welbow_R",
+ "tail_joint": "wwrist_R",
+ "limits_deg": [
+ [
+ -70,
+ 70
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "finger1_L",
+ "parent": 24,
+ "matrix_local": [
+ [
+ -0.3814878761768341,
+ 0.9145817756652832,
+ -0.13419298827648163,
+ 1.1000001430511475
+ ],
+ [
+ 0.9243736863136292,
+ 0.3774464726448059,
+ -0.055381208658218384,
+ -0.7799999117851257
+ ],
+ [
+ 8.940696716308594e-08,
+ -0.14517182111740112,
+ -0.9894064664840698,
+ 3.5
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.3776791095733643,
+ "head_joint": "wwrist_L",
+ "tail_joint": "f1_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger1_R",
+ "parent": 25,
+ "matrix_local": [
+ [
+ -0.38148778676986694,
+ -0.9145816564559937,
+ 0.13419297337532043,
+ -1.0999999046325684
+ ],
+ [
+ -0.9243737459182739,
+ 0.3774464726448059,
+ -0.05538126826286316,
+ -0.7799999713897705
+ ],
+ [
+ -5.960464477539063e-08,
+ -0.14517176151275635,
+ -0.989406406879425,
+ 3.5
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.3776789903640747,
+ "head_joint": "wwrist_R",
+ "tail_joint": "f1_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger2_L",
+ "parent": 24,
+ "matrix_local": [
+ [
+ 0.6662959456443787,
+ 0.7456875443458557,
+ -1.1181320758169022e-07,
+ 1.1000001430511475
+ ],
+ [
+ -0.5124361515045166,
+ 0.4578782320022583,
+ 0.7264683246612549,
+ -0.7799999117851257
+ ],
+ [
+ 0.5417183637619019,
+ -0.4840427041053772,
+ 0.6871997714042664,
+ 3.5
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.5287904739379883,
+ "head_joint": "wwrist_L",
+ "tail_joint": "f2_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger2_R",
+ "parent": 25,
+ "matrix_local": [
+ [
+ 0.6662958860397339,
+ -0.7456874251365662,
+ 1.087451018122465e-08,
+ -1.0999999046325684
+ ],
+ [
+ 0.5124360918998718,
+ 0.4578781723976135,
+ 0.7264683246612549,
+ -0.7799999713897705
+ ],
+ [
+ -0.5417182445526123,
+ -0.4840427339076996,
+ 0.6871997117996216,
+ 3.5
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.5287904739379883,
+ "head_joint": "wwrist_R",
+ "tail_joint": "f2_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger3_L",
+ "parent": 24,
+ "matrix_local": [
+ [
+ 0.9008108377456665,
+ 0.4342122972011566,
+ 6.529598550741866e-08,
+ 1.1000001430511475
+ ],
+ [
+ -0.2511608898639679,
+ 0.521054744720459,
+ 0.8157326579093933,
+ -0.7799999117851257
+ ],
+ [
+ 0.35420098900794983,
+ -0.7348207235336304,
+ 0.5784288644790649,
+ 3.5
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.4969637393951416,
+ "head_joint": "wwrist_L",
+ "tail_joint": "f3_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger3_R",
+ "parent": 25,
+ "matrix_local": [
+ [
+ 0.9008105993270874,
+ -0.43421226739883423,
+ 1.1567954061320052e-07,
+ -1.0999999046325684
+ ],
+ [
+ 0.2511606812477112,
+ 0.5210546255111694,
+ 0.8157327771186829,
+ -0.7799999713897705
+ ],
+ [
+ -0.354201078414917,
+ -0.734820544719696,
+ 0.5784287452697754,
+ 3.5
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.496963620185852,
+ "head_joint": "wwrist_R",
+ "tail_joint": "f3_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "tail1",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.83924800157547,
+ 0.5437488555908203,
+ 3.048937813332486e-08,
+ 0.0
+ ],
+ [
+ -0.5284424424171448,
+ 0.8156232833862305,
+ 0.2356002926826477,
+ -0.44999995827674866
+ ],
+ [
+ 0.1281072199344635,
+ -0.19772690534591675,
+ 0.9718500971794128,
+ 1.1999999284744263
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.404598593711853,
+ "head_joint": "tail1",
+ "tail_joint": "tail2",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail2",
+ "parent": 32,
+ "matrix_local": [
+ [
+ 0.911921501159668,
+ 0.41036468744277954,
+ 1.1742183403384843e-07,
+ 0.2200000286102295
+ ],
+ [
+ -0.3282918632030487,
+ 0.7295371294021606,
+ 0.6000002026557922,
+ -0.11999991536140442
+ ],
+ [
+ 0.2462186962366104,
+ -0.5471529364585876,
+ 0.8000000715255737,
+ 1.119999885559082
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4386342763900757,
+ "head_joint": "tail2",
+ "tail_joint": "tail3",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail3",
+ "parent": 33,
+ "matrix_local": [
+ [
+ 0.8465387225151062,
+ 0.5323272347450256,
+ -1.358662871098204e-08,
+ 0.40000003576278687
+ ],
+ [
+ -0.4564669728279114,
+ 0.7259008288383484,
+ 0.5144959688186646,
+ 0.2000000774860382
+ ],
+ [
+ 0.27388012409210205,
+ -0.4355405271053314,
+ 0.857492983341217,
+ 0.8799998760223389
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.41327959299087524,
+ "head_joint": "tail3",
+ "tail_joint": "tail4",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail4",
+ "parent": 34,
+ "matrix_local": [
+ [
+ 0.7564072012901306,
+ 0.6541009545326233,
+ 1.220208361019104e-07,
+ 0.6200000047683716
+ ],
+ [
+ -0.652652382850647,
+ 0.7547319531440735,
+ 0.06651905179023743,
+ 0.5000001192092896
+ ],
+ [
+ 0.04350993037223816,
+ -0.05031535029411316,
+ 0.997785210609436,
+ 0.6999998688697815
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3974921405315399,
+ "head_joint": "tail4",
+ "tail_joint": "tail5",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail5",
+ "parent": 35,
+ "matrix_local": [
+ [
+ 0.7743828892707825,
+ 0.6327171921730042,
+ 1.2492927226048778e-07,
+ 0.8799999952316284
+ ],
+ [
+ -0.58746337890625,
+ 0.718996524810791,
+ -0.37139052152633667,
+ 0.8000001311302185
+ ],
+ [
+ -0.2349853813648224,
+ 0.2875986099243164,
+ 0.9284766912460327,
+ 0.6799998879432678
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.34770670533180237,
+ "head_joint": "tail5",
+ "tail_joint": "tail6",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail6",
+ "parent": 36,
+ "matrix_local": [
+ [
+ 0.7943578362464905,
+ 0.607450008392334,
+ 1.4011808957548055e-07,
+ 1.100000023841858
+ ],
+ [
+ -0.5359854698181152,
+ 0.7009040713310242,
+ 0.47058823704719543,
+ 1.0500000715255737
+ ],
+ [
+ 0.2858586311340332,
+ -0.37381529808044434,
+ 0.8823531270027161,
+ 0.779999852180481
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.428018718957901,
+ "head_joint": "tail6",
+ "tail_joint": "tail_tip",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ }
+ ],
+ "keypoints": [
+ {
+ "name": "hips",
+ "bone": 0,
+ "end": "head",
+ "rest": [
+ 0.03,
+ -0.78,
+ 1.48
+ ]
+ },
+ {
+ "name": "spine1",
+ "bone": 1,
+ "end": "head",
+ "rest": [
+ 0.02,
+ -0.82,
+ 1.8
+ ]
+ },
+ {
+ "name": "spine2",
+ "bone": 2,
+ "end": "head",
+ "rest": [
+ 0.01,
+ -0.88,
+ 2.1
+ ]
+ },
+ {
+ "name": "chest",
+ "bone": 3,
+ "end": "head",
+ "rest": [
+ 0.0,
+ -0.95,
+ 2.4
+ ]
+ },
+ {
+ "name": "neck",
+ "bone": 4,
+ "end": "head",
+ "rest": [
+ 0.0,
+ -0.98,
+ 2.7
+ ]
+ },
+ {
+ "name": "head",
+ "bone": 5,
+ "end": "head",
+ "rest": [
+ 0.0,
+ -1.05,
+ 2.92
+ ]
+ },
+ {
+ "name": "head_top",
+ "bone": 5,
+ "end": "tail",
+ "rest": [
+ 0.0,
+ -1.25,
+ 3.18
+ ]
+ },
+ {
+ "name": "clav_L",
+ "bone": 6,
+ "end": "head",
+ "rest": [
+ 0.15,
+ -0.95,
+ 2.48
+ ]
+ },
+ {
+ "name": "shoulder_L",
+ "bone": 8,
+ "end": "head",
+ "rest": [
+ 0.62,
+ -0.92,
+ 2.45
+ ]
+ },
+ {
+ "name": "elbow_L",
+ "bone": 10,
+ "end": "head",
+ "rest": [
+ 0.86,
+ -0.74,
+ 1.92
+ ]
+ },
+ {
+ "name": "wrist_L",
+ "bone": 12,
+ "end": "head",
+ "rest": [
+ 0.98,
+ -0.94,
+ 1.4
+ ]
+ },
+ {
+ "name": "handtip_L",
+ "bone": 12,
+ "end": "tail",
+ "rest": [
+ 1.02,
+ -1.02,
+ 1.05
+ ]
+ },
+ {
+ "name": "hip_L",
+ "bone": 14,
+ "end": "head",
+ "rest": [
+ 0.38,
+ -0.8,
+ 1.55
+ ]
+ },
+ {
+ "name": "knee_L",
+ "bone": 16,
+ "end": "head",
+ "rest": [
+ 0.42,
+ -0.94,
+ 0.9
+ ]
+ },
+ {
+ "name": "ankle_L",
+ "bone": 18,
+ "end": "head",
+ "rest": [
+ 0.48,
+ -0.68,
+ 0.34
+ ]
+ },
+ {
+ "name": "ball_L",
+ "bone": 20,
+ "end": "head",
+ "rest": [
+ 0.58,
+ -0.92,
+ 0.08
+ ]
+ },
+ {
+ "name": "toetip_L",
+ "bone": 20,
+ "end": "tail",
+ "rest": [
+ 0.6,
+ -1.16,
+ 0.04
+ ]
+ },
+ {
+ "name": "wroot_L",
+ "bone": 22,
+ "end": "head",
+ "rest": [
+ 0.3,
+ -0.55,
+ 2.7
+ ]
+ },
+ {
+ "name": "welbow_L",
+ "bone": 24,
+ "end": "head",
+ "rest": [
+ 0.72,
+ -0.6,
+ 3.05
+ ]
+ },
+ {
+ "name": "wwrist_L",
+ "bone": 26,
+ "end": "head",
+ "rest": [
+ 1.1,
+ -0.78,
+ 3.5
+ ]
+ },
+ {
+ "name": "f1_L",
+ "bone": 26,
+ "end": "tail",
+ "rest": [
+ 2.36,
+ -0.26,
+ 3.3
+ ]
+ },
+ {
+ "name": "f2_L",
+ "bone": 28,
+ "end": "tail",
+ "rest": [
+ 2.24,
+ -0.08,
+ 2.76
+ ]
+ },
+ {
+ "name": "f3_L",
+ "bone": 30,
+ "end": "tail",
+ "rest": [
+ 1.75,
+ 0.0,
+ 2.4
+ ]
+ },
+ {
+ "name": "tail1",
+ "bone": 32,
+ "end": "head",
+ "rest": [
+ 0.0,
+ -0.45,
+ 1.2
+ ]
+ },
+ {
+ "name": "tail2",
+ "bone": 33,
+ "end": "head",
+ "rest": [
+ 0.22,
+ -0.12,
+ 1.12
+ ]
+ },
+ {
+ "name": "tail3",
+ "bone": 34,
+ "end": "head",
+ "rest": [
+ 0.4,
+ 0.2,
+ 0.88
+ ]
+ },
+ {
+ "name": "tail4",
+ "bone": 35,
+ "end": "head",
+ "rest": [
+ 0.62,
+ 0.5,
+ 0.7
+ ]
+ },
+ {
+ "name": "tail5",
+ "bone": 36,
+ "end": "head",
+ "rest": [
+ 0.88,
+ 0.8,
+ 0.68
+ ]
+ },
+ {
+ "name": "tail6",
+ "bone": 37,
+ "end": "head",
+ "rest": [
+ 1.1,
+ 1.05,
+ 0.78
+ ]
+ },
+ {
+ "name": "tail_tip",
+ "bone": 37,
+ "end": "tail",
+ "rest": [
+ 1.36,
+ 1.35,
+ 0.62
+ ]
+ },
+ {
+ "name": "clav_R",
+ "bone": 7,
+ "end": "head",
+ "rest": [
+ -0.15,
+ -0.95,
+ 2.48
+ ]
+ },
+ {
+ "name": "shoulder_R",
+ "bone": 9,
+ "end": "head",
+ "rest": [
+ -0.62,
+ -0.92,
+ 2.45
+ ]
+ },
+ {
+ "name": "elbow_R",
+ "bone": 11,
+ "end": "head",
+ "rest": [
+ -0.86,
+ -0.74,
+ 1.92
+ ]
+ },
+ {
+ "name": "wrist_R",
+ "bone": 13,
+ "end": "head",
+ "rest": [
+ -0.98,
+ -0.94,
+ 1.4
+ ]
+ },
+ {
+ "name": "handtip_R",
+ "bone": 13,
+ "end": "tail",
+ "rest": [
+ -1.02,
+ -1.02,
+ 1.05
+ ]
+ },
+ {
+ "name": "hip_R",
+ "bone": 15,
+ "end": "head",
+ "rest": [
+ -0.38,
+ -0.8,
+ 1.55
+ ]
+ },
+ {
+ "name": "knee_R",
+ "bone": 17,
+ "end": "head",
+ "rest": [
+ -0.42,
+ -0.94,
+ 0.9
+ ]
+ },
+ {
+ "name": "ankle_R",
+ "bone": 19,
+ "end": "head",
+ "rest": [
+ -0.48,
+ -0.68,
+ 0.34
+ ]
+ },
+ {
+ "name": "ball_R",
+ "bone": 21,
+ "end": "head",
+ "rest": [
+ -0.58,
+ -0.92,
+ 0.08
+ ]
+ },
+ {
+ "name": "toetip_R",
+ "bone": 21,
+ "end": "tail",
+ "rest": [
+ -0.6,
+ -1.16,
+ 0.04
+ ]
+ },
+ {
+ "name": "wroot_R",
+ "bone": 23,
+ "end": "head",
+ "rest": [
+ -0.3,
+ -0.55,
+ 2.7
+ ]
+ },
+ {
+ "name": "welbow_R",
+ "bone": 25,
+ "end": "head",
+ "rest": [
+ -0.72,
+ -0.6,
+ 3.05
+ ]
+ },
+ {
+ "name": "wwrist_R",
+ "bone": 27,
+ "end": "head",
+ "rest": [
+ -1.1,
+ -0.78,
+ 3.5
+ ]
+ },
+ {
+ "name": "f1_R",
+ "bone": 27,
+ "end": "tail",
+ "rest": [
+ -2.36,
+ -0.26,
+ 3.3
+ ]
+ },
+ {
+ "name": "f2_R",
+ "bone": 29,
+ "end": "tail",
+ "rest": [
+ -2.24,
+ -0.08,
+ 2.76
+ ]
+ },
+ {
+ "name": "f3_R",
+ "bone": 31,
+ "end": "tail",
+ "rest": [
+ -1.75,
+ 0.0,
+ 2.4
+ ]
+ }
+ ],
+ "layout": {
+ "H": 720,
+ "W_FRONT": 640,
+ "W_SIDE": 640,
+ "M_PER_PX": 0.0085,
+ "GROUND_V": 640,
+ "Z_CENTER": 2.3800000000000003,
+ "Y_CENTER": 0.0,
+ "X_CENTER": 0.0
+ }
+}
\ No newline at end of file
diff --git a/assets/dragon/creature.json b/assets/dragon/creature.json
new file mode 100644
index 0000000..23c32c5
--- /dev/null
+++ b/assets/dragon/creature.json
@@ -0,0 +1,21 @@
+{
+ "name": "dragon",
+ "noun": "dragon",
+ "prep": {"length_m": 3.0, "rotz_deg": 0, "axis": "y"},
+ "layout": {"W_FRONT": 640, "W_SIDE": 640, "M_PER_PX": 0.006875, "GROUND_V": 630},
+ "paint": {
+ "FL": {"color": "#F53CD1", "bones": ["upperarm_L", "forearm_L", "metacarpus_L", "fpaw_L"]},
+ "FR": {"color": "#2F6BFF", "bones": ["upperarm_R", "forearm_R", "metacarpus_R", "fpaw_R"]},
+ "HL": {"color": "#FFD21F", "bones": ["thigh_L", "shin_L", "metatarsus_L", "hpaw_L"]},
+ "HR": {"color": "#19D3E0", "bones": ["thigh_R", "shin_R", "metatarsus_R", "hpaw_R"]},
+ "WL": {"color": "#FF7A1A", "bones": ["wing_arm_L", "wing_fore_L", "finger1_L", "finger2_L", "finger3_L"]},
+ "WR": {"color": "#2BD94A", "bones": ["wing_arm_R", "wing_fore_R", "finger1_R", "finger2_R", "finger3_R"]}
+ },
+ "feet": ["fpaw_L", "fpaw_R", "hpaw_L", "hpaw_R"],
+ "describe": "a dark charcoal dragon with bone-coloured horns and claws",
+ "colour_code": "front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan, left wing orange, right wing green",
+ "count": "Exactly four legs, two wings, one tail, one head.",
+ "flank": "flank",
+ "limbs": "limbs",
+ "camera": {"cam": "-5.4,-6.0,1.4", "target": "0,-0.3,1.5", "lens": 32}
+}
diff --git a/assets/dragon/rig.json b/assets/dragon/rig.json
new file mode 100644
index 0000000..40f6420
--- /dev/null
+++ b/assets/dragon/rig.json
@@ -0,0 +1,764 @@
+{
+ "note": "Dragon skeleton, metres, faces -Y, its left is +X. Legs and spine mirror _L to _R; the wings are asymmetric, so both sides are given.",
+ "joints": {
+ "hips": [
+ 0,
+ 0.32,
+ 0.86
+ ],
+ "spine1": [
+ 0,
+ 0.05,
+ 0.95
+ ],
+ "spine2": [
+ 0,
+ -0.25,
+ 1.0
+ ],
+ "chest": [
+ 0,
+ -0.55,
+ 1.02
+ ],
+ "neck": [
+ 0,
+ -0.75,
+ 1.18
+ ],
+ "neck2": [
+ 0,
+ -0.84,
+ 1.38
+ ],
+ "neck3": [
+ 0,
+ -0.92,
+ 1.58
+ ],
+ "head": [
+ 0,
+ -1.02,
+ 1.78
+ ],
+ "nose": [
+ 0,
+ -1.38,
+ 1.73
+ ],
+ "tail1": [
+ 0.0,
+ 0.4,
+ 0.78
+ ],
+ "tail2": [
+ 0.05,
+ 0.55,
+ 0.55
+ ],
+ "tail3": [
+ 0.12,
+ 0.72,
+ 0.37
+ ],
+ "tail4": [
+ 0.24,
+ 0.9,
+ 0.23
+ ],
+ "tail5": [
+ 0.39,
+ 1.1,
+ 0.14
+ ],
+ "tail6": [
+ 0.55,
+ 1.3,
+ 0.18
+ ],
+ "tail_tip": [
+ 0.66,
+ 1.45,
+ 0.27
+ ],
+ "scap_L": [
+ 0.14,
+ -0.62,
+ 1.1
+ ],
+ "shoulder_L": [
+ 0.27,
+ -0.92,
+ 0.8
+ ],
+ "elbow_L": [
+ 0.34,
+ -0.74,
+ 0.46
+ ],
+ "wrist_L": [
+ 0.35,
+ -0.9,
+ 0.2
+ ],
+ "fpaw_L": [
+ 0.38,
+ -1.02,
+ 0.08
+ ],
+ "ftoe_L": [
+ 0.38,
+ -1.2,
+ 0.03
+ ],
+ "hip_L": [
+ 0.2,
+ 0.15,
+ 0.8
+ ],
+ "knee_L": [
+ 0.25,
+ -0.12,
+ 0.48
+ ],
+ "hock_L": [
+ 0.27,
+ 0.12,
+ 0.28
+ ],
+ "hpaw_L": [
+ 0.31,
+ -0.02,
+ 0.07
+ ],
+ "htoe_L": [
+ 0.32,
+ -0.22,
+ 0.03
+ ],
+ "wroot_L": [
+ 0.18,
+ -0.5,
+ 1.22
+ ],
+ "welbow_L": [
+ 0.55,
+ -0.45,
+ 1.32
+ ],
+ "wwrist_L": [
+ 0.85,
+ -0.4,
+ 1.82
+ ],
+ "f1_L": [
+ 1.67,
+ 0.2,
+ 1.87
+ ],
+ "f2_L": [
+ 1.45,
+ 0.2,
+ 1.52
+ ],
+ "f3_L": [
+ 1.1,
+ 0.1,
+ 1.24
+ ],
+ "wroot_R": [
+ -0.18,
+ -0.62,
+ 1.22
+ ],
+ "welbow_R": [
+ -0.55,
+ -0.88,
+ 1.32
+ ],
+ "wwrist_R": [
+ -0.8,
+ -1.12,
+ 1.84
+ ],
+ "f1_R": [
+ -1.67,
+ -1.36,
+ 1.86
+ ],
+ "f2_R": [
+ -1.43,
+ -1.06,
+ 1.5
+ ],
+ "f3_R": [
+ -1.12,
+ -0.9,
+ 1.22
+ ]
+ },
+ "bones": [
+ [
+ "pelvis",
+ "hips",
+ "spine1",
+ null
+ ],
+ [
+ "spine1",
+ "spine1",
+ "spine2",
+ "pelvis"
+ ],
+ [
+ "spine2",
+ "spine2",
+ "chest",
+ "spine1"
+ ],
+ [
+ "chest",
+ "chest",
+ "neck",
+ "spine2"
+ ],
+ [
+ "neck1",
+ "neck",
+ "neck2",
+ "chest"
+ ],
+ [
+ "neck2",
+ "neck2",
+ "neck3",
+ "neck1"
+ ],
+ [
+ "neck3",
+ "neck3",
+ "head",
+ "neck2"
+ ],
+ [
+ "head",
+ "head",
+ "nose",
+ "neck3"
+ ],
+ [
+ "tail1",
+ "tail1",
+ "tail2",
+ "pelvis"
+ ],
+ [
+ "tail2",
+ "tail2",
+ "tail3",
+ "tail1"
+ ],
+ [
+ "tail3",
+ "tail3",
+ "tail4",
+ "tail2"
+ ],
+ [
+ "tail4",
+ "tail4",
+ "tail5",
+ "tail3"
+ ],
+ [
+ "tail5",
+ "tail5",
+ "tail6",
+ "tail4"
+ ],
+ [
+ "tail6",
+ "tail6",
+ "tail_tip",
+ "tail5"
+ ],
+ [
+ "scapula_L",
+ "scap_L",
+ "shoulder_L",
+ "chest"
+ ],
+ [
+ "upperarm_L",
+ "shoulder_L",
+ "elbow_L",
+ "scapula_L"
+ ],
+ [
+ "forearm_L",
+ "elbow_L",
+ "wrist_L",
+ "upperarm_L"
+ ],
+ [
+ "metacarpus_L",
+ "wrist_L",
+ "fpaw_L",
+ "forearm_L"
+ ],
+ [
+ "fpaw_L",
+ "fpaw_L",
+ "ftoe_L",
+ "metacarpus_L"
+ ],
+ [
+ "thigh_L",
+ "hip_L",
+ "knee_L",
+ "pelvis"
+ ],
+ [
+ "shin_L",
+ "knee_L",
+ "hock_L",
+ "thigh_L"
+ ],
+ [
+ "metatarsus_L",
+ "hock_L",
+ "hpaw_L",
+ "shin_L"
+ ],
+ [
+ "hpaw_L",
+ "hpaw_L",
+ "htoe_L",
+ "metatarsus_L"
+ ],
+ [
+ "wing_arm_L",
+ "wroot_L",
+ "welbow_L",
+ "chest"
+ ],
+ [
+ "wing_fore_L",
+ "welbow_L",
+ "wwrist_L",
+ "wing_arm_L"
+ ],
+ [
+ "finger1_L",
+ "wwrist_L",
+ "f1_L",
+ "wing_fore_L"
+ ],
+ [
+ "finger2_L",
+ "wwrist_L",
+ "f2_L",
+ "wing_fore_L"
+ ],
+ [
+ "finger3_L",
+ "wwrist_L",
+ "f3_L",
+ "wing_fore_L"
+ ]
+ ],
+ "limits_deg": {
+ "pelvis": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "spine1": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "spine2": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "chest": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "neck1": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "neck2": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "neck3": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "head": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "tail1": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail2": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail3": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail4": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail5": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "tail6": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "scapula": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -8,
+ 8
+ ]
+ ],
+ "upperarm": [
+ [
+ -60,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "forearm": [
+ [
+ -110,
+ 10
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "metacarpus": [
+ [
+ -20,
+ 110
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "fpaw": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ],
+ "thigh": [
+ [
+ -60,
+ 45
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "shin": [
+ [
+ -10,
+ 100
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "metatarsus": [
+ [
+ -90,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "hpaw": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ],
+ "wing_arm": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -70,
+ 70
+ ]
+ ],
+ "wing_fore": [
+ [
+ -70,
+ 70
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -70,
+ 70
+ ]
+ ],
+ "finger1": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "finger2": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "finger3": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ }
+}
\ No newline at end of file
diff --git a/assets/dragon/rigged/rig_info.json b/assets/dragon/rigged/rig_info.json
new file mode 100644
index 0000000..d06f05a
--- /dev/null
+++ b/assets/dragon/rigged/rig_info.json
@@ -0,0 +1,2490 @@
+{
+ "bones": [
+ {
+ "name": "pelvis",
+ "parent": -1,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 6.664004104095511e-08,
+ 0.0
+ ],
+ [
+ 2.1073422118433882e-08,
+ -0.9486833214759827,
+ -0.3162277042865753,
+ 0.3199999928474426
+ ],
+ [
+ 6.322028411887004e-08,
+ 0.3162277042865753,
+ -0.948683500289917,
+ 0.8600000143051147
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2846049666404724,
+ "head_joint": "hips",
+ "tail_joint": "spine1",
+ "limits_deg": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "spine1",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 1.0,
+ 7.105427357601002e-15,
+ 1.6933159940890619e-06,
+ 0.0
+ ],
+ [
+ 2.783795594041294e-07,
+ -0.9863938689231873,
+ -0.16439905762672424,
+ 0.050000011920928955
+ ],
+ [
+ 1.6702769016774255e-06,
+ 0.16439902782440186,
+ -0.9863940477371216,
+ 0.949999988079071
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3041381239891052,
+ "head_joint": "spine1",
+ "tail_joint": "spine2",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "spine2",
+ "parent": 1,
+ "matrix_local": [
+ [
+ 1.0,
+ 1.4210854715202004e-14,
+ 3.405267534617451e-07,
+ 2.161031346681634e-15
+ ],
+ [
+ 2.2651505560133955e-08,
+ -0.9977850914001465,
+ -0.06651897728443146,
+ -0.2499999701976776
+ ],
+ [
+ 3.397726686671376e-07,
+ 0.06651893258094788,
+ -0.9977852702140808,
+ 1.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.300665944814682,
+ "head_joint": "spine2",
+ "tail_joint": "chest",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "chest",
+ "parent": 2,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 2.149075726265437e-07,
+ 6.433751406252023e-15
+ ],
+ [
+ 1.3425167821878858e-07,
+ -0.7808688879013062,
+ -0.6246950030326843,
+ -0.5499999523162842
+ ],
+ [
+ 1.6781474698746024e-07,
+ 0.6246950626373291,
+ -0.7808689475059509,
+ 1.0199999809265137
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.25612494349479675,
+ "head_joint": "chest",
+ "tail_joint": "neck",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "neck1",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 1.1920927533992653e-07,
+ 6.433751406252023e-15
+ ],
+ [
+ 1.087095071738986e-07,
+ -0.4103645384311676,
+ -0.9119216203689575,
+ -0.7499999403953552
+ ],
+ [
+ 4.89193752173378e-08,
+ 0.9119216799736023,
+ -0.41036456823349,
+ 1.1799999475479126
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.21931712329387665,
+ "head_joint": "neck",
+ "tail_joint": "neck2",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "neck2",
+ "parent": 4,
+ "matrix_local": [
+ [
+ 1.0,
+ 4.440892098500626e-16,
+ 5.960465188081798e-08,
+ 6.433751406252023e-15
+ ],
+ [
+ 5.534152336394982e-08,
+ -0.37139078974723816,
+ -0.9284766912460327,
+ -0.8399999141693115
+ ],
+ [
+ 2.2136733335287317e-08,
+ 0.9284767508506775,
+ -0.37139081954956055,
+ 1.3799999952316284
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2154066413640976,
+ "head_joint": "neck2",
+ "tail_joint": "neck3",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "neck3",
+ "parent": 5,
+ "matrix_local": [
+ [
+ 1.0,
+ -1.3322676295501878e-15,
+ 5.960465188081798e-08,
+ 6.5294110721501875e-15
+ ],
+ [
+ 5.331201435865296e-08,
+ -0.44721361994743347,
+ -0.8944272398948669,
+ -0.9199999570846558
+ ],
+ [
+ 2.6656129747948398e-08,
+ 0.8944272994995117,
+ -0.44721364974975586,
+ 1.5800000429153442
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.22360670566558838,
+ "head_joint": "neck3",
+ "tail_joint": "head",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "head",
+ "parent": 6,
+ "matrix_local": [
+ [
+ 1.0,
+ 2.4868995751603507e-14,
+ 1.5488777762584505e-06,
+ 6.231507043502008e-15
+ ],
+ [
+ -2.130763903096522e-07,
+ -0.9904924035072327,
+ 0.1375683844089508,
+ -1.0199999809265137
+ ],
+ [
+ 1.5341518064815318e-06,
+ -0.13756826519966125,
+ -0.9904924035072327,
+ 1.7799999713897705
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3634556233882904,
+ "head_joint": "head",
+ "tail_joint": "nose",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "tail1",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9838229417800903,
+ 0.17914363741874695,
+ -1.2669235616158403e-07,
+ 4.440892098500626e-16
+ ],
+ [
+ -0.09786027669906616,
+ 0.5374309420585632,
+ 0.8376104831695557,
+ 0.4000000059604645
+ ],
+ [
+ 0.1500527560710907,
+ -0.8240604996681213,
+ 0.5462681651115417,
+ 0.7799999713897705
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.27910563349723816,
+ "head_joint": "tail1",
+ "tail_joint": "tail2",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail2",
+ "parent": 8,
+ "matrix_local": [
+ [
+ 0.9622795581817627,
+ 0.2720626890659332,
+ -2.781206376312184e-08,
+ 0.04999999701976776
+ ],
+ [
+ -0.18680457770824432,
+ 0.6607238054275513,
+ 0.727013111114502,
+ 0.550000011920929
+ ],
+ [
+ 0.19779324531555176,
+ -0.6995899081230164,
+ 0.6866238117218018,
+ 0.5500000715255737
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.25729361176490784,
+ "head_joint": "tail2",
+ "tail_joint": "tail3",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail3",
+ "parent": 9,
+ "matrix_local": [
+ [
+ 0.8849477767944336,
+ 0.4656903147697449,
+ -1.6311645367750316e-08,
+ 0.11999998986721039
+ ],
+ [
+ -0.36759355664253235,
+ 0.6985353827476501,
+ 0.6139407157897949,
+ 0.7200000286102295
+ ],
+ [
+ 0.2859063446521759,
+ -0.5433054566383362,
+ 0.7893523573875427,
+ 0.37000006437301636
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2576819360256195,
+ "head_joint": "tail3",
+ "tail_joint": "tail4",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail4",
+ "parent": 10,
+ "matrix_local": [
+ [
+ 0.8254109621047974,
+ 0.5645323991775513,
+ -4.565343658669008e-08,
+ 0.23999997973442078
+ ],
+ [
+ -0.5148090720176697,
+ 0.7527101039886475,
+ 0.41036468744277954,
+ 0.8999999761581421
+ ],
+ [
+ 0.23166421055793762,
+ -0.3387194871902466,
+ 0.9119217395782471,
+ 0.2300000637769699
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2657065987586975,
+ "head_joint": "tail4",
+ "tail_joint": "tail5",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail5",
+ "parent": 11,
+ "matrix_local": [
+ [
+ 0.7867956757545471,
+ 0.6172137260437012,
+ -3.7149728626673095e-08,
+ 0.38999998569488525
+ ],
+ [
+ -0.6052275896072388,
+ 0.771516740322113,
+ -0.1961161196231842,
+ 1.100000023841858
+ ],
+ [
+ -0.1210455596446991,
+ 0.1543034017086029,
+ 0.9805809259414673,
+ 0.14000006020069122
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2592295706272125,
+ "head_joint": "tail5",
+ "tail_joint": "tail6",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "tail6",
+ "parent": 12,
+ "matrix_local": [
+ [
+ 0.8465387225151062,
+ 0.5323272943496704,
+ 5.442150907697396e-08,
+ 0.5500000715255737
+ ],
+ [
+ -0.4564667046070099,
+ 0.725901186466217,
+ -0.5144954919815063,
+ 1.2999999523162842
+ ],
+ [
+ -0.27388009428977966,
+ 0.43554046750068665,
+ 0.8574932813644409,
+ 0.18000006675720215
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2066398411989212,
+ "head_joint": "tail6",
+ "tail_joint": "tail_tip",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "scapula_L",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.956122100353241,
+ 0.2929682433605194,
+ -5.170454642211553e-08,
+ 0.14000000059604645
+ ],
+ [
+ 0.2071598917245865,
+ -0.6760805249214172,
+ 0.7071067690849304,
+ -0.6200000047683716
+ ],
+ [
+ 0.20715981721878052,
+ -0.6760804653167725,
+ -0.7071068286895752,
+ 1.100000023841858
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.44373413920402527,
+ "head_joint": "scap_L",
+ "tail_joint": "shoulder_L",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -8,
+ 8
+ ]
+ ]
+ },
+ {
+ "name": "scapula_R",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.9561222195625305,
+ -0.2929682433605194,
+ 7.868062823490618e-08,
+ -0.14000000059604645
+ ],
+ [
+ -0.2071598768234253,
+ -0.6760805249214172,
+ 0.7071067690849304,
+ -0.6199999451637268
+ ],
+ [
+ -0.20715980231761932,
+ -0.6760805249214172,
+ -0.7071069478988647,
+ 1.1000001430511475
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.44373413920402527,
+ "head_joint": "scap_R",
+ "tail_joint": "shoulder_R",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -8,
+ 8
+ ]
+ ]
+ },
+ {
+ "name": "upperarm_L",
+ "parent": 14,
+ "matrix_local": [
+ [
+ 0.9838458299636841,
+ 0.17901699244976044,
+ -4.500789430039731e-08,
+ 0.27000001072883606
+ ],
+ [
+ -0.08375982940196991,
+ 0.460329532623291,
+ 0.8837879300117493,
+ -0.9200000166893005
+ ],
+ [
+ 0.15821310877799988,
+ -0.8695112466812134,
+ 0.467887818813324,
+ 0.8000000715255737
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.39102426171302795,
+ "head_joint": "shoulder_L",
+ "tail_joint": "elbow_L",
+ "limits_deg": [
+ [
+ -60,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "upperarm_R",
+ "parent": 15,
+ "matrix_local": [
+ [
+ 0.9838460087776184,
+ -0.17901700735092163,
+ 2.3138852611737093e-08,
+ -0.27000001072883606
+ ],
+ [
+ 0.08375982940196991,
+ 0.460329532623291,
+ 0.8837879300117493,
+ -0.9199999570846558
+ ],
+ [
+ -0.15821316838264465,
+ -0.8695113062858582,
+ 0.4678877890110016,
+ 0.8000001311302185
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3910242021083832,
+ "head_joint": "shoulder_R",
+ "tail_joint": "elbow_R",
+ "limits_deg": [
+ [
+ -60,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "forearm_L",
+ "parent": 16,
+ "matrix_local": [
+ [
+ 0.9994637370109558,
+ 0.032738491892814636,
+ 2.1863485244466574e-08,
+ 0.3400000035762787
+ ],
+ [
+ 0.017158182337880135,
+ -0.5238164663314819,
+ 0.8516583442687988,
+ -0.7400000095367432
+ ],
+ [
+ 0.027882009744644165,
+ -0.8512019515037537,
+ -0.5240975618362427,
+ 0.46000006794929504
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3054504096508026,
+ "head_joint": "elbow_L",
+ "tail_joint": "wrist_L",
+ "limits_deg": [
+ [
+ -110,
+ 10
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "forearm_R",
+ "parent": 17,
+ "matrix_local": [
+ [
+ 0.9994639158248901,
+ -0.03273851424455643,
+ -3.296129236218803e-08,
+ -0.3400000035762787
+ ],
+ [
+ -0.017158182337880135,
+ -0.5238164663314819,
+ 0.8516583442687988,
+ -0.7399999499320984
+ ],
+ [
+ -0.02788209170103073,
+ -0.8512019515037537,
+ -0.5240976214408875,
+ 0.4600001573562622
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3054504096508026,
+ "head_joint": "elbow_R",
+ "tail_joint": "wrist_R",
+ "limits_deg": [
+ [
+ -110,
+ 10
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metacarpus_L",
+ "parent": 18,
+ "matrix_local": [
+ [
+ 0.9847317337989807,
+ 0.17407765984535217,
+ 9.204944717566832e-08,
+ 0.3499999940395355
+ ],
+ [
+ 0.12309150397777557,
+ -0.6963106393814087,
+ 0.7071067690849304,
+ -0.8999999761581421
+ ],
+ [
+ 0.12309159338474274,
+ -0.6963106393814087,
+ -0.7071070075035095,
+ 0.2000000774860382
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.1723368912935257,
+ "head_joint": "wrist_L",
+ "tail_joint": "fpaw_L",
+ "limits_deg": [
+ [
+ -20,
+ 110
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metacarpus_R",
+ "parent": 19,
+ "matrix_local": [
+ [
+ 0.984731912612915,
+ -0.17407768964767456,
+ -9.91201716260548e-08,
+ -0.3499999940395355
+ ],
+ [
+ -0.12309148907661438,
+ -0.6963106989860535,
+ 0.7071067094802856,
+ -0.8999999165534973
+ ],
+ [
+ -0.12309164553880692,
+ -0.6963107585906982,
+ -0.7071070671081543,
+ 0.20000016689300537
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.1723368614912033,
+ "head_joint": "wrist_R",
+ "tail_joint": "fpaw_R",
+ "limits_deg": [
+ [
+ -20,
+ 110
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "fpaw_L",
+ "parent": 20,
+ "matrix_local": [
+ [
+ 0.9999998211860657,
+ -5.901199529034784e-10,
+ 6.538295451719023e-07,
+ 0.3799999952316284
+ ],
+ [
+ -1.2592434472935565e-07,
+ -0.9635179042816162,
+ 0.2676438093185425,
+ -1.0199999809265137
+ ],
+ [
+ 6.325639105853043e-07,
+ -0.26764369010925293,
+ -0.9635180830955505,
+ 0.08000006526708603
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.18681548535823822,
+ "head_joint": "fpaw_L",
+ "tail_joint": "ftoe_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "fpaw_R",
+ "parent": 21,
+ "matrix_local": [
+ [
+ 1.0000001192092896,
+ 4.069324432975918e-09,
+ 4.27799733415668e-07,
+ -0.3799999952316284
+ ],
+ [
+ -1.45641877224989e-07,
+ -0.963517963886261,
+ 0.26764366030693054,
+ -1.0199998617172241
+ ],
+ [
+ 3.7661004625988426e-07,
+ -0.2676437497138977,
+ -0.9635182619094849,
+ 0.08000015467405319
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.18681548535823822,
+ "head_joint": "fpaw_R",
+ "tail_joint": "ftoe_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "thigh_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9929447770118713,
+ 0.11857803165912628,
+ -6.070942859537354e-09,
+ 0.19999998807907104
+ ],
+ [
+ 0.07646754384040833,
+ -0.6403212547302246,
+ 0.7642913460731506,
+ 0.15000002086162567
+ ],
+ [
+ 0.09062818437814713,
+ -0.7588992714881897,
+ -0.6448711156845093,
+ 0.800000011920929
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4216633141040802,
+ "head_joint": "hip_L",
+ "tail_joint": "knee_L",
+ "limits_deg": [
+ [
+ -60,
+ 45
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "thigh_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9929447174072266,
+ -0.1185779869556427,
+ 2.0006089229696045e-08,
+ -0.20000001788139343
+ ],
+ [
+ -0.07646752893924713,
+ -0.6403212547302246,
+ 0.7642913460731506,
+ 0.15000002086162567
+ ],
+ [
+ -0.09062813222408295,
+ -0.7588992714881897,
+ -0.6448711156845093,
+ 0.800000011920929
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4216633141040802,
+ "head_joint": "hip_R",
+ "tail_joint": "knee_R",
+ "limits_deg": [
+ [
+ -60,
+ 45
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "shin_L",
+ "parent": 24,
+ "matrix_local": [
+ [
+ 0.9979571104049683,
+ 0.06388769298791885,
+ -4.4666350618172146e-08,
+ 0.25
+ ],
+ [
+ -0.04907984286546707,
+ 0.7666519284248352,
+ 0.6401842832565308,
+ -0.119999960064888
+ ],
+ [
+ 0.040899939835071564,
+ -0.6388765573501587,
+ 0.7682215571403503,
+ 0.48000001907348633
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3130494952201843,
+ "head_joint": "knee_L",
+ "tail_joint": "hock_L",
+ "limits_deg": [
+ [
+ -10,
+ 100
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "shin_R",
+ "parent": 25,
+ "matrix_local": [
+ [
+ 0.9979570508003235,
+ -0.06388768553733826,
+ 5.203170161394155e-08,
+ -0.25
+ ],
+ [
+ 0.049079831689596176,
+ 0.7666518092155457,
+ 0.6401842832565308,
+ -0.119999960064888
+ ],
+ [
+ -0.04089992865920067,
+ -0.6388765573501587,
+ 0.7682214379310608,
+ 0.48000001907348633
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3130495250225067,
+ "head_joint": "knee_R",
+ "tail_joint": "hock_R",
+ "limits_deg": [
+ [
+ -10,
+ 100
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metatarsus_L",
+ "parent": 26,
+ "matrix_local": [
+ [
+ 0.9876729249954224,
+ 0.15653207898139954,
+ -3.456075603480713e-08,
+ 0.27000001072883606
+ ],
+ [
+ 0.08682841062545776,
+ -0.5478624701499939,
+ 0.8320501446723938,
+ 0.12000003457069397
+ ],
+ [
+ 0.13024257123470306,
+ -0.8217936754226685,
+ -0.5547003746032715,
+ 0.2800000309944153
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.25553858280181885,
+ "head_joint": "hock_L",
+ "tail_joint": "hpaw_L",
+ "limits_deg": [
+ [
+ -90,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metatarsus_R",
+ "parent": 27,
+ "matrix_local": [
+ [
+ 0.9876728057861328,
+ -0.15653203427791595,
+ 3.534542258876172e-08,
+ -0.27000001072883606
+ ],
+ [
+ -0.08682839572429657,
+ -0.5478623509407043,
+ 0.8320502042770386,
+ 0.12000001966953278
+ ],
+ [
+ -0.1302425116300583,
+ -0.8217935562133789,
+ -0.5547001361846924,
+ 0.2800000309944153
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2555386424064636,
+ "head_joint": "hock_R",
+ "tail_joint": "hpaw_R",
+ "limits_deg": [
+ [
+ -90,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "hpaw_L",
+ "parent": 28,
+ "matrix_local": [
+ [
+ 0.9988002181053162,
+ 0.048970162868499756,
+ 4.971025191480294e-07,
+ 0.3100000023841858
+ ],
+ [
+ 0.048019085079431534,
+ -0.9794042110443115,
+ 0.1961159110069275,
+ -0.019999966025352478
+ ],
+ [
+ 0.009604327380657196,
+ -0.19588077068328857,
+ -0.9805808663368225,
+ 0.07000003755092621
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.20420579612255096,
+ "head_joint": "hpaw_L",
+ "tail_joint": "htoe_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "hpaw_R",
+ "parent": 29,
+ "matrix_local": [
+ [
+ 0.9988001585006714,
+ -0.04897015169262886,
+ -4.6674534814883373e-07,
+ -0.3100000023841858
+ ],
+ [
+ -0.048019107431173325,
+ -0.979404091835022,
+ 0.19611597061157227,
+ -0.019999980926513672
+ ],
+ [
+ -0.009604290127754211,
+ -0.19588083028793335,
+ -0.9805806279182434,
+ 0.07000002264976501
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.20420581102371216,
+ "head_joint": "hpaw_R",
+ "tail_joint": "htoe_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "wing_arm_L",
+ "parent": 3,
+ "matrix_local": [
+ [
+ -0.13391776382923126,
+ 0.9572522640228271,
+ 0.256386399269104,
+ 0.17999999225139618
+ ],
+ [
+ 0.9909924268722534,
+ 0.1293584257364273,
+ 0.03464677929878235,
+ -0.5
+ ],
+ [
+ -2.9802322387695312e-08,
+ 0.2587168216705322,
+ -0.9659532308578491,
+ 1.2200000286102295
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.38652297854423523,
+ "head_joint": "wroot_L",
+ "tail_joint": "welbow_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "wing_arm_R",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.6014744639396667,
+ -0.7988920211791992,
+ -4.104656170511589e-08,
+ -0.18000002205371857
+ ],
+ [
+ -0.7456424236297607,
+ -0.5613836050033569,
+ -0.35897910594940186,
+ -0.6199999451637268
+ ],
+ [
+ 0.2867855131626129,
+ 0.21591685712337494,
+ -0.9333457350730896,
+ 1.2200000286102295
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.46314141154289246,
+ "head_joint": "wroot_R",
+ "tail_joint": "welbow_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -40,
+ 40
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "wing_fore_L",
+ "parent": 32,
+ "matrix_local": [
+ [
+ 0.8586187958717346,
+ 0.5126146674156189,
+ -5.960464477539063e-08,
+ 0.550000011920929
+ ],
+ [
+ -0.051006995141506195,
+ 0.08543568849563599,
+ -0.9950372576713562,
+ -0.44999998807907104
+ ],
+ [
+ -0.5100706815719604,
+ 0.8543577790260315,
+ 0.09950366616249084,
+ 1.3200000524520874
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5852349996566772,
+ "head_joint": "welbow_L",
+ "tail_joint": "wwrist_L",
+ "limits_deg": [
+ [
+ -70,
+ 70
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "wing_fore_R",
+ "parent": 33,
+ "matrix_local": [
+ [
+ 0.9164872169494629,
+ -0.40006405115127563,
+ -1.7844465105554264e-07,
+ -0.550000011920929
+ ],
+ [
+ -0.1676502227783203,
+ -0.3840615749359131,
+ -0.9079594016075134,
+ -0.8799999356269836
+ ],
+ [
+ 0.3632417917251587,
+ 0.8321332335472107,
+ -0.41905826330184937,
+ 1.3200000524520874
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6248998641967773,
+ "head_joint": "welbow_R",
+ "tail_joint": "wwrist_R",
+ "limits_deg": [
+ [
+ -70,
+ 70
+ ],
+ [
+ -30,
+ 30
+ ],
+ [
+ -70,
+ 70
+ ]
+ ]
+ },
+ {
+ "name": "finger1_L",
+ "parent": 34,
+ "matrix_local": [
+ [
+ 0.5918407440185547,
+ 0.8060548901557922,
+ 4.8768932003895316e-08,
+ 0.8500000238418579
+ ],
+ [
+ -0.8032706379890442,
+ 0.5897963643074036,
+ -0.0830453634262085,
+ -0.40000003576278687
+ ],
+ [
+ -0.06693913042545319,
+ 0.04914960265159607,
+ 0.9965458512306213,
+ 1.820000171661377
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 1.0173002481460571,
+ "head_joint": "wwrist_L",
+ "tail_joint": "f1_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger1_R",
+ "parent": 35,
+ "matrix_local": [
+ [
+ 0.2659289240837097,
+ -0.9637561440467834,
+ -0.021357642486691475,
+ -0.7999999523162842
+ ],
+ [
+ -0.9639928340911865,
+ -0.2658637762069702,
+ -0.005891621112823486,
+ -1.1200000047683716
+ ],
+ [
+ -1.1920928955078125e-07,
+ 0.022155366837978363,
+ -0.9997546672821045,
+ 1.8399999141693115
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.9027178883552551,
+ "head_joint": "wwrist_R",
+ "tail_joint": "f1_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger2_L",
+ "parent": 34,
+ "matrix_local": [
+ [
+ 0.7453559041023254,
+ 0.6666668057441711,
+ 1.1062594751365395e-07,
+ 0.8500000238418579
+ ],
+ [
+ -0.596284806728363,
+ 0.6666667461395264,
+ 0.4472135603427887,
+ -0.40000003576278687
+ ],
+ [
+ 0.29814237356185913,
+ -0.33333346247673035,
+ 0.8944272994995117,
+ 1.820000171661377
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.8999999761581421,
+ "head_joint": "wwrist_L",
+ "tail_joint": "f2_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger2_R",
+ "parent": 35,
+ "matrix_local": [
+ [
+ -0.09480945765972137,
+ -0.8769476413726807,
+ 0.47114160656929016,
+ -0.7999999523162842
+ ],
+ [
+ -0.9954956769943237,
+ 0.08351894468069077,
+ -0.044870585203170776,
+ -1.1200000047683716
+ ],
+ [
+ -5.960464477539063e-08,
+ -0.47327351570129395,
+ -0.8809157609939575,
+ 1.8399999141693115
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.718400776386261,
+ "head_joint": "wwrist_R",
+ "tail_joint": "f2_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger3_L",
+ "parent": 34,
+ "matrix_local": [
+ [
+ 0.9506226778030396,
+ 0.31034955382347107,
+ 1.6025789761897613e-07,
+ 0.8500000238418579
+ ],
+ [
+ -0.20263966917991638,
+ 0.6206992268562317,
+ 0.7574101686477661,
+ -0.40000003576278687
+ ],
+ [
+ 0.23506182432174683,
+ -0.7200111746788025,
+ 0.6529397368431091,
+ 1.820000171661377
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.8055432438850403,
+ "head_joint": "wwrist_L",
+ "tail_joint": "f3_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "finger3_R",
+ "parent": 35,
+ "matrix_local": [
+ [
+ 0.8992606997489929,
+ -0.4374133348464966,
+ -1.9741037249332294e-08,
+ -0.7999999523162842
+ ],
+ [
+ 0.14627549052238464,
+ 0.3007217049598694,
+ 0.9424278736114502,
+ -1.1200000047683716
+ ],
+ [
+ -0.412230521440506,
+ -0.847488284111023,
+ 0.3344098925590515,
+ 1.8399999141693115
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.7315735220909119,
+ "head_joint": "wwrist_R",
+ "tail_joint": "f3_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ }
+ ],
+ "keypoints": [
+ {
+ "name": "hips",
+ "bone": 0,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.32,
+ 0.86
+ ]
+ },
+ {
+ "name": "spine1",
+ "bone": 1,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.05,
+ 0.95
+ ]
+ },
+ {
+ "name": "spine2",
+ "bone": 2,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.25,
+ 1.0
+ ]
+ },
+ {
+ "name": "chest",
+ "bone": 3,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.55,
+ 1.02
+ ]
+ },
+ {
+ "name": "neck",
+ "bone": 4,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.75,
+ 1.18
+ ]
+ },
+ {
+ "name": "neck2",
+ "bone": 5,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.84,
+ 1.38
+ ]
+ },
+ {
+ "name": "neck3",
+ "bone": 6,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.92,
+ 1.58
+ ]
+ },
+ {
+ "name": "head",
+ "bone": 7,
+ "end": "head",
+ "rest": [
+ 0,
+ -1.02,
+ 1.78
+ ]
+ },
+ {
+ "name": "nose",
+ "bone": 7,
+ "end": "tail",
+ "rest": [
+ 0,
+ -1.38,
+ 1.73
+ ]
+ },
+ {
+ "name": "tail1",
+ "bone": 8,
+ "end": "head",
+ "rest": [
+ 0.0,
+ 0.4,
+ 0.78
+ ]
+ },
+ {
+ "name": "tail2",
+ "bone": 9,
+ "end": "head",
+ "rest": [
+ 0.05,
+ 0.55,
+ 0.55
+ ]
+ },
+ {
+ "name": "tail3",
+ "bone": 10,
+ "end": "head",
+ "rest": [
+ 0.12,
+ 0.72,
+ 0.37
+ ]
+ },
+ {
+ "name": "tail4",
+ "bone": 11,
+ "end": "head",
+ "rest": [
+ 0.24,
+ 0.9,
+ 0.23
+ ]
+ },
+ {
+ "name": "tail5",
+ "bone": 12,
+ "end": "head",
+ "rest": [
+ 0.39,
+ 1.1,
+ 0.14
+ ]
+ },
+ {
+ "name": "tail6",
+ "bone": 13,
+ "end": "head",
+ "rest": [
+ 0.55,
+ 1.3,
+ 0.18
+ ]
+ },
+ {
+ "name": "tail_tip",
+ "bone": 13,
+ "end": "tail",
+ "rest": [
+ 0.66,
+ 1.45,
+ 0.27
+ ]
+ },
+ {
+ "name": "scap_L",
+ "bone": 14,
+ "end": "head",
+ "rest": [
+ 0.14,
+ -0.62,
+ 1.1
+ ]
+ },
+ {
+ "name": "shoulder_L",
+ "bone": 16,
+ "end": "head",
+ "rest": [
+ 0.27,
+ -0.92,
+ 0.8
+ ]
+ },
+ {
+ "name": "elbow_L",
+ "bone": 18,
+ "end": "head",
+ "rest": [
+ 0.34,
+ -0.74,
+ 0.46
+ ]
+ },
+ {
+ "name": "wrist_L",
+ "bone": 20,
+ "end": "head",
+ "rest": [
+ 0.35,
+ -0.9,
+ 0.2
+ ]
+ },
+ {
+ "name": "fpaw_L",
+ "bone": 22,
+ "end": "head",
+ "rest": [
+ 0.38,
+ -1.02,
+ 0.08
+ ]
+ },
+ {
+ "name": "ftoe_L",
+ "bone": 22,
+ "end": "tail",
+ "rest": [
+ 0.38,
+ -1.2,
+ 0.03
+ ]
+ },
+ {
+ "name": "hip_L",
+ "bone": 24,
+ "end": "head",
+ "rest": [
+ 0.2,
+ 0.15,
+ 0.8
+ ]
+ },
+ {
+ "name": "knee_L",
+ "bone": 26,
+ "end": "head",
+ "rest": [
+ 0.25,
+ -0.12,
+ 0.48
+ ]
+ },
+ {
+ "name": "hock_L",
+ "bone": 28,
+ "end": "head",
+ "rest": [
+ 0.27,
+ 0.12,
+ 0.28
+ ]
+ },
+ {
+ "name": "hpaw_L",
+ "bone": 30,
+ "end": "head",
+ "rest": [
+ 0.31,
+ -0.02,
+ 0.07
+ ]
+ },
+ {
+ "name": "htoe_L",
+ "bone": 30,
+ "end": "tail",
+ "rest": [
+ 0.32,
+ -0.22,
+ 0.03
+ ]
+ },
+ {
+ "name": "wroot_L",
+ "bone": 32,
+ "end": "head",
+ "rest": [
+ 0.18,
+ -0.5,
+ 1.22
+ ]
+ },
+ {
+ "name": "welbow_L",
+ "bone": 34,
+ "end": "head",
+ "rest": [
+ 0.55,
+ -0.45,
+ 1.32
+ ]
+ },
+ {
+ "name": "wwrist_L",
+ "bone": 36,
+ "end": "head",
+ "rest": [
+ 0.85,
+ -0.4,
+ 1.82
+ ]
+ },
+ {
+ "name": "f1_L",
+ "bone": 36,
+ "end": "tail",
+ "rest": [
+ 1.67,
+ 0.2,
+ 1.87
+ ]
+ },
+ {
+ "name": "f2_L",
+ "bone": 38,
+ "end": "tail",
+ "rest": [
+ 1.45,
+ 0.2,
+ 1.52
+ ]
+ },
+ {
+ "name": "f3_L",
+ "bone": 40,
+ "end": "tail",
+ "rest": [
+ 1.1,
+ 0.1,
+ 1.24
+ ]
+ },
+ {
+ "name": "wroot_R",
+ "bone": 33,
+ "end": "head",
+ "rest": [
+ -0.18,
+ -0.62,
+ 1.22
+ ]
+ },
+ {
+ "name": "welbow_R",
+ "bone": 35,
+ "end": "head",
+ "rest": [
+ -0.55,
+ -0.88,
+ 1.32
+ ]
+ },
+ {
+ "name": "wwrist_R",
+ "bone": 37,
+ "end": "head",
+ "rest": [
+ -0.8,
+ -1.12,
+ 1.84
+ ]
+ },
+ {
+ "name": "f1_R",
+ "bone": 37,
+ "end": "tail",
+ "rest": [
+ -1.67,
+ -1.36,
+ 1.86
+ ]
+ },
+ {
+ "name": "f2_R",
+ "bone": 39,
+ "end": "tail",
+ "rest": [
+ -1.43,
+ -1.06,
+ 1.5
+ ]
+ },
+ {
+ "name": "f3_R",
+ "bone": 41,
+ "end": "tail",
+ "rest": [
+ -1.12,
+ -0.9,
+ 1.22
+ ]
+ },
+ {
+ "name": "scap_R",
+ "bone": 15,
+ "end": "head",
+ "rest": [
+ -0.14,
+ -0.62,
+ 1.1
+ ]
+ },
+ {
+ "name": "shoulder_R",
+ "bone": 17,
+ "end": "head",
+ "rest": [
+ -0.27,
+ -0.92,
+ 0.8
+ ]
+ },
+ {
+ "name": "elbow_R",
+ "bone": 19,
+ "end": "head",
+ "rest": [
+ -0.34,
+ -0.74,
+ 0.46
+ ]
+ },
+ {
+ "name": "wrist_R",
+ "bone": 21,
+ "end": "head",
+ "rest": [
+ -0.35,
+ -0.9,
+ 0.2
+ ]
+ },
+ {
+ "name": "fpaw_R",
+ "bone": 23,
+ "end": "head",
+ "rest": [
+ -0.38,
+ -1.02,
+ 0.08
+ ]
+ },
+ {
+ "name": "ftoe_R",
+ "bone": 23,
+ "end": "tail",
+ "rest": [
+ -0.38,
+ -1.2,
+ 0.03
+ ]
+ },
+ {
+ "name": "hip_R",
+ "bone": 25,
+ "end": "head",
+ "rest": [
+ -0.2,
+ 0.15,
+ 0.8
+ ]
+ },
+ {
+ "name": "knee_R",
+ "bone": 27,
+ "end": "head",
+ "rest": [
+ -0.25,
+ -0.12,
+ 0.48
+ ]
+ },
+ {
+ "name": "hock_R",
+ "bone": 29,
+ "end": "head",
+ "rest": [
+ -0.27,
+ 0.12,
+ 0.28
+ ]
+ },
+ {
+ "name": "hpaw_R",
+ "bone": 31,
+ "end": "head",
+ "rest": [
+ -0.31,
+ -0.02,
+ 0.07
+ ]
+ },
+ {
+ "name": "htoe_R",
+ "bone": 31,
+ "end": "tail",
+ "rest": [
+ -0.32,
+ -0.22,
+ 0.03
+ ]
+ }
+ ],
+ "layout": {
+ "H": 720,
+ "W_FRONT": 640,
+ "W_SIDE": 640,
+ "M_PER_PX": 0.006875,
+ "GROUND_V": 630,
+ "Z_CENTER": 1.85625,
+ "Y_CENTER": 0.0,
+ "X_CENTER": 0.0
+ }
+}
\ No newline at end of file
diff --git a/assets/spider/creature.json b/assets/spider/creature.json
new file mode 100644
index 0000000..da435af
--- /dev/null
+++ b/assets/spider/creature.json
@@ -0,0 +1,23 @@
+{
+ "name": "spider",
+ "noun": "giant spider",
+ "prep": {"length_m": 2.4, "rotz_deg": -90, "axis": "x"},
+ "layout": {"W_FRONT": 640, "W_SIDE": 640, "M_PER_PX": 0.0047, "GROUND_V": 560},
+ "paint": {
+ "L1": {"color": "#F53CD1", "bones": ["femur1_L", "tibia1_L", "tarsus1_L"]},
+ "L2": {"color": "#FFD21F", "bones": ["femur2_L", "tibia2_L", "tarsus2_L"]},
+ "L3": {"color": "#FF7A1A", "bones": ["femur3_L", "tibia3_L", "tarsus3_L"]},
+ "L4": {"color": "#9B4DFF", "bones": ["femur4_L", "tibia4_L", "tarsus4_L"]},
+ "R1": {"color": "#2F6BFF", "bones": ["femur1_R", "tibia1_R", "tarsus1_R"]},
+ "R2": {"color": "#19D3E0", "bones": ["femur2_R", "tibia2_R", "tarsus2_R"]},
+ "R3": {"color": "#2BD94A", "bones": ["femur3_R", "tibia3_R", "tarsus3_R"]},
+ "R4": {"color": "#FF2B2B", "bones": ["femur4_R", "tibia4_R", "tarsus4_R"]}
+ },
+ "feet": ["foot1_L", "foot1_R", "foot2_L", "foot2_R", "foot3_L", "foot3_R", "foot4_L", "foot4_R"],
+ "describe": "a black armoured giant spider with bone-coloured markings",
+ "colour_code": "first left leg pink, first right leg blue; second left leg yellow, second right leg cyan; third left leg orange, third right leg green; fourth left leg purple, fourth right leg red",
+ "count": "Exactly eight legs, two fangs, one body, one round abdomen.",
+ "flank": "side",
+ "limbs": "legs",
+ "camera": {"cam": "-3.3,-3.65,1.3", "target": "0,-0.1,0.78", "lens": 32}
+}
diff --git a/assets/spider/rig.json b/assets/spider/rig.json
new file mode 100644
index 0000000..3a9e839
--- /dev/null
+++ b/assets/spider/rig.json
@@ -0,0 +1,499 @@
+{
+ "note": "Giant spider, metres, faces -Y, its left is +X. Legs 1 (front) to 4 (back) traced per side (the mesh is not symmetric).",
+ "joints": {
+ "hips": [
+ 0,
+ -0.08,
+ 0.58
+ ],
+ "head": [
+ 0,
+ -0.62,
+ 0.55
+ ],
+ "abd_base": [
+ 0,
+ -0.02,
+ 0.66
+ ],
+ "abd_tip": [
+ 0,
+ 0.82,
+ 0.86
+ ],
+ "fang_root_L": [
+ 0.07,
+ -0.66,
+ 0.46
+ ],
+ "fang_tip_L": [
+ 0.06,
+ -0.7,
+ 0.3
+ ],
+ "hip1_L": [
+ 0.3199999928474426,
+ -0.4350000023841858,
+ 0.5170000195503235
+ ],
+ "knee1_L": [
+ 0.531000018119812,
+ -0.5440000295639038,
+ 0.7120000123977661
+ ],
+ "ankle1_L": [
+ 0.7979999780654907,
+ -0.7319999933242798,
+ 0.4099999964237213
+ ],
+ "foot1_L": [
+ 0.9419999718666077,
+ -0.8730000257492065,
+ 0.024000000208616257
+ ],
+ "hip2_L": [
+ 0.328000009059906,
+ -0.2709999978542328,
+ 0.5009999871253967
+ ],
+ "knee2_L": [
+ 0.7260000109672546,
+ -0.18700000643730164,
+ 0.6620000004768372
+ ],
+ "ankle2_L": [
+ 0.9710000157356262,
+ -0.20600000023841858,
+ 0.41200000047683716
+ ],
+ "foot2_L": [
+ 1.2000000476837158,
+ -0.2160000056028366,
+ 0.006000000052154064
+ ],
+ "hip3_L": [
+ 0.26600000262260437,
+ -0.1120000034570694,
+ 0.47999998927116394
+ ],
+ "knee3_L": [
+ 0.7319999933242798,
+ 0.20999999344348907,
+ 0.7089999914169312
+ ],
+ "ankle3_L": [
+ 0.9380000233650208,
+ 0.3330000042915344,
+ 0.4580000042915344
+ ],
+ "foot3_L": [
+ 1.156999945640564,
+ 0.46299999952316284,
+ 0.02500000037252903
+ ],
+ "hip4_L": [
+ 0.1860000044107437,
+ -0.06599999964237213,
+ 0.5139999985694885
+ ],
+ "knee4_L": [
+ 0.5090000033378601,
+ 0.42899999022483826,
+ 0.8090000152587891
+ ],
+ "ankle4_L": [
+ 0.5979999899864197,
+ 0.6489999890327454,
+ 0.5379999876022339
+ ],
+ "foot4_L": [
+ 0.7020000219345093,
+ 0.8730000257492065,
+ 0.0860000029206276
+ ],
+ "hip1_R": [
+ -0.328000009059906,
+ -0.43700000643730164,
+ 0.5370000004768372
+ ],
+ "knee1_R": [
+ -0.5360000133514404,
+ -0.5460000038146973,
+ 0.6819999814033508
+ ],
+ "ankle1_R": [
+ -0.8040000200271606,
+ -0.7279999852180481,
+ 0.4099999964237213
+ ],
+ "foot1_R": [
+ -0.949999988079071,
+ -0.8809999823570251,
+ 0.017000000923871994
+ ],
+ "hip2_R": [
+ -0.32499998807907104,
+ -0.2150000035762787,
+ 0.5070000290870667
+ ],
+ "knee2_R": [
+ -0.7149999737739563,
+ -0.1080000028014183,
+ 0.7459999918937683
+ ],
+ "ankle2_R": [
+ -0.949999988079071,
+ -0.0820000022649765,
+ 0.49399998784065247
+ ],
+ "foot2_R": [
+ -1.1979999542236328,
+ -0.054999999701976776,
+ 0.05900000035762787
+ ],
+ "hip3_R": [
+ -0.25999999046325684,
+ -0.10499999672174454,
+ 0.5009999871253967
+ ],
+ "knee3_R": [
+ -0.6980000138282776,
+ 0.23399999737739563,
+ 0.7279999852180481
+ ],
+ "ankle3_R": [
+ -0.925000011920929,
+ 0.3440000116825104,
+ 0.3580000102519989
+ ],
+ "foot3_R": [
+ -1.1030000448226929,
+ 0.414000004529953,
+ 0.024000000208616257
+ ],
+ "hip4_R": [
+ -0.2070000022649765,
+ -0.0729999989271164,
+ 0.527999997138977
+ ],
+ "knee4_R": [
+ -0.5440000295639038,
+ 0.39100000262260437,
+ 0.8299999833106995
+ ],
+ "ankle4_R": [
+ -0.7360000014305115,
+ 0.5479999780654907,
+ 0.5370000004768372
+ ],
+ "foot4_R": [
+ -0.9340000152587891,
+ 0.703000009059906,
+ 0.08100000023841858
+ ]
+ },
+ "bones": [
+ [
+ "pelvis",
+ "hips",
+ "head",
+ null
+ ],
+ [
+ "abdomen",
+ "abd_base",
+ "abd_tip",
+ "pelvis"
+ ],
+ [
+ "fang_L",
+ "fang_root_L",
+ "fang_tip_L",
+ "pelvis"
+ ],
+ [
+ "femur1_L",
+ "hip1_L",
+ "knee1_L",
+ "pelvis"
+ ],
+ [
+ "tibia1_L",
+ "knee1_L",
+ "ankle1_L",
+ "femur1_L"
+ ],
+ [
+ "tarsus1_L",
+ "ankle1_L",
+ "foot1_L",
+ "tibia1_L"
+ ],
+ [
+ "femur2_L",
+ "hip2_L",
+ "knee2_L",
+ "pelvis"
+ ],
+ [
+ "tibia2_L",
+ "knee2_L",
+ "ankle2_L",
+ "femur2_L"
+ ],
+ [
+ "tarsus2_L",
+ "ankle2_L",
+ "foot2_L",
+ "tibia2_L"
+ ],
+ [
+ "femur3_L",
+ "hip3_L",
+ "knee3_L",
+ "pelvis"
+ ],
+ [
+ "tibia3_L",
+ "knee3_L",
+ "ankle3_L",
+ "femur3_L"
+ ],
+ [
+ "tarsus3_L",
+ "ankle3_L",
+ "foot3_L",
+ "tibia3_L"
+ ],
+ [
+ "femur4_L",
+ "hip4_L",
+ "knee4_L",
+ "pelvis"
+ ],
+ [
+ "tibia4_L",
+ "knee4_L",
+ "ankle4_L",
+ "femur4_L"
+ ],
+ [
+ "tarsus4_L",
+ "ankle4_L",
+ "foot4_L",
+ "tibia4_L"
+ ]
+ ],
+ "limits_deg": {
+ "pelvis": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "abdomen": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "fang": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "femur1": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "femur2": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "femur3": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "femur4": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ],
+ "tibia1": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tibia2": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tibia3": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tibia4": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tarsus1": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tarsus2": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tarsus3": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "tarsus4": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ }
+}
\ No newline at end of file
diff --git a/assets/spider/rigged/rig_info.json b/assets/spider/rigged/rig_info.json
new file mode 100644
index 0000000..85f46da
--- /dev/null
+++ b/assets/spider/rigged/rig_info.json
@@ -0,0 +1,1732 @@
+{
+ "bones": [
+ {
+ "name": "pelvis",
+ "parent": -1,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 1.399843654326105e-07,
+ 0.0
+ ],
+ [
+ -7.764909604190962e-09,
+ -0.9984603524208069,
+ 0.05546996369957924,
+ -0.07999999821186066
+ ],
+ [
+ 1.397685167603413e-07,
+ -0.05546996369957924,
+ -0.9984626770019531,
+ 0.5799999833106995
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5408326983451843,
+ "head_joint": "hips",
+ "tail_joint": "head",
+ "limits_deg": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "abdomen",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 6.664072316198144e-08,
+ 1.7763568394002505e-15
+ ],
+ [
+ 1.5435501765637127e-08,
+ 0.9728063344955444,
+ -0.2316204309463501,
+ -0.02000003308057785
+ ],
+ [
+ -6.48306297534873e-08,
+ 0.23162052035331726,
+ 0.9728147387504578,
+ 0.6600000262260437
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.8634812831878662,
+ "head_joint": "abd_base",
+ "tail_joint": "abd_tip",
+ "limits_deg": [
+ [
+ -35,
+ 35
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "fang_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9981667995452881,
+ -0.06052288040518761,
+ -6.613569780711259e-08,
+ 0.07000000029802322
+ ],
+ [
+ -0.014678913168609142,
+ -0.2420913428068161,
+ 0.9701423048973083,
+ -0.6599999666213989
+ ],
+ [
+ -0.05871596187353134,
+ -0.9683661460876465,
+ -0.24253670871257782,
+ 0.46000003814697266
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.1652267426252365,
+ "head_joint": "fang_root_L",
+ "tail_joint": "fang_tip_L",
+ "limits_deg": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "fang_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.9981667995452881,
+ 0.06052292138338089,
+ 6.750910586106329e-08,
+ -0.07000000029802322
+ ],
+ [
+ 0.014678925275802612,
+ -0.2420913428068161,
+ 0.9701423048973083,
+ -0.6599999666213989
+ ],
+ [
+ 0.058715999126434326,
+ -0.9683661460876465,
+ -0.2425367385149002,
+ 0.46000003814697266
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.1652267426252365,
+ "head_joint": "fang_root_R",
+ "tail_joint": "fang_tip_R",
+ "limits_deg": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "femur1_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.7269890904426575,
+ 0.686648964881897,
+ -8.475524282403057e-07,
+ 0.3199999928474426
+ ],
+ [
+ 0.33503058552742004,
+ -0.35471445322036743,
+ -0.8728871941566467,
+ -0.4350000321865082
+ ],
+ [
+ -0.5993688702583313,
+ 0.6345807909965515,
+ -0.4879229962825775,
+ 0.5170000195503235
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3072894811630249,
+ "head_joint": "hip1_L",
+ "tail_joint": "knee1_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "femur1_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.6572720408439636,
+ -0.7536534667015076,
+ 8.228358296946681e-07,
+ -0.328000009059906
+ ],
+ [
+ -0.4528563320636749,
+ -0.3949432969093323,
+ -0.7993378639221191,
+ -0.437000036239624
+ ],
+ [
+ 0.6024254560470581,
+ 0.5253832936286926,
+ -0.6008831262588501,
+ 0.5370000600814819
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.27598893642425537,
+ "head_joint": "hip1_R",
+ "tail_joint": "knee1_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "tibia1_L",
+ "parent": 4,
+ "matrix_local": [
+ [
+ 0.7997856140136719,
+ 0.6002854704856873,
+ 1.71096701251372e-07,
+ 0.531000018119812
+ ],
+ [
+ 0.3172403573989868,
+ -0.4226728677749634,
+ 0.848943829536438,
+ -0.5440000295639038
+ ],
+ [
+ 0.5096099376678467,
+ -0.6789746284484863,
+ -0.5284841656684875,
+ 0.7120000123977661
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4447883069515228,
+ "head_joint": "knee1_L",
+ "tail_joint": "ankle1_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tibia1_R",
+ "parent": 5,
+ "matrix_local": [
+ [
+ 0.7736895084381104,
+ -0.6335650086402893,
+ -1.2267204851923452e-07,
+ -0.5360000133514404
+ ],
+ [
+ -0.35233205556869507,
+ -0.430256724357605,
+ 0.8311083316802979,
+ -0.5460000038146973
+ ],
+ [
+ -0.5265624523162842,
+ -0.6430211067199707,
+ -0.5561118721961975,
+ 0.6820000410079956
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4230031669139862,
+ "head_joint": "knee1_R",
+ "tail_joint": "ankle1_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus1_L",
+ "parent": 6,
+ "matrix_local": [
+ [
+ 0.9437371492385864,
+ 0.33069613575935364,
+ 5.399876954470528e-07,
+ 0.7979999780654907
+ ],
+ [
+ 0.11346499621868134,
+ -0.32380667328834534,
+ 0.9392945766448975,
+ -0.7319999933242798
+ ],
+ [
+ 0.31062203645706177,
+ -0.8864493370056152,
+ -0.3431120812892914,
+ 0.4100000262260437
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.43544507026672363,
+ "head_joint": "ankle1_L",
+ "tail_joint": "foot1_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus1_R",
+ "parent": 7,
+ "matrix_local": [
+ [
+ 0.9449750185012817,
+ -0.3271426558494568,
+ -5.667918685503537e-07,
+ -0.8040000200271606
+ ],
+ [
+ -0.11868371814489365,
+ -0.34282755851745605,
+ 0.9318708181381226,
+ -0.7279999256134033
+ ],
+ [
+ -0.30485570430755615,
+ -0.8805965185165405,
+ -0.3627910912036896,
+ 0.4100000858306885
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.44628840684890747,
+ "head_joint": "ankle1_R",
+ "tail_joint": "foot1_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "femur2_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ -0.20650576055049896,
+ 0.9097745418548584,
+ 0.36009109020233154,
+ 0.328000009059906
+ ],
+ [
+ 0.9784453511238098,
+ 0.1920127123594284,
+ 0.07599864155054092,
+ -0.2710000276565552
+ ],
+ [
+ -5.960464477539062e-07,
+ 0.36802446842193604,
+ -0.9298185706138611,
+ 0.5009999871253967
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4374710023403168,
+ "head_joint": "hip2_L",
+ "tail_joint": "knee2_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "femur2_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.5574356913566589,
+ -0.830220103263855,
+ 3.265836312493775e-08,
+ -0.32499998807907104
+ ],
+ [
+ 0.3392430543899536,
+ 0.22777831554412842,
+ -0.9127054810523987,
+ -0.21500003337860107
+ ],
+ [
+ 0.7577481865882874,
+ 0.5087758302688599,
+ 0.4086192846298218,
+ 0.5070000290870667
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4697549641132355,
+ "head_joint": "hip2_R",
+ "tail_joint": "knee2_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "tibia2_L",
+ "parent": 10,
+ "matrix_local": [
+ [
+ 0.7152187824249268,
+ 0.6989003419876099,
+ 1.5273690223693848e-07,
+ 0.7259999513626099
+ ],
+ [
+ 0.05296381562948227,
+ -0.05420040339231491,
+ 0.9971243739128113,
+ -0.18700003623962402
+ ],
+ [
+ 0.6968923807144165,
+ -0.7131636738777161,
+ -0.07578200101852417,
+ 0.6620000004768372
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3505506217479706,
+ "head_joint": "knee2_L",
+ "tail_joint": "ankle2_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tibia2_R",
+ "parent": 11,
+ "matrix_local": [
+ [
+ 0.733142077922821,
+ -0.6800755858421326,
+ -4.0080951180243574e-07,
+ -0.7150000333786011
+ ],
+ [
+ 0.06979671120643616,
+ 0.07524240016937256,
+ 0.9947195649147034,
+ -0.10800004005432129
+ ],
+ [
+ -0.6764861941337585,
+ -0.7292724847793579,
+ 0.10263049602508545,
+ 0.7459999918937683
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3455498516559601,
+ "head_joint": "knee2_R",
+ "tail_joint": "ankle2_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus2_L",
+ "parent": 12,
+ "matrix_local": [
+ [
+ 0.871065080165863,
+ 0.4911671280860901,
+ 2.0655322430229717e-07,
+ 0.9709998965263367
+ ],
+ [
+ 0.012094052508473396,
+ -0.021448355168104172,
+ 0.999696671962738,
+ -0.20600001513957977
+ ],
+ [
+ 0.4910195469856262,
+ -0.8708029389381409,
+ -0.024623416364192963,
+ 0.41200003027915955
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4662363827228546,
+ "head_joint": "ankle2_L",
+ "tail_joint": "foot2_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus2_R",
+ "parent": 13,
+ "matrix_local": [
+ [
+ 0.8691431283950806,
+ -0.49456095695495605,
+ 9.685064128461818e-08,
+ -0.9500000476837158
+ ],
+ [
+ 0.030637867748737335,
+ 0.053843338042497635,
+ 0.9980792999267578,
+ -0.08200003951787949
+ ],
+ [
+ -0.4936122000217438,
+ -0.8674758076667786,
+ 0.06194983422756195,
+ 0.49399998784065247
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5014548301696777,
+ "head_joint": "ankle2_R",
+ "tail_joint": "foot2_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "femur3_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.6467226147651672,
+ 0.7627250552177429,
+ -2.5996300223596336e-07,
+ 0.26600000262260437
+ ],
+ [
+ -0.6215671896934509,
+ 0.5270330905914307,
+ -0.5795601010322571,
+ -0.11200004816055298
+ ],
+ [
+ -0.44204577803611755,
+ 0.37481555342674255,
+ 0.8149313926696777,
+ 0.47999998927116394
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6109670400619507,
+ "head_joint": "hip3_L",
+ "tail_joint": "knee3_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "femur3_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.6815879344940186,
+ -0.7317363619804382,
+ 1.1796177545875253e-07,
+ -0.25999999046325684
+ ],
+ [
+ 0.6080127954483032,
+ 0.5663436651229858,
+ -0.5563949942588806,
+ -0.10500004142522812
+ ],
+ [
+ 0.40713539719581604,
+ 0.37923309206962585,
+ 0.8309199213981628,
+ 0.5009999871253967
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5985764265060425,
+ "head_joint": "hip3_R",
+ "tail_joint": "knee3_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "tibia3_L",
+ "parent": 16,
+ "matrix_local": [
+ [
+ 0.805000364780426,
+ 0.5932740569114685,
+ -7.714064054198388e-08,
+ 0.7319998741149902
+ ],
+ [
+ -0.2610672116279602,
+ 0.3542364239692688,
+ 0.8979755640029907,
+ 0.20999979972839355
+ ],
+ [
+ 0.5327470898628235,
+ -0.7228726148605347,
+ 0.44004547595977783,
+ 0.7089999318122864
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.34722578525543213,
+ "head_joint": "knee3_L",
+ "tail_joint": "ankle3_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tibia3_R",
+ "parent": 17,
+ "matrix_local": [
+ [
+ 0.8619943261146545,
+ -0.5069183111190796,
+ -9.45847062894245e-08,
+ -0.6980001330375671
+ ],
+ [
+ 0.1444569230079651,
+ 0.24564334750175476,
+ 0.9585362672805786,
+ 0.23399990797042847
+ ],
+ [
+ -0.4859006106853485,
+ -0.8262546062469482,
+ 0.28497177362442017,
+ 0.7279999852180481
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.4478038549423218,
+ "head_joint": "knee3_R",
+ "tail_joint": "ankle3_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus3_L",
+ "parent": 18,
+ "matrix_local": [
+ [
+ 0.899967610836029,
+ 0.4359564781188965,
+ -3.7412905840028543e-07,
+ 0.9379999041557312
+ ],
+ [
+ -0.12535947561264038,
+ 0.25878703594207764,
+ 0.9577651023864746,
+ 0.3329998254776001
+ ],
+ [
+ 0.41754502058029175,
+ -0.8619598746299744,
+ 0.2875514030456543,
+ 0.45799991488456726
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5023435950279236,
+ "head_joint": "ankle3_L",
+ "tail_joint": "foot3_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus3_R",
+ "parent": 19,
+ "matrix_local": [
+ [
+ 0.8866345882415771,
+ -0.4624711871147156,
+ 4.0492500374966767e-07,
+ -0.9250000715255737
+ ],
+ [
+ 0.094863660633564,
+ 0.18187066912651062,
+ 0.9787360429763794,
+ 0.3439999520778656
+ ],
+ [
+ -0.45263829827308655,
+ -0.8677829504013062,
+ 0.2051251232624054,
+ 0.3579999804496765
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.3848889172077179,
+ "head_joint": "ankle3_R",
+ "tail_joint": "foot3_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "femur4_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.8723078370094299,
+ 0.4889572262763977,
+ -4.9533710466675984e-08,
+ 0.1860000193119049
+ ],
+ [
+ -0.4200243651866913,
+ 0.7493306398391724,
+ -0.511940598487854,
+ -0.06600004434585571
+ ],
+ [
+ -0.2503175139427185,
+ 0.4465707838535309,
+ 0.859022855758667,
+ 0.5139999985694885
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6605896353721619,
+ "head_joint": "hip4_L",
+ "tail_joint": "knee4_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "femur4_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.8541908264160156,
+ -0.5199598670005798,
+ -1.213779796671588e-07,
+ -0.2070000022649765
+ ],
+ [
+ 0.4357856512069702,
+ 0.7159092426300049,
+ -0.545495331287384,
+ -0.07300005853176117
+ ],
+ [
+ 0.28363677859306335,
+ 0.46595799922943115,
+ 0.8381161689758301,
+ 0.5280000567436218
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.6481269598007202,
+ "head_joint": "hip4_R",
+ "tail_joint": "knee4_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -40,
+ 40
+ ]
+ ]
+ },
+ {
+ "name": "tibia4_L",
+ "parent": 22,
+ "matrix_local": [
+ [
+ 0.9689981341362,
+ 0.2470681220293045,
+ 2.2671624577697003e-08,
+ 0.5090000629425049
+ ],
+ [
+ -0.15571950376033783,
+ 0.6107302904129028,
+ 0.7763761878013611,
+ 0.42900002002716064
+ ],
+ [
+ 0.19181828200817108,
+ -0.7523088455200195,
+ 0.6302712559700012,
+ 0.8090000152587891
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.36022448539733887,
+ "head_joint": "knee4_L",
+ "tail_joint": "ankle4_L",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tibia4_R",
+ "parent": 23,
+ "matrix_local": [
+ [
+ 0.8659329414367676,
+ -0.500160276889801,
+ 3.0833700748189585e-07,
+ -0.5440000295639038
+ ],
+ [
+ 0.23622840642929077,
+ 0.4089852571487427,
+ 0.8814349174499512,
+ 0.39100003242492676
+ ],
+ [
+ -0.4408596456050873,
+ -0.7632654309272766,
+ 0.472307026386261,
+ 0.8299999833106995
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.38387688994407654,
+ "head_joint": "knee4_R",
+ "tail_joint": "ankle4_R",
+ "limits_deg": [
+ [
+ -60,
+ 60
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus4_L",
+ "parent": 24,
+ "matrix_local": [
+ [
+ 0.979403018951416,
+ 0.20191515982151031,
+ -3.355116291459126e-07,
+ 0.5980000495910645
+ ],
+ [
+ -0.0896579921245575,
+ 0.4348940849304199,
+ 0.8960070610046387,
+ 0.6490000486373901
+ ],
+ [
+ 0.18091800808906555,
+ -0.8775540590286255,
+ 0.4440408945083618,
+ 0.5379999876022339
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.515067994594574,
+ "head_joint": "ankle4_L",
+ "tail_joint": "foot4_L",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "tarsus4_R",
+ "parent": 25,
+ "matrix_local": [
+ [
+ 0.9248909950256348,
+ -0.380232572555542,
+ 5.277048558127717e-07,
+ -0.7360000014305115
+ ],
+ [
+ 0.12236940860748291,
+ 0.297656774520874,
+ 0.9467979669570923,
+ 0.5480000376701355
+ ],
+ [
+ -0.36000415682792664,
+ -0.8756871223449707,
+ 0.3218297064304352,
+ 0.5370000600814819
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.5207339525222778,
+ "head_joint": "ankle4_R",
+ "tail_joint": "foot4_R",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ }
+ ],
+ "keypoints": [
+ {
+ "name": "hips",
+ "bone": 0,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.08,
+ 0.58
+ ]
+ },
+ {
+ "name": "head",
+ "bone": 0,
+ "end": "tail",
+ "rest": [
+ 0,
+ -0.62,
+ 0.55
+ ]
+ },
+ {
+ "name": "abd_base",
+ "bone": 1,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.02,
+ 0.66
+ ]
+ },
+ {
+ "name": "abd_tip",
+ "bone": 1,
+ "end": "tail",
+ "rest": [
+ 0,
+ 0.82,
+ 0.86
+ ]
+ },
+ {
+ "name": "fang_root_L",
+ "bone": 2,
+ "end": "head",
+ "rest": [
+ 0.07,
+ -0.66,
+ 0.46
+ ]
+ },
+ {
+ "name": "fang_tip_L",
+ "bone": 2,
+ "end": "tail",
+ "rest": [
+ 0.06,
+ -0.7,
+ 0.3
+ ]
+ },
+ {
+ "name": "hip1_L",
+ "bone": 4,
+ "end": "head",
+ "rest": [
+ 0.3199999928474426,
+ -0.4350000023841858,
+ 0.5170000195503235
+ ]
+ },
+ {
+ "name": "knee1_L",
+ "bone": 6,
+ "end": "head",
+ "rest": [
+ 0.531000018119812,
+ -0.5440000295639038,
+ 0.7120000123977661
+ ]
+ },
+ {
+ "name": "ankle1_L",
+ "bone": 8,
+ "end": "head",
+ "rest": [
+ 0.7979999780654907,
+ -0.7319999933242798,
+ 0.4099999964237213
+ ]
+ },
+ {
+ "name": "foot1_L",
+ "bone": 8,
+ "end": "tail",
+ "rest": [
+ 0.9419999718666077,
+ -0.8730000257492065,
+ 0.024000000208616257
+ ]
+ },
+ {
+ "name": "hip2_L",
+ "bone": 10,
+ "end": "head",
+ "rest": [
+ 0.328000009059906,
+ -0.2709999978542328,
+ 0.5009999871253967
+ ]
+ },
+ {
+ "name": "knee2_L",
+ "bone": 12,
+ "end": "head",
+ "rest": [
+ 0.7260000109672546,
+ -0.18700000643730164,
+ 0.6620000004768372
+ ]
+ },
+ {
+ "name": "ankle2_L",
+ "bone": 14,
+ "end": "head",
+ "rest": [
+ 0.9710000157356262,
+ -0.20600000023841858,
+ 0.41200000047683716
+ ]
+ },
+ {
+ "name": "foot2_L",
+ "bone": 14,
+ "end": "tail",
+ "rest": [
+ 1.2000000476837158,
+ -0.2160000056028366,
+ 0.006000000052154064
+ ]
+ },
+ {
+ "name": "hip3_L",
+ "bone": 16,
+ "end": "head",
+ "rest": [
+ 0.26600000262260437,
+ -0.1120000034570694,
+ 0.47999998927116394
+ ]
+ },
+ {
+ "name": "knee3_L",
+ "bone": 18,
+ "end": "head",
+ "rest": [
+ 0.7319999933242798,
+ 0.20999999344348907,
+ 0.7089999914169312
+ ]
+ },
+ {
+ "name": "ankle3_L",
+ "bone": 20,
+ "end": "head",
+ "rest": [
+ 0.9380000233650208,
+ 0.3330000042915344,
+ 0.4580000042915344
+ ]
+ },
+ {
+ "name": "foot3_L",
+ "bone": 20,
+ "end": "tail",
+ "rest": [
+ 1.156999945640564,
+ 0.46299999952316284,
+ 0.02500000037252903
+ ]
+ },
+ {
+ "name": "hip4_L",
+ "bone": 22,
+ "end": "head",
+ "rest": [
+ 0.1860000044107437,
+ -0.06599999964237213,
+ 0.5139999985694885
+ ]
+ },
+ {
+ "name": "knee4_L",
+ "bone": 24,
+ "end": "head",
+ "rest": [
+ 0.5090000033378601,
+ 0.42899999022483826,
+ 0.8090000152587891
+ ]
+ },
+ {
+ "name": "ankle4_L",
+ "bone": 26,
+ "end": "head",
+ "rest": [
+ 0.5979999899864197,
+ 0.6489999890327454,
+ 0.5379999876022339
+ ]
+ },
+ {
+ "name": "foot4_L",
+ "bone": 26,
+ "end": "tail",
+ "rest": [
+ 0.7020000219345093,
+ 0.8730000257492065,
+ 0.0860000029206276
+ ]
+ },
+ {
+ "name": "hip1_R",
+ "bone": 5,
+ "end": "head",
+ "rest": [
+ -0.328000009059906,
+ -0.43700000643730164,
+ 0.5370000004768372
+ ]
+ },
+ {
+ "name": "knee1_R",
+ "bone": 7,
+ "end": "head",
+ "rest": [
+ -0.5360000133514404,
+ -0.5460000038146973,
+ 0.6819999814033508
+ ]
+ },
+ {
+ "name": "ankle1_R",
+ "bone": 9,
+ "end": "head",
+ "rest": [
+ -0.8040000200271606,
+ -0.7279999852180481,
+ 0.4099999964237213
+ ]
+ },
+ {
+ "name": "foot1_R",
+ "bone": 9,
+ "end": "tail",
+ "rest": [
+ -0.949999988079071,
+ -0.8809999823570251,
+ 0.017000000923871994
+ ]
+ },
+ {
+ "name": "hip2_R",
+ "bone": 11,
+ "end": "head",
+ "rest": [
+ -0.32499998807907104,
+ -0.2150000035762787,
+ 0.5070000290870667
+ ]
+ },
+ {
+ "name": "knee2_R",
+ "bone": 13,
+ "end": "head",
+ "rest": [
+ -0.7149999737739563,
+ -0.1080000028014183,
+ 0.7459999918937683
+ ]
+ },
+ {
+ "name": "ankle2_R",
+ "bone": 15,
+ "end": "head",
+ "rest": [
+ -0.949999988079071,
+ -0.0820000022649765,
+ 0.49399998784065247
+ ]
+ },
+ {
+ "name": "foot2_R",
+ "bone": 15,
+ "end": "tail",
+ "rest": [
+ -1.1979999542236328,
+ -0.054999999701976776,
+ 0.05900000035762787
+ ]
+ },
+ {
+ "name": "hip3_R",
+ "bone": 17,
+ "end": "head",
+ "rest": [
+ -0.25999999046325684,
+ -0.10499999672174454,
+ 0.5009999871253967
+ ]
+ },
+ {
+ "name": "knee3_R",
+ "bone": 19,
+ "end": "head",
+ "rest": [
+ -0.6980000138282776,
+ 0.23399999737739563,
+ 0.7279999852180481
+ ]
+ },
+ {
+ "name": "ankle3_R",
+ "bone": 21,
+ "end": "head",
+ "rest": [
+ -0.925000011920929,
+ 0.3440000116825104,
+ 0.3580000102519989
+ ]
+ },
+ {
+ "name": "foot3_R",
+ "bone": 21,
+ "end": "tail",
+ "rest": [
+ -1.1030000448226929,
+ 0.414000004529953,
+ 0.024000000208616257
+ ]
+ },
+ {
+ "name": "hip4_R",
+ "bone": 23,
+ "end": "head",
+ "rest": [
+ -0.2070000022649765,
+ -0.0729999989271164,
+ 0.527999997138977
+ ]
+ },
+ {
+ "name": "knee4_R",
+ "bone": 25,
+ "end": "head",
+ "rest": [
+ -0.5440000295639038,
+ 0.39100000262260437,
+ 0.8299999833106995
+ ]
+ },
+ {
+ "name": "ankle4_R",
+ "bone": 27,
+ "end": "head",
+ "rest": [
+ -0.7360000014305115,
+ 0.5479999780654907,
+ 0.5370000004768372
+ ]
+ },
+ {
+ "name": "foot4_R",
+ "bone": 27,
+ "end": "tail",
+ "rest": [
+ -0.9340000152587891,
+ 0.703000009059906,
+ 0.08100000023841858
+ ]
+ },
+ {
+ "name": "fang_root_R",
+ "bone": 3,
+ "end": "head",
+ "rest": [
+ -0.07,
+ -0.66,
+ 0.46
+ ]
+ },
+ {
+ "name": "fang_tip_R",
+ "bone": 3,
+ "end": "tail",
+ "rest": [
+ -0.06,
+ -0.7,
+ 0.3
+ ]
+ }
+ ],
+ "layout": {
+ "H": 720,
+ "W_FRONT": 640,
+ "W_SIDE": 640,
+ "M_PER_PX": 0.0047,
+ "GROUND_V": 560,
+ "Z_CENTER": 0.9400000000000001,
+ "Y_CENTER": 0.0,
+ "X_CENTER": 0.0
+ }
+}
\ No newline at end of file
diff --git a/assets/wolf/creature.json b/assets/wolf/creature.json
new file mode 100644
index 0000000..d8ee116
--- /dev/null
+++ b/assets/wolf/creature.json
@@ -0,0 +1,19 @@
+{
+ "name": "wolf",
+ "noun": "grey wolf",
+ "prep": {"length_m": 1.6, "rotz_deg": 0, "axis": "y"},
+ "layout": {"W_FRONT": 420, "W_SIDE": 860, "M_PER_PX": 0.002638888888888889, "GROUND_V": 630},
+ "paint": {
+ "FL": {"color": "#F53CD1", "bones": ["upperarm_L", "forearm_L", "metacarpus_L", "fpaw_L"]},
+ "FR": {"color": "#2F6BFF", "bones": ["upperarm_R", "forearm_R", "metacarpus_R", "fpaw_R"]},
+ "HL": {"color": "#FFD21F", "bones": ["thigh_L", "shin_L", "metatarsus_L", "hpaw_L"]},
+ "HR": {"color": "#19D3E0", "bones": ["thigh_R", "shin_R", "metatarsus_R", "hpaw_R"]}
+ },
+ "feet": ["fpaw_L", "fpaw_R", "hpaw_L", "hpaw_R"],
+ "describe": "grey fur, cream chest and muzzle, dark paws",
+ "colour_code": "front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan",
+ "count": "Exactly four legs, one tail, one head.",
+ "flank": "flank",
+ "limbs": "legs",
+ "camera": {"cam": "-3.2,-3.0,1.6", "target": "0,0,0.5", "lens": 50}
+}
diff --git a/assets/wolf/fur.json b/assets/wolf/fur.json
new file mode 100644
index 0000000..42c01a9
--- /dev/null
+++ b/assets/wolf/fur.json
@@ -0,0 +1,86 @@
+{
+ "ear_L": {
+ "parent": "head",
+ "freq": 5.0,
+ "damping": 0.45,
+ "max_deg": 25,
+ "gravity": 0.0
+ },
+ "ear_R": {
+ "parent": "head",
+ "freq": 5.0,
+ "damping": 0.45,
+ "max_deg": 25,
+ "gravity": 0.0
+ },
+ "ruff_upper_L": {
+ "parent": "neck1",
+ "freq": 2.4,
+ "damping": 0.25,
+ "max_deg": 30,
+ "gravity": 0.45
+ },
+ "ruff_mid_L": {
+ "parent": "neck1",
+ "freq": 2.1,
+ "damping": 0.22,
+ "max_deg": 30,
+ "gravity": 0.45
+ },
+ "ruff_lower_L": {
+ "parent": "chest",
+ "freq": 1.9,
+ "damping": 0.22,
+ "max_deg": 30,
+ "gravity": 0.45
+ },
+ "ruff_upper_R": {
+ "parent": "neck1",
+ "freq": 2.4,
+ "damping": 0.25,
+ "max_deg": 30,
+ "gravity": 0.45
+ },
+ "ruff_mid_R": {
+ "parent": "neck1",
+ "freq": 2.1,
+ "damping": 0.22,
+ "max_deg": 30,
+ "gravity": 0.45
+ },
+ "ruff_lower_R": {
+ "parent": "chest",
+ "freq": 1.9,
+ "damping": 0.22,
+ "max_deg": 30,
+ "gravity": 0.45
+ },
+ "crest": {
+ "parent": "neck2",
+ "freq": 2.6,
+ "damping": 0.25,
+ "max_deg": 25,
+ "gravity": 0.3
+ },
+ "chest_tuft": {
+ "parent": "chest",
+ "freq": 2.6,
+ "damping": 0.25,
+ "max_deg": 30,
+ "gravity": 0.5
+ },
+ "belly_L": {
+ "parent": "spine2",
+ "freq": 2.8,
+ "damping": 0.25,
+ "max_deg": 25,
+ "gravity": 0.5
+ },
+ "belly_R": {
+ "parent": "spine2",
+ "freq": 2.8,
+ "damping": 0.25,
+ "max_deg": 25,
+ "gravity": 0.5
+ }
+}
\ No newline at end of file
diff --git a/assets/wolf/rig.json b/assets/wolf/rig.json
new file mode 100644
index 0000000..e44cb6f
--- /dev/null
+++ b/assets/wolf/rig.json
@@ -0,0 +1,554 @@
+{
+ "note": "Wolf skeleton, metres, creature faces -Y, its left is +X. _L joints are mirrored to _R (x negated).",
+ "joints": {
+ "hips": [
+ 0,
+ 0.36,
+ 0.64
+ ],
+ "spine1": [
+ 0,
+ 0.17,
+ 0.665
+ ],
+ "spine2": [
+ 0,
+ -0.02,
+ 0.67
+ ],
+ "chest": [
+ 0,
+ -0.22,
+ 0.67
+ ],
+ "neck": [
+ 0,
+ -0.4,
+ 0.73
+ ],
+ "neck2": [
+ 0,
+ -0.49,
+ 0.81
+ ],
+ "head": [
+ 0,
+ -0.56,
+ 0.88
+ ],
+ "nose": [
+ 0,
+ -0.79,
+ 0.735
+ ],
+ "tail1": [
+ 0,
+ 0.45,
+ 0.665
+ ],
+ "tail2": [
+ 0,
+ 0.52,
+ 0.56
+ ],
+ "tail3": [
+ 0,
+ 0.58,
+ 0.47
+ ],
+ "tail4": [
+ 0,
+ 0.64,
+ 0.4
+ ],
+ "tail5": [
+ 0,
+ 0.71,
+ 0.34
+ ],
+ "tail_tip": [
+ 0,
+ 0.79,
+ 0.28
+ ],
+ "scap_L": [
+ 0.08,
+ -0.24,
+ 0.74
+ ],
+ "shoulder_L": [
+ 0.13,
+ -0.43,
+ 0.56
+ ],
+ "elbow_L": [
+ 0.135,
+ -0.3,
+ 0.4
+ ],
+ "wrist_L": [
+ 0.145,
+ -0.345,
+ 0.13
+ ],
+ "fpaw_L": [
+ 0.16,
+ -0.4,
+ 0.045
+ ],
+ "ftoe_L": [
+ 0.16,
+ -0.49,
+ 0.02
+ ],
+ "hip_L": [
+ 0.11,
+ 0.37,
+ 0.6
+ ],
+ "knee_L": [
+ 0.13,
+ 0.24,
+ 0.4
+ ],
+ "hock_L": [
+ 0.15,
+ 0.38,
+ 0.21
+ ],
+ "hpaw_L": [
+ 0.17,
+ 0.31,
+ 0.05
+ ],
+ "htoe_L": [
+ 0.18,
+ 0.23,
+ 0.02
+ ]
+ },
+ "bones": [
+ [
+ "pelvis",
+ "hips",
+ "spine1",
+ null
+ ],
+ [
+ "spine1",
+ "spine1",
+ "spine2",
+ "pelvis"
+ ],
+ [
+ "spine2",
+ "spine2",
+ "chest",
+ "spine1"
+ ],
+ [
+ "chest",
+ "chest",
+ "neck",
+ "spine2"
+ ],
+ [
+ "neck1",
+ "neck",
+ "neck2",
+ "chest"
+ ],
+ [
+ "neck2",
+ "neck2",
+ "head",
+ "neck1"
+ ],
+ [
+ "head",
+ "head",
+ "nose",
+ "neck2"
+ ],
+ [
+ "tail1",
+ "tail1",
+ "tail2",
+ "pelvis"
+ ],
+ [
+ "tail2",
+ "tail2",
+ "tail3",
+ "tail1"
+ ],
+ [
+ "tail3",
+ "tail3",
+ "tail4",
+ "tail2"
+ ],
+ [
+ "tail4",
+ "tail4",
+ "tail5",
+ "tail3"
+ ],
+ [
+ "tail5",
+ "tail5",
+ "tail_tip",
+ "tail4"
+ ],
+ [
+ "scapula_L",
+ "scap_L",
+ "shoulder_L",
+ "chest"
+ ],
+ [
+ "upperarm_L",
+ "shoulder_L",
+ "elbow_L",
+ "scapula_L"
+ ],
+ [
+ "forearm_L",
+ "elbow_L",
+ "wrist_L",
+ "upperarm_L"
+ ],
+ [
+ "metacarpus_L",
+ "wrist_L",
+ "fpaw_L",
+ "forearm_L"
+ ],
+ [
+ "fpaw_L",
+ "fpaw_L",
+ "ftoe_L",
+ "metacarpus_L"
+ ],
+ [
+ "thigh_L",
+ "hip_L",
+ "knee_L",
+ "pelvis"
+ ],
+ [
+ "shin_L",
+ "knee_L",
+ "hock_L",
+ "thigh_L"
+ ],
+ [
+ "metatarsus_L",
+ "hock_L",
+ "hpaw_L",
+ "shin_L"
+ ],
+ [
+ "hpaw_L",
+ "hpaw_L",
+ "htoe_L",
+ "metatarsus_L"
+ ]
+ ],
+ "limits_deg": {
+ "pelvis": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "spine1": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -18,
+ 18
+ ]
+ ],
+ "spine2": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -18,
+ 18
+ ]
+ ],
+ "chest": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -18,
+ 18
+ ]
+ ],
+ "neck1": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "neck2": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ],
+ "head": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ],
+ "tail1": [
+ [
+ -70,
+ 60
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -60,
+ 60
+ ]
+ ],
+ "tail2": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ],
+ "tail3": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ],
+ "tail4": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ],
+ "tail5": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ],
+ "scapula": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -8,
+ 8
+ ]
+ ],
+ "upperarm": [
+ [
+ -60,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "forearm": [
+ [
+ -110,
+ 10
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "metacarpus": [
+ [
+ -20,
+ 120
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "fpaw": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ],
+ "thigh": [
+ [
+ -60,
+ 45
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ],
+ "shin": [
+ [
+ -10,
+ 100
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "metatarsus": [
+ [
+ -90,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ],
+ "hpaw": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ }
+}
\ No newline at end of file
diff --git a/assets/wolf/rigged/rig_info.json b/assets/wolf/rigged/rig_info.json
new file mode 100644
index 0000000..0f74d50
--- /dev/null
+++ b/assets/wolf/rigged/rig_info.json
@@ -0,0 +1,1786 @@
+{
+ "bones": [
+ {
+ "name": "pelvis",
+ "parent": -1,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 9.463255423725059e-07,
+ 0.0
+ ],
+ [
+ 1.2345171285232936e-07,
+ -0.9914543032646179,
+ -0.13045468926429749,
+ 0.36000001430511475
+ ],
+ [
+ 9.382317216477531e-07,
+ 0.13045468926429749,
+ -0.9914615154266357,
+ 0.6399999856948853
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.19163769483566284,
+ "head_joint": "hips",
+ "tail_joint": "spine1",
+ "limits_deg": [
+ [
+ -30,
+ 30
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "spine1",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 1.0,
+ -2.1316282072803006e-14,
+ 6.007508090988267e-08,
+ 0.0
+ ],
+ [
+ 1.5795080798852723e-09,
+ -0.9996539354324341,
+ -0.02630741149187088,
+ 0.17000000178813934
+ ],
+ [
+ 6.004108854540391e-08,
+ 0.02630665898323059,
+ -0.9996611475944519,
+ 0.6650000214576721
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.19006578624248505,
+ "head_joint": "spine1",
+ "tail_joint": "spine2",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -18,
+ 18
+ ]
+ ]
+ },
+ {
+ "name": "spine2",
+ "parent": 1,
+ "matrix_local": [
+ [
+ 1.0,
+ 2.220446049250313e-16,
+ 8.742321000454467e-08,
+ -4.051495806054774e-15
+ ],
+ [
+ -8.081313396246514e-13,
+ -1.0,
+ -9.406358003616333e-07,
+ -0.02000001072883606
+ ],
+ [
+ 8.741020707248026e-08,
+ -1.862645149230957e-09,
+ -1.0000072717666626,
+ 0.6700000166893005
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.19999998807907104,
+ "head_joint": "spine2",
+ "tail_joint": "chest",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -18,
+ 18
+ ]
+ ]
+ },
+ {
+ "name": "chest",
+ "parent": 2,
+ "matrix_local": [
+ [
+ 1.0,
+ -3.552713678800501e-15,
+ 4.2670444599934854e-07,
+ -4.007086715663178e-15
+ ],
+ [
+ 1.349343676793069e-07,
+ -0.9486837387084961,
+ -0.3162265121936798,
+ -0.2199999988079071
+ ],
+ [
+ 4.0479699237039313e-07,
+ 0.31622791290283203,
+ -0.9486909508705139,
+ 0.6700000166893005
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.18973658978939056,
+ "head_joint": "chest",
+ "tail_joint": "neck",
+ "limits_deg": [
+ [
+ -15,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -18,
+ 18
+ ]
+ ]
+ },
+ {
+ "name": "neck1",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 4.2147050294261135e-07,
+ -4.6811665465164645e-15
+ ],
+ [
+ 2.8000786755910667e-07,
+ -0.7474114894866943,
+ -0.6643614768981934,
+ -0.40000003576278687
+ ],
+ [
+ 3.150007898966578e-07,
+ 0.6643655300140381,
+ -0.7474175095558167,
+ 0.7300000190734863
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.12041560560464859,
+ "head_joint": "neck",
+ "tail_joint": "neck2",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "neck2",
+ "parent": 4,
+ "matrix_local": [
+ [
+ 1.0,
+ -3.552713678800501e-15,
+ 1.332818442278949e-07,
+ -4.6811665465164645e-15
+ ],
+ [
+ 9.424330471574649e-08,
+ -0.7071090340614319,
+ -0.7071046829223633,
+ -0.49000003933906555
+ ],
+ [
+ 9.423189339941018e-08,
+ 0.7071090936660767,
+ -0.7071148157119751,
+ 0.8100000023841858
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.09899462759494781,
+ "head_joint": "neck2",
+ "tail_joint": "head",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -35,
+ 35
+ ]
+ ]
+ },
+ {
+ "name": "head",
+ "parent": 5,
+ "matrix_local": [
+ [
+ 1.0,
+ 0.0,
+ 2.3841917595746054e-07,
+ -5.032866061161238e-15
+ ],
+ [
+ -1.2714927777324192e-07,
+ -0.8459278345108032,
+ 0.5332975387573242,
+ -0.5600000619888306
+ ],
+ [
+ 2.0167308889540436e-07,
+ -0.5333021879196167,
+ -0.8459334373474121,
+ 0.8799999952316284
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2718908190727234,
+ "head_joint": "head",
+ "tail_joint": "nose",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -30,
+ 30
+ ]
+ ]
+ },
+ {
+ "name": "tail1",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 1.0,
+ -5.684341886080802e-14,
+ 5.960708904240164e-08,
+ 3.552713678800501e-15
+ ],
+ [
+ -4.9597389306654804e-08,
+ 0.5547026991844177,
+ 0.8320488929748535,
+ 0.44999998807907104
+ ],
+ [
+ -3.307889073767001e-08,
+ -0.8320541977882385,
+ 0.5547080039978027,
+ 0.6650000214576721
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.12619373202323914,
+ "head_joint": "tail1",
+ "tail_joint": "tail2",
+ "limits_deg": [
+ [
+ -70,
+ 60
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -60,
+ 60
+ ]
+ ]
+ },
+ {
+ "name": "tail2",
+ "parent": 7,
+ "matrix_local": [
+ [
+ 1.0,
+ 2.688318250193382e-15,
+ 1.332802526121668e-07,
+ -3.620569488205043e-15
+ ],
+ [
+ -1.1089708351619265e-07,
+ 0.5547027587890625,
+ 0.8320488333702087,
+ 0.5199999809265137
+ ],
+ [
+ -7.394594092602347e-08,
+ -0.8320541381835938,
+ 0.5547080636024475,
+ 0.5600000023841858
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.10816603153944016,
+ "head_joint": "tail2",
+ "tail_joint": "tail3",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ]
+ },
+ {
+ "name": "tail3",
+ "parent": 8,
+ "matrix_local": [
+ [
+ 1.0,
+ 5.329070518200751e-15,
+ 5.400124791776761e-13,
+ -3.329784771478536e-15
+ ],
+ [
+ -1.8189894035458565e-12,
+ 0.6507939100265503,
+ 0.7592546939849854,
+ 0.5799999833106995
+ ],
+ [
+ -1.4658496638730867e-11,
+ -0.7592594027519226,
+ 0.6507997512817383,
+ 0.4699999988079071
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.09219510108232498,
+ "head_joint": "tail3",
+ "tail_joint": "tail4",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ]
+ },
+ {
+ "name": "tail4",
+ "parent": 9,
+ "matrix_local": [
+ [
+ 1.0,
+ -9.615111441416135e-16,
+ 8.429368847373553e-08,
+ -2.838470510203731e-15
+ ],
+ [
+ -5.485883747269327e-08,
+ 0.7592586278915405,
+ 0.6507893800735474,
+ 0.6399999856948853
+ ],
+ [
+ -6.401555907586953e-08,
+ -0.650793194770813,
+ 0.7592650651931763,
+ 0.4000000059604645
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.09219519793987274,
+ "head_joint": "tail4",
+ "tail_joint": "tail5",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ]
+ },
+ {
+ "name": "tail5",
+ "parent": 10,
+ "matrix_local": [
+ [
+ 1.0,
+ -5.773159728050814e-15,
+ 5.960512083902358e-08,
+ -2.9271171668151033e-15
+ ],
+ [
+ -3.5764337269483804e-08,
+ 0.800001859664917,
+ 0.5999978184700012,
+ 0.7099999785423279
+ ],
+ [
+ -4.769891859268682e-08,
+ -0.6000011563301086,
+ 0.8000086545944214,
+ 0.3400000035762787
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.0999998077750206,
+ "head_joint": "tail5",
+ "tail_joint": "tail_tip",
+ "limits_deg": [
+ [
+ -50,
+ 50
+ ],
+ [
+ -15,
+ 15
+ ],
+ [
+ -50,
+ 50
+ ]
+ ]
+ },
+ {
+ "name": "scapula_L",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.9822365045547485,
+ 0.18764732778072357,
+ 8.995635312203376e-07,
+ 0.08000000566244125
+ ],
+ [
+ 0.1362229883670807,
+ -0.7130600214004517,
+ 0.6877418756484985,
+ -0.23999999463558197
+ ],
+ [
+ 0.12905463576316833,
+ -0.6755305528640747,
+ -0.7259600162506104,
+ 0.7400000095367432
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2664572596549988,
+ "head_joint": "scap_L",
+ "tail_joint": "shoulder_L",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -8,
+ 8
+ ]
+ ]
+ },
+ {
+ "name": "scapula_R",
+ "parent": 3,
+ "matrix_local": [
+ [
+ 0.982236385345459,
+ -0.18764735758304596,
+ -9.314165936302743e-07,
+ -0.07999999076128006
+ ],
+ [
+ -0.1362229883670807,
+ -0.7130600214004517,
+ 0.6877416372299194,
+ -0.23999999463558197
+ ],
+ [
+ -0.12905463576316833,
+ -0.6755304932594299,
+ -0.7259601354598999,
+ 0.7400000095367432
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.26645728945732117,
+ "head_joint": "scap_R",
+ "tail_joint": "shoulder_R",
+ "limits_deg": [
+ [
+ -20,
+ 20
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -8,
+ 8
+ ]
+ ]
+ },
+ {
+ "name": "upperarm_L",
+ "parent": 12,
+ "matrix_local": [
+ [
+ 0.9997060298919678,
+ 0.024246571585536003,
+ -7.959177423799702e-07,
+ 0.12999999523162842
+ ],
+ [
+ -0.01528913900256157,
+ 0.6304097771644592,
+ 0.7761121392250061,
+ -0.4300000071525574
+ ],
+ [
+ 0.01881871372461319,
+ -0.7758889198303223,
+ 0.6306003332138062,
+ 0.5600000023841858
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.20621509850025177,
+ "head_joint": "shoulder_L",
+ "tail_joint": "elbow_L",
+ "limits_deg": [
+ [
+ -60,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "upperarm_R",
+ "parent": 13,
+ "matrix_local": [
+ [
+ 0.9997059106826782,
+ -0.0242465827614069,
+ 8.233002972701797e-07,
+ -0.12999999523162842
+ ],
+ [
+ 0.015289152041077614,
+ 0.630409836769104,
+ 0.7761118412017822,
+ -0.43000003695487976
+ ],
+ [
+ -0.018818674609065056,
+ -0.775888979434967,
+ 0.6306007504463196,
+ 0.5600000023841858
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.20621509850025177,
+ "head_joint": "shoulder_R",
+ "tail_joint": "elbow_R",
+ "limits_deg": [
+ [
+ -60,
+ 50
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "forearm_L",
+ "parent": 14,
+ "matrix_local": [
+ [
+ 0.9993334412574768,
+ 0.03650898486375809,
+ 6.737997182426625e-08,
+ 0.13500000536441803
+ ],
+ [
+ 0.006002024747431278,
+ -0.16429048776626587,
+ 0.9863938689231873,
+ -0.30000001192092896
+ ],
+ [
+ 0.036012545228004456,
+ -0.9857434034347534,
+ -0.16440024971961975,
+ 0.3999999761581421
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2739049792289734,
+ "head_joint": "elbow_L",
+ "tail_joint": "wrist_L",
+ "limits_deg": [
+ [
+ -110,
+ 10
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "forearm_R",
+ "parent": 15,
+ "matrix_local": [
+ [
+ 0.9993333220481873,
+ -0.036508992314338684,
+ -7.533327561759506e-08,
+ -0.13500000536441803
+ ],
+ [
+ -0.0060020023956894875,
+ -0.16429057717323303,
+ 0.9863936305046082,
+ -0.30000001192092896
+ ],
+ [
+ -0.036012496799230576,
+ -0.9857437610626221,
+ -0.16440051794052124,
+ 0.3999999761581421
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.2739048898220062,
+ "head_joint": "elbow_R",
+ "tail_joint": "wrist_R",
+ "limits_deg": [
+ [
+ -110,
+ 10
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metacarpus_L",
+ "parent": 16,
+ "matrix_local": [
+ [
+ 0.9892018437385559,
+ 0.14656038582324982,
+ 9.149096058536088e-07,
+ 0.14499999582767487
+ ],
+ [
+ 0.07961879670619965,
+ -0.5373881459236145,
+ 0.8395683169364929,
+ -0.3449999988079071
+ ],
+ [
+ 0.12304892390966415,
+ -0.8305087685585022,
+ -0.5432572960853577,
+ 0.12999993562698364
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.10234689712524414,
+ "head_joint": "wrist_L",
+ "tail_joint": "fpaw_L",
+ "limits_deg": [
+ [
+ -20,
+ 120
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metacarpus_R",
+ "parent": 17,
+ "matrix_local": [
+ [
+ 0.9892017245292664,
+ -0.1465604156255722,
+ -1.0088194812851725e-06,
+ -0.14499999582767487
+ ],
+ [
+ -0.07961873710155487,
+ -0.537388265132904,
+ 0.839568018913269,
+ -0.3449999988079071
+ ],
+ [
+ -0.12304897606372833,
+ -0.8305090069770813,
+ -0.5432577729225159,
+ 0.12999993562698364
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.10234688222408295,
+ "head_joint": "wrist_R",
+ "tail_joint": "fpaw_R",
+ "limits_deg": [
+ [
+ -20,
+ 120
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "fpaw_L",
+ "parent": 18,
+ "matrix_local": [
+ [
+ 1.0000001192092896,
+ 3.866261977236718e-09,
+ 3.9390658912452636e-07,
+ 0.1599999964237213
+ ],
+ [
+ -8.863241873768857e-08,
+ -0.9635187387466431,
+ 0.26764124631881714,
+ -0.4000000059604645
+ ],
+ [
+ 4.145355205764645e-07,
+ -0.26764410734176636,
+ -0.9635252952575684,
+ 0.04499994218349457
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.09340763092041016,
+ "head_joint": "fpaw_L",
+ "tail_joint": "ftoe_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "fpaw_R",
+ "parent": 19,
+ "matrix_local": [
+ [
+ 1.0,
+ 1.3743317595071858e-08,
+ -3.673067681120301e-07,
+ -0.1599999964237213
+ ],
+ [
+ 1.0775761438708287e-07,
+ -0.963518500328064,
+ 0.2676411271095276,
+ -0.4000000059604645
+ ],
+ [
+ -3.0507035830851237e-07,
+ -0.2676440477371216,
+ -0.9635258316993713,
+ 0.044999927282333374
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.09340764582157135,
+ "head_joint": "fpaw_R",
+ "tail_joint": "ftoe_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "thigh_L",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.996503472328186,
+ 0.08355163782835007,
+ 4.1713713017088594e-07,
+ 0.10999999940395355
+ ],
+ [
+ 0.04553456977009773,
+ -0.5430857539176941,
+ 0.8384418487548828,
+ 0.3700000047683716
+ ],
+ [
+ 0.07005394995212555,
+ -0.8355165123939514,
+ -0.5449943542480469,
+ 0.6000000238418579
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.23937290906906128,
+ "head_joint": "hip_L",
+ "tail_joint": "knee_L",
+ "limits_deg": [
+ [
+ -60,
+ 45
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "thigh_R",
+ "parent": 0,
+ "matrix_local": [
+ [
+ 0.996503472328186,
+ -0.08355160802602768,
+ -4.154652231136424e-07,
+ -0.10999999940395355
+ ],
+ [
+ -0.04553455114364624,
+ -0.5430856943130493,
+ 0.8384417295455933,
+ 0.3700000047683716
+ ],
+ [
+ -0.07005393505096436,
+ -0.8355165123939514,
+ -0.5449943542480469,
+ 0.6000000238418579
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.23937292397022247,
+ "head_joint": "hip_R",
+ "tail_joint": "knee_R",
+ "limits_deg": [
+ [
+ -60,
+ 45
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -15,
+ 15
+ ]
+ ]
+ },
+ {
+ "name": "shin_L",
+ "parent": 22,
+ "matrix_local": [
+ [
+ 0.9964285492897034,
+ 0.08444046229124069,
+ -9.26175971471821e-07,
+ 0.12999999523162842
+ ],
+ [
+ -0.050089456140995026,
+ 0.5910829305648804,
+ 0.8050541877746582,
+ 0.23999999463558197
+ ],
+ [
+ 0.06798012554645538,
+ -0.8021841049194336,
+ 0.5932064056396484,
+ 0.4000000059604645
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.23685342073440552,
+ "head_joint": "knee_L",
+ "tail_joint": "hock_L",
+ "limits_deg": [
+ [
+ -10,
+ 100
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "shin_R",
+ "parent": 23,
+ "matrix_local": [
+ [
+ 0.9964285492897034,
+ -0.0844404548406601,
+ 9.267639597965172e-07,
+ -0.12999999523162842
+ ],
+ [
+ 0.05008944869041443,
+ 0.5910828709602356,
+ 0.8050540685653687,
+ 0.23999999463558197
+ ],
+ [
+ -0.06798012554645538,
+ -0.802183985710144,
+ 0.5932064056396484,
+ 0.3999999761581421
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.23685342073440552,
+ "head_joint": "knee_R",
+ "tail_joint": "hock_R",
+ "limits_deg": [
+ [
+ -10,
+ 100
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metatarsus_L",
+ "parent": 24,
+ "matrix_local": [
+ [
+ 0.9935063123703003,
+ 0.11377670615911484,
+ 5.7273939546576e-07,
+ 0.15000000596046448
+ ],
+ [
+ 0.04560361057519913,
+ -0.3982185423374176,
+ 0.9161563515663147,
+ 0.3799999952316284
+ ],
+ [
+ 0.10423827171325684,
+ -0.9102138876914978,
+ -0.40082332491874695,
+ 0.2099999636411667
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.17578284442424774,
+ "head_joint": "hock_L",
+ "tail_joint": "hpaw_L",
+ "limits_deg": [
+ [
+ -90,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "metatarsus_R",
+ "parent": 25,
+ "matrix_local": [
+ [
+ 0.9935063123703003,
+ -0.11377668380737305,
+ -5.575444106398209e-07,
+ -0.15000000596046448
+ ],
+ [
+ -0.045603614300489426,
+ -0.3982185125350952,
+ 0.9161562323570251,
+ 0.3799999952316284
+ ],
+ [
+ -0.10423824936151505,
+ -0.910213828086853,
+ -0.40082329511642456,
+ 0.2099999487400055
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.17578285932540894,
+ "head_joint": "hock_R",
+ "tail_joint": "hpaw_R",
+ "limits_deg": [
+ [
+ -90,
+ 15
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "hpaw_L",
+ "parent": 26,
+ "matrix_local": [
+ [
+ 0.9932202696800232,
+ 0.11624786257743835,
+ 1.2709072052530246e-06,
+ 0.17000000178813934
+ ],
+ [
+ 0.10884594917297363,
+ -0.9299823045730591,
+ 0.3511207103729248,
+ 0.3100000023841858
+ ],
+ [
+ 0.040818601846694946,
+ -0.34874340891838074,
+ -0.9363366365432739,
+ 0.04999998211860657
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.08602314442396164,
+ "head_joint": "hpaw_L",
+ "tail_joint": "htoe_L",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ },
+ {
+ "name": "hpaw_R",
+ "parent": 27,
+ "matrix_local": [
+ [
+ 0.9932202696800232,
+ -0.11624784022569656,
+ -1.252866013601306e-06,
+ -0.17000000178813934
+ ],
+ [
+ -0.10884591937065125,
+ -0.9299821853637695,
+ 0.35112062096595764,
+ 0.3100000023841858
+ ],
+ [
+ -0.040818583220243454,
+ -0.3487433195114136,
+ -0.9363365173339844,
+ 0.04999995231628418
+ ],
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "length": 0.08602316677570343,
+ "head_joint": "hpaw_R",
+ "tail_joint": "htoe_R",
+ "limits_deg": [
+ [
+ -40,
+ 40
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 5
+ ]
+ ]
+ }
+ ],
+ "keypoints": [
+ {
+ "name": "hips",
+ "bone": 0,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.36,
+ 0.64
+ ]
+ },
+ {
+ "name": "spine1",
+ "bone": 1,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.17,
+ 0.665
+ ]
+ },
+ {
+ "name": "spine2",
+ "bone": 2,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.02,
+ 0.67
+ ]
+ },
+ {
+ "name": "chest",
+ "bone": 3,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.22,
+ 0.67
+ ]
+ },
+ {
+ "name": "neck",
+ "bone": 4,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.4,
+ 0.73
+ ]
+ },
+ {
+ "name": "neck2",
+ "bone": 5,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.49,
+ 0.81
+ ]
+ },
+ {
+ "name": "head",
+ "bone": 6,
+ "end": "head",
+ "rest": [
+ 0,
+ -0.56,
+ 0.88
+ ]
+ },
+ {
+ "name": "nose",
+ "bone": 6,
+ "end": "tail",
+ "rest": [
+ 0,
+ -0.79,
+ 0.735
+ ]
+ },
+ {
+ "name": "tail1",
+ "bone": 7,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.45,
+ 0.665
+ ]
+ },
+ {
+ "name": "tail2",
+ "bone": 8,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.52,
+ 0.56
+ ]
+ },
+ {
+ "name": "tail3",
+ "bone": 9,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.58,
+ 0.47
+ ]
+ },
+ {
+ "name": "tail4",
+ "bone": 10,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.64,
+ 0.4
+ ]
+ },
+ {
+ "name": "tail5",
+ "bone": 11,
+ "end": "head",
+ "rest": [
+ 0,
+ 0.71,
+ 0.34
+ ]
+ },
+ {
+ "name": "tail_tip",
+ "bone": 11,
+ "end": "tail",
+ "rest": [
+ 0,
+ 0.79,
+ 0.28
+ ]
+ },
+ {
+ "name": "scap_L",
+ "bone": 12,
+ "end": "head",
+ "rest": [
+ 0.08,
+ -0.24,
+ 0.74
+ ]
+ },
+ {
+ "name": "shoulder_L",
+ "bone": 14,
+ "end": "head",
+ "rest": [
+ 0.13,
+ -0.43,
+ 0.56
+ ]
+ },
+ {
+ "name": "elbow_L",
+ "bone": 16,
+ "end": "head",
+ "rest": [
+ 0.135,
+ -0.3,
+ 0.4
+ ]
+ },
+ {
+ "name": "wrist_L",
+ "bone": 18,
+ "end": "head",
+ "rest": [
+ 0.145,
+ -0.345,
+ 0.13
+ ]
+ },
+ {
+ "name": "fpaw_L",
+ "bone": 20,
+ "end": "head",
+ "rest": [
+ 0.16,
+ -0.4,
+ 0.045
+ ]
+ },
+ {
+ "name": "ftoe_L",
+ "bone": 20,
+ "end": "tail",
+ "rest": [
+ 0.16,
+ -0.49,
+ 0.02
+ ]
+ },
+ {
+ "name": "hip_L",
+ "bone": 22,
+ "end": "head",
+ "rest": [
+ 0.11,
+ 0.37,
+ 0.6
+ ]
+ },
+ {
+ "name": "knee_L",
+ "bone": 24,
+ "end": "head",
+ "rest": [
+ 0.13,
+ 0.24,
+ 0.4
+ ]
+ },
+ {
+ "name": "hock_L",
+ "bone": 26,
+ "end": "head",
+ "rest": [
+ 0.15,
+ 0.38,
+ 0.21
+ ]
+ },
+ {
+ "name": "hpaw_L",
+ "bone": 28,
+ "end": "head",
+ "rest": [
+ 0.17,
+ 0.31,
+ 0.05
+ ]
+ },
+ {
+ "name": "htoe_L",
+ "bone": 28,
+ "end": "tail",
+ "rest": [
+ 0.18,
+ 0.23,
+ 0.02
+ ]
+ },
+ {
+ "name": "scap_R",
+ "bone": 13,
+ "end": "head",
+ "rest": [
+ -0.08,
+ -0.24,
+ 0.74
+ ]
+ },
+ {
+ "name": "shoulder_R",
+ "bone": 15,
+ "end": "head",
+ "rest": [
+ -0.13,
+ -0.43,
+ 0.56
+ ]
+ },
+ {
+ "name": "elbow_R",
+ "bone": 17,
+ "end": "head",
+ "rest": [
+ -0.135,
+ -0.3,
+ 0.4
+ ]
+ },
+ {
+ "name": "wrist_R",
+ "bone": 19,
+ "end": "head",
+ "rest": [
+ -0.145,
+ -0.345,
+ 0.13
+ ]
+ },
+ {
+ "name": "fpaw_R",
+ "bone": 21,
+ "end": "head",
+ "rest": [
+ -0.16,
+ -0.4,
+ 0.045
+ ]
+ },
+ {
+ "name": "ftoe_R",
+ "bone": 21,
+ "end": "tail",
+ "rest": [
+ -0.16,
+ -0.49,
+ 0.02
+ ]
+ },
+ {
+ "name": "hip_R",
+ "bone": 23,
+ "end": "head",
+ "rest": [
+ -0.11,
+ 0.37,
+ 0.6
+ ]
+ },
+ {
+ "name": "knee_R",
+ "bone": 25,
+ "end": "head",
+ "rest": [
+ -0.13,
+ 0.24,
+ 0.4
+ ]
+ },
+ {
+ "name": "hock_R",
+ "bone": 27,
+ "end": "head",
+ "rest": [
+ -0.15,
+ 0.38,
+ 0.21
+ ]
+ },
+ {
+ "name": "hpaw_R",
+ "bone": 29,
+ "end": "head",
+ "rest": [
+ -0.17,
+ 0.31,
+ 0.05
+ ]
+ },
+ {
+ "name": "htoe_R",
+ "bone": 29,
+ "end": "tail",
+ "rest": [
+ -0.18,
+ 0.23,
+ 0.02
+ ]
+ }
+ ],
+ "layout": {
+ "H": 720,
+ "W_FRONT": 420,
+ "W_SIDE": 860,
+ "M_PER_PX": 0.002638888888888889,
+ "GROUND_V": 630,
+ "Z_CENTER": 0.7125,
+ "Y_CENTER": 0.0,
+ "X_CENTER": 0.0
+ }
+}
\ No newline at end of file
diff --git a/blender/add_fur_bones.py b/blender/add_fur_bones.py
new file mode 100644
index 0000000..a41cf9a
--- /dev/null
+++ b/blender/add_fur_bones.py
@@ -0,0 +1,122 @@
+"""Add spring-driven fur bones to the rigged wolf: ears, the neck ruff (left and right), the chest tuft and the belly
+fringe. Only the outer layer of fur follows them (weights fade in with distance from the body's core), so the body
+holds its shape while the fur lags, swings and settles. The solver never sees these bones: blender/apply_motion.py
+--springs simulates them from the solved motion.
+
+blender -b -P blender/add_fur_bones.py -- rigged.blend out_dir
+Writes out_dir/rigged.blend, a copy of rig_info.json (unchanged skeleton for the solver) and fur.json (spring settings).
+"""
+import json, pathlib, shutil, sys
+
+import bpy
+import numpy as np
+from mathutils import Vector
+
+args = sys.argv[sys.argv.index("--") + 1:]
+src, out = pathlib.Path(args[0]), pathlib.Path(args[1])
+out.mkdir(parents=True, exist_ok=True)
+bpy.ops.wm.open_mainfile(filepath=str(src))
+rig, body = bpy.data.objects["rig"], bpy.data.objects["body"]
+co = np.array([v.co[:] for v in body.data.vertices])
+x, y, z = co.T
+
+
+def seg_dist(p, a, b):
+ a, b = np.asarray(a), np.asarray(b)
+ t = np.clip(((p - a) @ (b - a)) / ((b - a) @ (b - a)), 0, 1)
+ return np.linalg.norm(a + np.outer(t, b - a) - p, axis=1)
+
+
+def smooth01(v):
+ v = np.clip(v, 0, 1)
+ return v * v * (3 - 2 * v)
+
+
+# the core the fur hangs off: chest -> neck -> head, and the spine
+neck_core = np.min([seg_dist(co, a, b) for a, b in (((0, -0.22, 0.67), (0, -0.40, 0.73)), ((0, -0.40, 0.73), (0, -0.49, 0.81)),
+ ((0, -0.49, 0.81), (0, -0.56, 0.88)))], axis=0)
+legs = np.zeros(len(co))
+for vg in body.vertex_groups:
+ if any(k in vg.name for k in ("upperarm", "forearm", "metacarpus", "fpaw", "thigh", "shin", "metatarsus", "hpaw")):
+ for v in body.data.vertices:
+ for g in v.groups:
+ if g.group == vg.index:
+ legs[v.index] += g.weight
+not_leg = 1 - smooth01(legs / 0.6)
+
+fur = {}
+# ears: the parts of the head above the skull, one per side
+for side, s in (("L", 1), ("R", -1)):
+ m = (z > 0.95) & (y > -0.70) & (y < -0.42) & (s * x > 0.01)
+ base = co[m & (z < 0.99)].mean(0)
+ tip = co[m][np.argmax(z[m])]
+ w = np.where(m, smooth01((z - 0.95) / 0.06), 0)
+ fur[f"ear_{side}"] = {"head": base, "tail": tip, "parent": "head", "w": w, "freq": 5.0, "damping": 0.45, "max_deg": 25}
+# neck ruff: outer fur on each side of the neck and shoulders, as three clumps (upper, middle, lower) plus the crest
+outer = smooth01((neck_core - 0.10) / 0.10)
+clumps = (("upper", 0.80, 1.00, (0.08, -0.47, 0.86), (0.14, -0.43, 0.74), 2.4, 0.25),
+ ("mid", 0.66, 0.84, (0.11, -0.40, 0.76), (0.17, -0.35, 0.62), 2.1, 0.22),
+ ("lower", 0.48, 0.70, (0.13, -0.34, 0.66), (0.18, -0.30, 0.52), 1.9, 0.22))
+for side, s in (("L", 1), ("R", -1)):
+ for tag, z0, z1, h, tl, f, dmp in clumps:
+ region = (y > -0.64) & (y < -0.10) & (s * x > 0.0) & ~((z > 0.92) & (y < -0.45))
+ band = smooth01((z - z0) / 0.06) * smooth01((z1 - z) / 0.06)
+ w = np.where(region, outer * band * smooth01(s * x / 0.04) * not_leg, 0)
+ fur[f"ruff_{tag}_{side}"] = {"head": np.array([s * h[0], h[1], h[2]]), "tail": np.array([s * tl[0], tl[1], tl[2]]),
+ "parent": "neck1" if tag != "lower" else "chest", "w": w, "freq": f,
+ "damping": dmp, "max_deg": 30, "gravity": 0.45}
+region = (np.abs(x) < 0.08) & (y > -0.50) & (y < -0.12) & (z > 0.80)
+fur["crest"] = {"head": np.array([0, -0.44, 0.90]), "tail": np.array([0, -0.30, 0.95]), "parent": "neck2",
+ "w": np.where(region, smooth01((neck_core - 0.10) / 0.08), 0), "freq": 2.6, "damping": 0.25,
+ "max_deg": 25, "gravity": 0.3}
+# chest tuft hanging under the neck
+region = (np.abs(x) < 0.11) & (y > -0.64) & (y < -0.38) & (z > 0.36) & (z < 0.64)
+fur["chest_tuft"] = {"head": np.array([0, -0.52, 0.62]), "tail": np.array([0, -0.50, 0.44]), "parent": "chest",
+ "w": np.where(region, smooth01((0.64 - z) / 0.12) * not_leg, 0), "freq": 2.6, "damping": 0.25, "max_deg": 30,
+ "gravity": 0.5}
+# belly fringe, each side
+for side, s in (("L", 1), ("R", -1)):
+ region = (y > -0.26) & (y < 0.18) & (z < 0.54) & (s * x > -0.02)
+ w = np.where(region, smooth01((0.54 - z) / 0.09) * not_leg, 0)
+ fur[f"belly_{side}"] = {"head": np.array([s * 0.10, -0.05, 0.52]), "tail": np.array([s * 0.12, -0.03, 0.41]),
+ "parent": "spine2", "w": w, "freq": 2.8, "damping": 0.25, "max_deg": 25,
+ "gravity": 0.5}
+
+bpy.context.view_layer.objects.active = rig
+bpy.ops.object.mode_set(mode="EDIT")
+for name, f in fur.items():
+ b = rig.data.edit_bones.new(name)
+ b.head, b.tail = Vector(f["head"].tolist()), Vector(f["tail"].tolist())
+ zv = Vector((1, 0, 0)).cross((b.tail - b.head).normalized())
+ b.align_roll(zv.normalized() if zv.length > 1e-4 else Vector((0, 0, 1)))
+ b.parent = rig.data.edit_bones[f["parent"]]
+bpy.ops.object.mode_set(mode="OBJECT")
+
+# blend the fur weights in: fur takes up to 85% of a vertex, the body bones keep the rest, still 4 bones max
+nv = len(co)
+names = [g.name for g in body.vertex_groups]
+W = np.zeros((nv, len(names)))
+for v in body.data.vertices:
+ for g in v.groups:
+ W[v.index, g.group] = g.weight
+F = np.stack([0.85 * f["w"] for f in fur.values()], 1)
+tot = F.sum(1, keepdims=True)
+F = np.where(tot > 0.85, F * 0.85 / tot.clip(1e-9), F)
+W = np.hstack([W * (1 - F.sum(1, keepdims=True)), F])
+keep = np.argsort(-W, axis=1)[:, :4]
+mask = np.zeros_like(W, bool)
+np.put_along_axis(mask, keep, True, axis=1)
+W = np.where(mask, W, 0)
+W /= W.sum(1, keepdims=True).clip(1e-9)
+for name in fur:
+ body.vertex_groups.new(name=name)
+for gi, vg in enumerate(body.vertex_groups):
+ vg.remove(list(range(nv)))
+ for i in np.nonzero(W[:, gi] > 1e-4)[0]:
+ vg.add([int(i)], float(W[i, gi]), "REPLACE")
+print("fur bones:", {n: int((f["w"] > 0.05).sum()) for n, f in fur.items()}, "vertices each")
+
+bpy.ops.wm.save_as_mainfile(filepath=str(out / "rigged.blend"))
+shutil.copy(src.parent / "rig_info.json", out / "rig_info.json")
+json.dump({n: {k: f.get(k, 0.0) for k in ("parent", "freq", "damping", "max_deg", "gravity")} for n, f in fur.items()}, open(out / "fur.json", "w"), indent=1)
+print("saved", out)
diff --git a/blender/apply_motion.py b/blender/apply_motion.py
new file mode 100644
index 0000000..9fdb16e
--- /dev/null
+++ b/blender/apply_motion.py
@@ -0,0 +1,206 @@
+"""Put a solved (or made-up) motion on the rig: keyframes, true joint positions, renders and a GLB.
+
+blender -b -P blender/apply_motion.py -- rigged.blend rig_info.json motion.json out_dir [options]
+ --views front,side,persp which cameras to render (default none)
+ --engine cycles|workbench (default cycles)
+ --paint keep the leg paint (the exam needs it; the showcase does not)
+ --blur motion blur from the keyframes, like a video model's fast limbs
+ --glb export out_dir/animation.glb
+ --frames 10,40,80 render only these frames (stills), for quick comparisons
+ --springs fur.json simulate the fur bones (blender/add_fur_bones.py) as damped springs
+ --scale 0.75 render at this fraction of the layout size
+ --ghost render the mesh as an x-ray ghost (workbench), for drawing a skeleton over
+Always writes out_dir/joints.json, the world position of every joint per frame from Blender itself, and for every
+rendered view out_dir/cam_<view>.json, its pixel projection (common.camera_json).
+"""
+import json, math, pathlib, sys
+
+import bpy
+import numpy as np
+from mathutils import Matrix, Quaternion, Vector
+
+sys.path.insert(0, str(pathlib.Path(__file__).parent))
+import common # noqa: E402
+
+args = sys.argv[sys.argv.index("--") + 1:]
+blend, info_path, motion_path, out = args[:4]
+opts = args[4:]
+opt = lambda k, d=None: opts[opts.index(k) + 1] if k in opts else d
+out = pathlib.Path(out)
+out.mkdir(parents=True, exist_ok=True)
+
+bpy.ops.wm.open_mainfile(filepath=blend)
+scene = bpy.context.scene
+info = json.load(open(info_path))
+motion = json.load(open(motion_path))
+rig, body = bpy.data.objects["rig"], bpy.data.objects["body"]
+names = motion["bones"]
+T = len(motion["euler"])
+fps = motion.get("fps", 24)
+scene.render.fps = round(fps)
+scene.render.fps_base = round(fps) / fps
+scene.frame_start, scene.frame_end = 0, T - 1
+
+if "--paint" not in opts:
+ attr = body.data.color_attributes["legpaint"]
+ rgba = np.zeros(len(attr.data) * 4)
+ attr.data.foreach_set("color", rgba)
+
+root = names[0]
+B = rig.data.bones[root].matrix_local.to_3x3()
+for pb in rig.pose.bones:
+ pb.rotation_mode = "XYZ"
+rig.pose.bones[root].rotation_mode = "QUATERNION"
+for t in range(T):
+ pr = rig.pose.bones[root]
+ pr.rotation_quaternion = Quaternion(motion["root_quat"][t])
+ pr.location = B.transposed() @ Vector(motion["trans"][t])
+ pr.keyframe_insert("rotation_quaternion", frame=t)
+ pr.keyframe_insert("location", frame=t)
+ for i, n in enumerate(names[1:], 1):
+ pb = rig.pose.bones[n]
+ pb.rotation_euler = motion["euler"][t][i]
+ pb.keyframe_insert("rotation_euler", frame=t)
+for fc in rig.animation_data.action.fcurves if hasattr(rig.animation_data.action, "fcurves") else []:
+ for k in fc.keyframe_points:
+ k.interpolation = "LINEAR"
+
+if opt("--springs"):
+ # Secondary motion for the fur bones: each tip is a damped spring chasing a target, so fur lags behind the
+ # body, overshoots and settles. The target is the rigid (sculpted) direction pulled part of the way back toward
+ # the bone's rest direction in the world ("gravity": fur keeps hanging down when the body rears or sits).
+ # Sub-stepped, the tip kept at bone length and within max_deg of the target.
+ springs = json.load(open(opt("--springs")))
+ sub = 6
+ dt = 1.0 / (fps * sub)
+ state, swing = {}, {n: [] for n in springs}
+ rest_world = {}
+ for name in springs:
+ b = rig.data.bones[name]
+ rest_world[name] = (rig.matrix_world.to_3x3() @ (b.tail_local - b.head_local)).normalized()
+ for t in range(T):
+ scene.frame_set(t)
+ for name, s in springs.items():
+ pb = rig.pose.bones[name]
+ par = pb.parent
+ rigid = rig.matrix_world @ par.matrix @ (par.bone.matrix_local.inverted() @ pb.bone.matrix_local)
+ L = pb.bone.length
+ head = rigid.translation.copy()
+ rdir = (rigid @ Vector((0, L, 0)) - head).normalized()
+ gdir = rdir.slerp(rest_world[name], s.get("gravity", 0.0))
+ target = head + gdir * L
+ if name not in state:
+ state[name] = {"x": target.copy(), "v": Vector((0, 0, 0)), "h": head, "g": target}
+ st = state[name]
+ w = 2 * math.pi * s["freq"]
+ k, c = w * w, 2 * s["damping"] * w
+ cos_max = math.cos(math.radians(s["max_deg"]))
+ for i in range(1, sub + 1):
+ a = i / sub
+ h, g = st["h"].lerp(head, a), st["g"].lerp(target, a)
+ st["v"] += (k * (g - st["x"]) - c * st["v"]) * dt
+ st["x"] += st["v"] * dt
+ d = (st["x"] - h).normalized()
+ gd = (g - h).normalized()
+ if d.dot(gd) < cos_max: # past the swing limit: put it on the cone's edge
+ axis = gd.cross(d).normalized()
+ d = gd.copy()
+ d.rotate(Quaternion(axis, math.radians(s["max_deg"])))
+ st["x"] = h + d * L
+ st["h"], st["g"] = head, target
+ final = (st["x"] - head).normalized()
+ swing[name].append(math.degrees(math.acos(max(-1.0, min(1.0, final.dot(rdir))))))
+ local = rigid.to_3x3().inverted() @ final
+ pb.rotation_mode = "QUATERNION"
+ pb.rotation_quaternion = Vector((0, 1, 0)).rotation_difference(local)
+ pb.keyframe_insert("rotation_quaternion", frame=t)
+ print("springs simulated (swing from the sculpted direction, mean / max deg):",
+ {n: (round(sum(v) / len(v), 1), round(max(v), 1)) for n, v in swing.items()})
+
+joints = []
+for t in range(T):
+ scene.frame_set(t)
+ mw = rig.matrix_world
+ row = []
+ for kp in info["keypoints"]:
+ pb = rig.pose.bones[info["bones"][kp["bone"]]["name"]]
+ row.append(list(mw @ (pb.head if kp["end"] == "head" else pb.tail)))
+ joints.append(row)
+json.dump({"names": [k["name"] for k in info["keypoints"]], "joints": joints, "fps": fps}, open(out / "joints.json", "w"))
+print("joints written", T, "frames")
+
+views = [v for v in opt("--views", "").split(",") if v]
+if views:
+ engine = "ghost" if "--ghost" in opts else opt("--engine", "cycles")
+ if engine == "ghost":
+ scene.render.engine = "BLENDER_WORKBENCH"
+ scene.display.shading.light = "FLAT"
+ scene.display.shading.color_type = "SINGLE"
+ scene.display.shading.single_color = (0.55, 0.56, 0.6)
+ scene.display.shading.show_xray = True
+ scene.display.shading.xray_alpha = 0.18
+ scene.render.film_transparent = True
+ elif engine == "cycles":
+ common.studio(scene, samples=int(opt("--samples", 32)))
+ scene.cycles.use_adaptive_sampling = True
+ scene.cycles.denoising_use_gpu = True
+ scene.render.threads_mode = "FIXED"
+ scene.render.threads = 4
+ else:
+ scene.render.engine = "BLENDER_WORKBENCH"
+ scene.display.shading.light = "STUDIO"
+ scene.display.shading.color_type = "TEXTURE"
+ scene.render.film_transparent = True
+ scene.render.use_motion_blur = "--blur" in opts
+ scene.render.motion_blur_shutter = 0.5
+ cams = common.cameras(scene)
+ if "persp" in views: # a three-quarter showcase camera (--cam x,y,z --target x,y,z --lens mm --res WxH)
+ cam = bpy.data.objects.new("cam_persp", bpy.data.cameras.new("cam_persp"))
+ scene.collection.objects.link(cam)
+ cam.data.lens = float(opt("--lens", 50))
+ vec = lambda k, d: Vector([float(x) for x in opt(k, d).split(",")])
+ target = vec("--target", "0,0,0.5")
+ cam.location = vec("--cam", "-3.2,-3.0,1.6")
+ cam.rotation_euler = (target - cam.location).to_track_quat("-Z", "Y").to_euler()
+ cam.data.clip_end = 200
+ pw, ph = (int(x) for x in opt("--res", "1280x720").split("x"))
+ cams["cam_persp"] = (cam, (pw, ph))
+ floor = None
+ if "persp" in views and engine == "cycles": # a shadow catcher, so the creature stands on the ground in 3/4 shots
+ bpy.ops.mesh.primitive_plane_add(size=80, location=(0, 0, 0))
+ floor = bpy.context.object
+ floor.is_shadow_catcher = True
+ for v in views:
+ cam, w = cams[f"cam_{v}"]
+ scene.camera = cam
+ if floor is not None:
+ floor.hide_render = v != "persp"
+ k = float(opt("--scale", 1.0))
+ w, hgt = w if isinstance(w, tuple) else (w, common.H)
+ scene.render.resolution_x = round(w * k)
+ scene.render.resolution_y = round(hgt * k)
+ json.dump(common.camera_json(cam, scene.render.resolution_x, scene.render.resolution_y), open(out / f"cam_{v}.json", "w"))
+ d = out / v
+ d.mkdir(exist_ok=True)
+ scene.render.image_settings.file_format = "PNG"
+ scene.render.image_settings.color_mode = "RGBA"
+ if opt("--frames"):
+ for f in [int(x) for x in opt("--frames").split(",")]:
+ scene.frame_set(f)
+ scene.render.filepath = str(d / f"f_{f:04d}.png")
+ bpy.ops.render.render(write_still=True)
+ else:
+ scene.render.filepath = str(d / "f_")
+ bpy.ops.render.render(animation=True)
+ print("rendered", v, flush=True)
+
+if "--glb" in opts:
+ bpy.ops.object.select_all(action="DESELECT")
+ rig.select_set(True)
+ body.select_set(True)
+ for o in list(scene.objects):
+ if o.type in ("CAMERA", "LIGHT"):
+ o.select_set(False)
+ bpy.ops.export_scene.gltf(filepath=str(out / "animation.glb"), use_selection=True, export_animations=True,
+ export_force_sampling=True, export_frame_range=True)
+ print("glb written")
diff --git a/blender/build_rig.py b/blender/build_rig.py
new file mode 100644
index 0000000..2ab292d
--- /dev/null
+++ b/blender/build_rig.py
@@ -0,0 +1,125 @@
+"""Build the creature's armature from rig.json, skin it with Blender's automatic weights, paint the legs and save.
+
+blender -b -P blender/build_rig.py -- static.blend rig.json out_dir [preview]
+"preview" only renders the joints over an x-ray of the mesh (side, front, top) so they can be checked.
+Otherwise writes rigged.blend, rig_info.json (rest matrices, parents, keypoints for the solver) and test renders.
+"""
+import json, math, pathlib, sys
+
+import bpy
+import numpy as np
+from mathutils import Euler, Vector
+
+sys.path.insert(0, str(pathlib.Path(__file__).parent))
+import common # noqa: E402
+
+args = sys.argv[sys.argv.index("--") + 1:]
+static_blend, rig_json, out = args[:3]
+preview = len(args) > 3 and args[3] == "preview"
+out = pathlib.Path(out)
+out.mkdir(parents=True, exist_ok=True)
+
+bpy.ops.wm.open_mainfile(filepath=static_blend)
+body = bpy.data.objects["body"]
+joints, bones, limits = common.load_rig(rig_json)
+
+if preview:
+ common.stick_figure(joints, bones)
+ common.xray_views(out, "joints")
+ raise SystemExit
+
+# Tripo's GLB splits vertices along every texture seam (185 pieces). Merge them back into one surface first, or the
+# automatic weights stop at each seam and neighbouring patches pull apart when a joint bends. UVs live on face
+# corners, so the texture is unaffected.
+bpy.context.view_layer.objects.active = body
+bpy.ops.object.mode_set(mode="EDIT")
+bpy.ops.mesh.select_all(action="SELECT")
+n0 = len(body.data.vertices)
+bpy.ops.mesh.remove_doubles(threshold=1e-5)
+bpy.ops.object.mode_set(mode="OBJECT")
+print("merged seam vertices:", n0, "->", len(body.data.vertices))
+
+arm_data = bpy.data.armatures.new("rig")
+arm = bpy.data.objects.new("rig", arm_data)
+bpy.context.scene.collection.objects.link(arm)
+bpy.context.view_layer.objects.active = arm
+bpy.ops.object.mode_set(mode="EDIT")
+eb = {}
+for name, h, t, parent in bones:
+ b = arm_data.edit_bones.new(name)
+ b.head, b.tail = Vector(joints[h]), Vector(joints[t])
+ d = (b.tail - b.head).normalized()
+ z = Vector((1, 0, 0)).cross(d)
+ if z.length < 0.5: # runs mostly along X: local X horizontal and across the bone
+ xl = Vector((0, 0, 1)).cross(d)
+ z = xl.normalized().cross(d) if xl.length > 1e-4 else Vector((0, 0, 1))
+ b.align_roll(z.normalized()) # local X = world X for bones in the body's plane: flexion is about X
+ eb[name] = b
+for name, h, t, parent in bones:
+ if parent:
+ eb[name].parent = eb[parent]
+ eb[name].use_connect = False
+bpy.ops.object.mode_set(mode="OBJECT")
+
+bpy.ops.object.select_all(action="DESELECT")
+body.select_set(True)
+arm.select_set(True)
+bpy.context.view_layer.objects.active = arm
+bpy.ops.object.parent_set(type="ARMATURE_AUTO")
+
+# vertices the heat solve missed go fully to the nearest bone segment
+names = [b[0] for b in bones]
+segs = np.array([[joints[h], joints[t]] for _, h, t, _ in bones])
+groups = {g.index: g.name for g in body.vertex_groups}
+missing = 0
+for v in body.data.vertices:
+ if sum(g.weight for g in v.groups) < 1e-3:
+ p = np.array(v.co[:])
+ a, b = segs[:, 0], segs[:, 1]
+ t = np.clip(((p - a) * (b - a)).sum(1) / ((b - a) ** 2).sum(1), 0, 1)
+ d = np.linalg.norm(a + (b - a) * t[:, None] - p, axis=1)
+ body.vertex_groups[names[int(d.argmin())]].add([v.index], 1.0, "REPLACE")
+ missing += 1
+print("vertices without weights fixed:", missing)
+
+# soften the weight borders (a few Laplacian passes over mesh edges), then keep at most 4 bones per vertex (what
+# game engines skin with) and normalise
+nv, ng = len(body.data.vertices), len(body.vertex_groups)
+W = np.zeros((nv, ng))
+for v in body.data.vertices:
+ for g in v.groups:
+ W[v.index, g.group] = g.weight
+E = np.array([e.vertices[:] for e in body.data.edges])
+deg = np.bincount(E.ravel(), minlength=nv)[:, None].clip(1)
+for _ in range(3):
+ acc = np.zeros_like(W)
+ np.add.at(acc, E[:, 0], W[E[:, 1]])
+ np.add.at(acc, E[:, 1], W[E[:, 0]])
+ W = 0.5 * W + 0.5 * acc / deg
+keep = np.argsort(-W, axis=1)[:, :4]
+mask = np.zeros_like(W, bool)
+np.put_along_axis(mask, keep, True, axis=1)
+W = np.where(mask, W, 0)
+W /= W.sum(1, keepdims=True).clip(1e-9)
+for gi, vg in enumerate(body.vertex_groups):
+ vg.remove(list(range(nv)))
+ idx = np.nonzero(W[:, gi] > 1e-4)[0]
+ for i in idx:
+ vg.add([int(i)], float(W[i, gi]), "REPLACE")
+print("weights smoothed; max bones per vertex:", int((W > 1e-4).sum(1).max()))
+
+common.paint_legs(body)
+common.write_rig_info(arm, joints, bones, limits, out / "rig_info.json")
+bpy.ops.wm.save_as_mainfile(filepath=str(out / "rigged.blend"))
+print("saved", out / "rigged.blend")
+
+# a test pose: front-left leg folded, hind-right stepping, head down, tail up
+test = {"upperarm_L": (-30, 0, 0), "forearm_L": (-70, 0, 0), "metacarpus_L": (90, 0, 0),
+ "thigh_R": (-35, 0, 0), "shin_R": (60, 0, 0), "metatarsus_R": (-60, 0, 0),
+ "neck1": (25, 0, 0), "head": (20, 0, 15), "tail1": (-30, 0, 0), "tail2": (-20, 0, 10)}
+for name, deg in [(n, d) for n, d in test.items() if n in arm.pose.bones]:
+ pb = arm.pose.bones[name]
+ pb.rotation_mode = "XYZ"
+ pb.rotation_euler = Euler([math.radians(a) for a in deg], "XYZ")
+common.studio(bpy.context.scene)
+common.render_views(out, "testpose", res=(640, 480))
diff --git a/blender/common.py b/blender/common.py
new file mode 100644
index 0000000..c80f785
--- /dev/null
+++ b/blender/common.py
@@ -0,0 +1,240 @@
+"""Shared Blender helpers: the rig file, the two-camera layout, the studio, limb paint and debug renders.
+
+The layout is the contract between every stage. One 1280 x 720 frame holds two orthographic views at the same scale:
+the front camera (left) looks along +Y at the creature's face, the side camera (right) looks along +X at its right
+flank, head to the right. Both share the vertical axis, so a joint's height is the same row in both halves; that is
+what makes two views enough for 3D and what the sync check measures.
+
+The creature is chosen with MOCAP_CREATURE=<assets dir>, whose creature.json can set its own framing (a dragon's
+wingspan needs a wider front view) and limb paint groups. Without it, the wolf's settings below apply.
+"""
+import json, math, os, pathlib
+
+import bpy
+import numpy as np
+from mathutils import Vector
+
+H = 720
+W_FRONT, W_SIDE = 420, 860
+M_PER_PX = 1.9 / H # 1.9 m of height in frame
+GROUND_V = 630 # pixel row of the ground (z = 0); the 90 rows below it are the floor band
+LEG_COLORS = {"FL": "#F53CD1", "FR": "#2F6BFF", "HL": "#FFD21F", "HR": "#19D3E0"}
+LEG_BONES = {"FL": ["upperarm_L", "forearm_L", "metacarpus_L", "fpaw_L"],
+ "FR": ["upperarm_R", "forearm_R", "metacarpus_R", "fpaw_R"],
+ "HL": ["thigh_L", "shin_L", "metatarsus_L", "hpaw_L"],
+ "HR": ["thigh_R", "shin_R", "metatarsus_R", "hpaw_R"]}
+CREATURE = os.environ.get("MOCAP_CREATURE")
+if CREATURE and (pathlib.Path(CREATURE) / "creature.json").exists():
+ _c = json.load(open(pathlib.Path(CREATURE) / "creature.json"))
+ _l = _c.get("layout", {})
+ W_FRONT, W_SIDE = _l.get("W_FRONT", W_FRONT), _l.get("W_SIDE", W_SIDE)
+ M_PER_PX = _l.get("M_PER_PX", M_PER_PX)
+ GROUND_V = _l.get("GROUND_V", GROUND_V)
+ if "paint" in _c:
+ LEG_COLORS = {k: v["color"] for k, v in _c["paint"].items()}
+ LEG_BONES = {k: v["bones"] for k, v in _c["paint"].items()}
+Z_CENTER = (GROUND_V - H / 2) * M_PER_PX
+LAYOUT = {"H": H, "W_FRONT": W_FRONT, "W_SIDE": W_SIDE, "M_PER_PX": M_PER_PX, "GROUND_V": GROUND_V,
+ "Z_CENTER": Z_CENTER, "Y_CENTER": 0.0, "X_CENTER": 0.0}
+
+
+def mirror(name):
+ return name[:-2] + "_R" if name and name.endswith("_L") else name
+
+
+def load_rig(path):
+ """Joints and bones from rig.json with every _L mirrored to _R, and per-bone Euler limits in degrees."""
+ rig = json.load(open(path))
+ joints = dict(rig["joints"])
+ for k, v in rig["joints"].items():
+ if k.endswith("_L") and mirror(k) not in rig["joints"]:
+ joints[mirror(k)] = [-v[0], v[1], v[2]]
+ bones = []
+ for b in rig["bones"]:
+ bones.append(b)
+ if b[0].endswith("_L"):
+ bones.append([mirror(x) for x in b])
+ limits = {}
+ for name, *_ in bones:
+ key = name if name in rig["limits_deg"] else name[:-2]
+ limits[name] = rig["limits_deg"][key]
+ return joints, bones, limits
+
+
+def srgb_to_linear(hexcol):
+ c = np.array([int(hexcol[i:i + 2], 16) / 255 for i in (1, 3, 5)])
+ return np.where(c <= 0.04045, c / 12.92, ((c + 0.055) / 1.055) ** 2.4)
+
+
+def paint_legs(body, threshold=0.55):
+ """Colour each leg from the shoulder or hip down to the paw, as a color attribute mixed over the texture."""
+ idx = {g.name: g.index for g in body.vertex_groups}
+ n = len(body.data.vertices)
+ w = {leg: np.zeros(n) for leg in LEG_BONES}
+ for v in body.data.vertices:
+ for g in v.groups:
+ for leg, names in LEG_BONES.items():
+ if body.vertex_groups[g.group].name in names:
+ w[leg][v.index] += g.weight
+ rgba = np.zeros((n, 4))
+ for leg, col in LEG_COLORS.items():
+ m = w[leg] > threshold
+ rgba[m, :3] = srgb_to_linear(col)
+ rgba[m, 3] = 1.0
+ attr = body.data.color_attributes.get("legpaint") or body.data.color_attributes.new("legpaint", "FLOAT_COLOR", "POINT")
+ attr.data.foreach_set("color", rgba.ravel())
+ for slot in body.material_slots:
+ nt = slot.material.node_tree
+ bsdf = next(nd for nd in nt.nodes if nd.type == "BSDF_PRINCIPLED")
+ src = bsdf.inputs["Base Color"].links[0].from_socket if bsdf.inputs["Base Color"].links else None
+ ca = nt.nodes.new("ShaderNodeVertexColor")
+ ca.layer_name = "legpaint"
+ mix = nt.nodes.new("ShaderNodeMix")
+ mix.data_type = "RGBA"
+ nt.links.new(ca.outputs["Alpha"], mix.inputs["Factor"])
+ if src is not None:
+ nt.links.new(src, mix.inputs["A"])
+ else:
+ mix.inputs["A"].default_value = bsdf.inputs["Base Color"].default_value
+ nt.links.new(ca.outputs["Color"], mix.inputs["B"])
+ nt.links.new(mix.outputs["Result"], bsdf.inputs["Base Color"])
+ print("painted vertices", {leg: int((w[leg] > threshold).sum()) for leg in w})
+
+
+def write_rig_info(arm, joints, bones, limits, path):
+ """Everything the solver needs to redo Blender's forward kinematics, plus which bone end each joint sits on."""
+ order = [b[0] for b in bones]
+ info = {"bones": [], "keypoints": [], "layout": LAYOUT}
+ for name, h, t, parent in bones:
+ bb = arm.data.bones[name]
+ info["bones"].append({"name": name, "parent": order.index(parent) if parent else -1,
+ "matrix_local": [list(r) for r in bb.matrix_local], "length": bb.length,
+ "head_joint": h, "tail_joint": t, "limits_deg": limits[name]})
+ for j in joints:
+ src = next(((i, "head") for i, b in enumerate(bones) if b[1] == j), None) or \
+ next(((i, "tail") for i, b in enumerate(bones) if b[2] == j), None)
+ info["keypoints"].append({"name": j, "bone": src[0], "end": src[1], "rest": joints[j]})
+ json.dump(info, open(path, "w"), indent=1)
+
+
+def cameras(scene):
+ """The front and side orthographic cameras of the layout (created once, reused)."""
+ cams = {}
+ for name, loc, rot, w in (("cam_front", (0, -20, Z_CENTER), (math.pi / 2, 0, 0), W_FRONT),
+ ("cam_side", (-20, 0, Z_CENTER), (math.pi / 2, 0, -math.pi / 2), W_SIDE)):
+ cam = bpy.data.objects.get(name)
+ if cam is None:
+ cam = bpy.data.objects.new(name, bpy.data.cameras.new(name))
+ scene.collection.objects.link(cam)
+ cam.location, cam.rotation_euler = loc, rot
+ cam.data.type = "ORTHO"
+ cam.data.ortho_scale = M_PER_PX * max(w, H)
+ cam.data.clip_end = 100
+ cams[name] = (cam, w)
+ return cams
+
+
+def camera_json(cam, w, h):
+ """The camera's pixel projection, so 2D drawings can be laid exactly over its renders:
+ pc = R @ p + t; perspective u = cx + f * pc.x / -pc.z, v = cy - f * pc.y / -pc.z; ortho u = cx + f * pc.x."""
+ bpy.context.view_layer.update() # a camera placed from Python has a stale matrix_world until the next update
+ mw = cam.matrix_world.normalized()
+ R = mw.to_3x3().transposed()
+ t = -(R @ mw.translation)
+ if cam.data.type == "ORTHO":
+ f = max(w, h) / cam.data.ortho_scale
+ else:
+ f = cam.data.lens / cam.data.sensor_width * max(w, h)
+ return {"type": cam.data.type, "f": f, "cx": w / 2, "cy": h / 2, "res": [w, h],
+ "R": [list(r) for r in R], "t": list(t), "location": list(cam.location)}
+
+
+def studio(scene, samples=32, seed=None):
+ """Cycles on CUDA, transparent film, Standard view transform (keeps the leg paint saturated), three suns."""
+ scene.render.engine = "CYCLES"
+ prefs = bpy.context.preferences.addons["cycles"].preferences
+ prefs.compute_device_type = "CUDA"
+ prefs.get_devices()
+ for d in prefs.devices:
+ d.use = d.type == "CUDA"
+ scene.cycles.device = "GPU"
+ scene.cycles.samples = samples
+ scene.cycles.use_denoising = True
+ scene.cycles.max_bounces = 4
+ scene.render.film_transparent = True
+ scene.view_settings.view_transform = "Standard"
+ scene.render.image_settings.file_format = "PNG"
+ scene.render.image_settings.color_mode = "RGBA"
+ world = scene.world or bpy.data.worlds.new("world")
+ scene.world = world
+ world.use_nodes = True
+ bg = world.node_tree.nodes["Background"]
+ bg.inputs["Color"].default_value = (0.5, 0.5, 0.5, 1)
+ bg.inputs["Strength"].default_value = 0.55
+ for name, rot, energy in (("key", (math.radians(50), 0, math.radians(-35)), 3.2),
+ ("fill", (math.radians(60), 0, math.radians(120)), 1.0),
+ ("rim", (math.radians(35), 0, math.radians(200)), 1.6)):
+ ob = bpy.data.objects.get(name)
+ if ob is None:
+ ob = bpy.data.objects.new(name, bpy.data.lights.new(name, "SUN"))
+ scene.collection.objects.link(ob)
+ ob.rotation_euler = rot
+ ob.data.energy = energy
+ ob.data.angle = math.radians(8)
+
+
+def render_views(out, prefix, scale=1.0, res=None):
+ """Render the front and side views as RGBA PNGs at the layout's pixel scale times `scale`."""
+ scene = bpy.context.scene
+ paths = {}
+ for name, (cam, w) in cameras(scene).items():
+ scene.camera = cam
+ scene.render.resolution_x = round(w * scale)
+ scene.render.resolution_y = round(H * scale)
+ scene.render.resolution_percentage = 100
+ view = name.split("_")[1]
+ scene.render.filepath = str(out / f"{prefix}_{view}.png")
+ bpy.ops.render.render(write_still=True)
+ paths[view] = scene.render.filepath
+ return paths
+
+
+def stick_figure(joints, bones, radius=0.012):
+ """Spheres at joints and rods along bones (left pink, right blue, middle orange), drawn over the mesh."""
+ mats = {}
+ for side, col in (("L", (1, 0.1, 0.8, 1)), ("R", (0.1, 0.3, 1, 1)), ("M", (1, 0.5, 0, 1))):
+ m = bpy.data.materials.new(f"stick_{side}")
+ m.diffuse_color = col
+ mats[side] = m
+ side = lambda n: "L" if n.endswith("_L") else "R" if n.endswith("_R") else "M"
+ for name, p in joints.items():
+ bpy.ops.mesh.primitive_uv_sphere_add(radius=radius * 1.6, location=p, segments=12, ring_count=8)
+ bpy.context.object.data.materials.append(mats[side(name)])
+ for name, h, t, _ in bones:
+ a, b = Vector(joints[h]), Vector(joints[t])
+ bpy.ops.mesh.primitive_cylinder_add(radius=radius * 0.6, depth=(b - a).length, location=(a + b) / 2, vertices=8)
+ rod = bpy.context.object
+ rod.rotation_euler = (b - a).to_track_quat("Z", "Y").to_euler()
+ rod.data.materials.append(mats[side(name)])
+
+
+def xray_views(out, prefix):
+ """Workbench x-ray renders (side, front, top) so joints inside the mesh are visible."""
+ scene = bpy.context.scene
+ scene.render.engine = "BLENDER_WORKBENCH"
+ scene.display.shading.light = "STUDIO"
+ scene.display.shading.color_type = "MATERIAL"
+ scene.display.shading.show_xray = True
+ scene.display.shading.xray_alpha = 0.35
+ scene.render.film_transparent = False
+ cams = cameras(scene)
+ top = bpy.data.objects.new("cam_top", bpy.data.cameras.new("cam_top"))
+ scene.collection.objects.link(top)
+ top.location, top.rotation_euler = (0, 0, 20), (0, 0, 0)
+ top.data.type, top.data.ortho_scale = "ORTHO", M_PER_PX * W_SIDE
+ for name, cam, w, h in (("front", cams["cam_front"][0], W_FRONT, H), ("side", cams["cam_side"][0], W_SIDE, H),
+ ("top", top, 600, W_SIDE)):
+ scene.camera = cam
+ scene.render.resolution_x, scene.render.resolution_y = w, h
+ scene.render.filepath = str(out / f"{prefix}_{name}.png")
+ bpy.ops.render.render(write_still=True)
diff --git a/blender/export_fur_rig_info.py b/blender/export_fur_rig_info.py
new file mode 100644
index 0000000..80c388c
--- /dev/null
+++ b/blender/export_fur_rig_info.py
@@ -0,0 +1,27 @@
+"""Extend rig_info.json with the fur bones of a rigged_v3 blend, so the reader can learn to find each fur bone's tip
+and the solver can pose the fur from the video instead of simulating it.
+
+blender -b -P blender/export_fur_rig_info.py -- rigged.blend rig_info.json fur.json out_rig_info.json
+Fur bones are appended after the body bones (their parents come earlier), each with a tip keypoint "<bone>_tip".
+"""
+import json, sys
+
+import bpy
+
+args = sys.argv[sys.argv.index("--") + 1:]
+blend, info_path, fur_path, out = args[:4]
+bpy.ops.wm.open_mainfile(filepath=blend)
+arm = bpy.data.objects["rig"]
+info = json.load(open(info_path))
+fur = json.load(open(fur_path))
+order = [b["name"] for b in info["bones"]]
+for name, f in fur.items():
+ bb = arm.data.bones[name]
+ lim = f.get("max_deg", 30)
+ info["bones"].append({"name": name, "parent": order.index(f["parent"]), "matrix_local": [list(r) for r in bb.matrix_local],
+ "length": bb.length, "head_joint": name + "_root", "tail_joint": name + "_tip",
+ "limits_deg": [[-lim, lim], [-5, 5], [-lim, lim]]})
+ order.append(name)
+ info["keypoints"].append({"name": name + "_tip", "bone": len(order) - 1, "end": "tail", "rest": list(bb.tail_local)})
+json.dump(info, open(out, "w"), indent=1)
+print("rig_info with fur:", len(info["bones"]), "bones,", len(info["keypoints"]), "keypoints")
diff --git a/blender/inspect_mesh.py b/blender/inspect_mesh.py
new file mode 100644
index 0000000..4bb2ca0
--- /dev/null
+++ b/blender/inspect_mesh.py
@@ -0,0 +1,47 @@
+"""Import a GLB, join its meshes and render four orthographic views with Workbench, so the facing can be checked.
+
+blender -b -P blender/inspect_mesh.py -- in.glb out_dir
+"""
+import math, sys, pathlib
+
+import bpy
+from mathutils import Vector
+
+src, out = sys.argv[sys.argv.index("--") + 1:][:2]
+out = pathlib.Path(out)
+out.mkdir(parents=True, exist_ok=True)
+
+bpy.ops.wm.read_factory_settings(use_empty=True)
+bpy.ops.import_scene.gltf(filepath=src)
+meshes = [o for o in bpy.context.scene.objects if o.type == "MESH"]
+print("meshes", [(o.name, len(o.data.vertices)) for o in meshes])
+
+pts = [o.matrix_world @ v.co for o in meshes for v in o.data.vertices]
+lo = Vector([min(p[i] for p in pts) for i in range(3)])
+hi = Vector([max(p[i] for p in pts) for i in range(3)])
+print("bbox min", tuple(round(x, 3) for x in lo), "max", tuple(round(x, 3) for x in hi))
+c, size = (lo + hi) / 2, max(hi - lo)
+
+scene = bpy.context.scene
+scene.render.engine = "BLENDER_WORKBENCH"
+scene.display.shading.light = "STUDIO"
+scene.display.shading.color_type = "TEXTURE"
+scene.render.resolution_x = scene.render.resolution_y = 512
+scene.render.film_transparent = False
+world = bpy.data.worlds.new("w")
+scene.world = world
+
+cam = bpy.data.objects.new("cam", bpy.data.cameras.new("cam"))
+scene.collection.objects.link(cam)
+cam.data.type = "ORTHO"
+cam.data.ortho_scale = size * 1.15
+scene.camera = cam
+
+views = {"from_negY": (Vector((0, -1, 0)), 0), "from_posY": (Vector((0, 1, 0)), 0),
+ "from_negX": (Vector((-1, 0, 0)), 0), "from_posX": (Vector((1, 0, 0)), 0)}
+for name, (d, _) in views.items():
+ cam.location = c + d * size * 3
+ cam.rotation_euler = (-d).to_track_quat("-Z", "Y").to_euler()
+ scene.render.filepath = str(out / f"{name}.png")
+ bpy.ops.render.render(write_still=True)
+print("done")
diff --git a/blender/ortho_views.py b/blender/ortho_views.py
new file mode 100644
index 0000000..7e888ea
--- /dev/null
+++ b/blender/ortho_views.py
@@ -0,0 +1,58 @@
+"""Render a mesh from the side (-X), front (-Y) and top (+Z) with orthographic cameras at a fixed scale, as a base for
+placing joints; tools/grid_views.py draws the metre grid and the joints on top.
+
+blender -b -P blender/ortho_views.py -- static.blend out_dir [px_per_m] [xray]
+Writes side.png, front.png, top.png and views.json (for each view: which world axes map to image right and down,
+the world value at the image's top-left, px per metre).
+"""
+import json, pathlib, sys
+
+import bpy
+import numpy as np
+from mathutils import Vector
+
+args = sys.argv[sys.argv.index("--") + 1:]
+blend, out = args[0], pathlib.Path(args[1])
+ppm = float(args[2]) if len(args) > 2 else 300
+xray = len(args) > 3 and args[3] == "xray"
+out.mkdir(parents=True, exist_ok=True)
+bpy.ops.wm.open_mainfile(filepath=blend)
+scene = bpy.context.scene
+body = bpy.data.objects["body"]
+co = np.array([body.matrix_world @ v.co for v in body.data.vertices])
+lo, hi = co.min(0) - 0.1, co.max(0) + 0.1
+scene.render.engine = "BLENDER_WORKBENCH"
+scene.display.shading.light = "STUDIO"
+scene.display.shading.color_type = "TEXTURE"
+scene.display.shading.show_xray = xray
+scene.display.shading.xray_alpha = 0.5
+scene.render.film_transparent = False
+cam = bpy.data.objects.new("vcam", bpy.data.cameras.new("vcam"))
+scene.collection.objects.link(cam)
+cam.data.type = "ORTHO"
+scene.camera = cam
+views = {}
+# (name, horizontal axis, sign, vertical axis, sign, camera direction): image right = sign_h * axis_h, up = sign_v * axis_v
+for name, ah, sh, av, sv, look in (("side", 1, -1, 2, 1, (1, 0, 0)), ("front", 0, 1, 2, 1, (0, 1, 0)), ("top", 0, 1, 1, 1, (0, 0, -1))):
+ w, h = (hi[ah] - lo[ah]) * ppm, (hi[av] - lo[av]) * ppm
+ scene.render.resolution_x, scene.render.resolution_y = int(round(w)), int(round(h))
+ cam.data.ortho_scale = max(hi[ah] - lo[ah], hi[av] - lo[av])
+ c = (lo + hi) / 2
+ d = Vector(look)
+ cam.location = Vector(c.tolist()) - d * 50
+ up = Vector((0, 0, 1)) if name != "top" else Vector((0, 1, 0))
+ cam.rotation_euler = d.to_track_quat("-Z", "Y").to_euler() if name != "top" else (0, 0, 0)
+ if name == "side":
+ cam.rotation_euler = (np.pi / 2, 0, -np.pi / 2)
+ elif name == "front":
+ cam.rotation_euler = (np.pi / 2, 0, 0)
+ cam.data.clip_end = 200
+ scene.render.filepath = str(out / f"{name}.png")
+ bpy.ops.render.render(write_still=True)
+ # world value at the image's left edge and top edge
+ left = c[ah] - sh * (hi[ah] - lo[ah]) / 2
+ top = c[av] + sv * (hi[av] - lo[av]) / 2
+ views[name] = {"h_axis": ah, "h_sign": sh, "v_axis": av, "v_sign": sv, "left": float(left), "top": float(top),
+ "ppm": ppm, "w": scene.render.resolution_x, "h": scene.render.resolution_y}
+json.dump(views, open(out / "views.json", "w"), indent=1)
+print("views", {k: (v["w"], v["h"]) for k, v in views.items()})
diff --git a/blender/prep_mesh.py b/blender/prep_mesh.py
new file mode 100644
index 0000000..69d0db7
--- /dev/null
+++ b/blender/prep_mesh.py
@@ -0,0 +1,53 @@
+"""Import the Tripo GLB, scale it to real size, stand it on the ground and save a clean .blend plus its vertices.
+
+blender -b -P blender/prep_mesh.py -- in.glb length_m out_dir [rotz_deg] [axis]
+The creature must face -Y (check with inspect_mesh.py); rotz_deg turns it about Z first if it doesn't. length_m is
+the size along `axis` (y by default; x for creatures wider than they are long, such as a spider's leg span). Writes static.blend, verts.npy (world, metres)
+and faces.npy, and side/front/top orthographic renders with a 10 cm grid for placing joints.
+"""
+import math, sys, pathlib
+
+import bpy
+import numpy as np
+from mathutils import Matrix, Vector
+
+args = sys.argv[sys.argv.index("--") + 1:]
+src, length, out = args[:3]
+rotz = float(args[3]) if len(args) > 3 else 0.0
+axis = "xyz".index(args[4]) if len(args) > 4 else 1
+length, out = float(length), pathlib.Path(out)
+out.mkdir(parents=True, exist_ok=True)
+
+bpy.ops.wm.read_factory_settings(use_empty=True)
+bpy.ops.import_scene.gltf(filepath=src)
+meshes = [o for o in bpy.context.scene.objects if o.type == "MESH"]
+for o in bpy.context.scene.objects:
+ o.select_set(o.type == "MESH")
+bpy.context.view_layer.objects.active = meshes[0]
+if len(meshes) > 1:
+ bpy.ops.object.join()
+body = bpy.context.view_layer.objects.active
+# drop the glTF empties so the mesh sits at the root
+bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")
+for o in list(bpy.context.scene.objects):
+ if o.type != "MESH":
+ bpy.data.objects.remove(o)
+body.name = "body"
+body.matrix_world = Matrix.Rotation(math.radians(rotz), 4, "Z") @ body.matrix_world # glTF objects use quaternions
+bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
+
+v = np.array([vt.co[:] for vt in body.data.vertices])
+lo, hi = v.min(0), v.max(0)
+s = length / (hi[axis] - lo[axis])
+offset = np.array([-(lo[0] + hi[0]) / 2, -(lo[1] + hi[1]) / 2, -lo[2]])
+for vt in body.data.vertices:
+ vt.co = Vector(((np.array(vt.co[:]) + offset) * s).tolist())
+body.data.update()
+v = np.array([vt.co[:] for vt in body.data.vertices])
+f = np.array([p.vertices[:] for p in body.data.polygons if len(p.vertices) == 3])
+np.save(out / "verts.npy", v.astype(np.float32))
+np.save(out / "faces.npy", f.astype(np.int32))
+print("size", np.round(v.max(0) - v.min(0), 3), "faces", len(body.data.polygons))
+bpy.ops.object.shade_smooth()
+bpy.ops.wm.save_as_mainfile(filepath=str(out / "static.blend"))
+print("saved", out / "static.blend")
diff --git a/blender/render_dataset.py b/blender/render_dataset.py
new file mode 100644
index 0000000..5629697
--- /dev/null
+++ b/blender/render_dataset.py
@@ -0,0 +1,145 @@
+"""Render the creature in random poses from both layout cameras, with the true pixel position of every joint.
+
+blender -b -P blender/render_dataset.py -- rigged.blend rig_info.json out_dir start count seed [scale]
+Each sample i writes out_dir/{i:05d}_front.png, _side.png (RGBA) and _meta.json (joints in metres and in
+full-size layout pixels for both views, plus the pose). About half the samples carry motion blur from a random
+velocity, the way a video model smears fast limbs. Lights, turn, position and airtime are random too.
+"""
+import json, math, pathlib, sys
+
+import bpy
+import numpy as np
+from mathutils import Euler, Vector
+
+sys.path.insert(0, str(pathlib.Path(__file__).parent))
+import common # noqa: E402
+
+args = sys.argv[sys.argv.index("--") + 1:]
+blend, info_path, out = args[:3]
+start, count, seed = int(args[3]), int(args[4]), int(args[5])
+scale = float(args[6]) if len(args) > 6 else 0.6
+out = pathlib.Path(out)
+out.mkdir(parents=True, exist_ok=True)
+
+bpy.ops.wm.open_mainfile(filepath=blend)
+scene = bpy.context.scene
+info = json.load(open(info_path))
+rig, body = bpy.data.objects["rig"], bpy.data.objects["body"]
+bones = [b["name"] for b in info["bones"]]
+lim = {b["name"]: np.radians(np.array(b["limits_deg"], float)) for b in info["bones"]}
+for pb in rig.pose.bones:
+ pb.rotation_mode = "XYZ"
+common.studio(scene, samples=16)
+scene.cycles.use_adaptive_sampling = True
+scene.cycles.denoising_use_gpu = True # OIDN on the GPU; on the CPU it was the bottleneck
+scene.render.threads_mode = "FIXED"
+scene.render.threads = 4
+cams = common.cameras(scene)
+key, fill, rim = (bpy.data.objects[n] for n in ("key", "fill", "rim"))
+bg = scene.world.node_tree.nodes["Background"]
+M, H, ZC = common.M_PER_PX, common.H, common.Z_CENTER
+
+
+def sample_pose(rng):
+ """Euler angles per bone: half uniform inside the limits, half a narrower spread around the rest pose."""
+ pose = {}
+ wide = rng.random() < 0.5
+ for name in bones:
+ lo, hi = lim[name][:, 0], lim[name][:, 1]
+ if name == "pelvis" and rng.random() < 0.15: # sometimes rear up or dive
+ lo = lo.copy(); lo[0] = math.radians(-60)
+ if wide:
+ a = rng.uniform(lo, hi)
+ else:
+ a = np.clip(rng.normal(0, 0.3 * (hi - lo) / 2), lo, hi)
+ pose[name] = a
+ return pose
+
+
+def apply(pose, loc, yaw, frame):
+ for name, a in pose.items():
+ pb = rig.pose.bones[name]
+ pb.rotation_euler = Euler(a.tolist(), "XYZ")
+ if frame is not None:
+ pb.keyframe_insert("rotation_euler", frame=frame)
+ rig.location = loc
+ rig.rotation_euler = (0, 0, yaw)
+ if frame is not None:
+ rig.keyframe_insert("location", frame=frame)
+ rig.keyframe_insert("rotation_euler", frame=frame)
+
+
+def lowest_z():
+ dg = bpy.context.evaluated_depsgraph_get()
+ ev = body.evaluated_get(dg)
+ me = ev.to_mesh()
+ co = np.empty(len(me.vertices) * 3)
+ me.vertices.foreach_get("co", co)
+ ev.to_mesh_clear()
+ co = co.reshape(-1, 3) @ np.array(body.matrix_world)[:3, :3].T + np.array(body.matrix_world)[:3, 3]
+ return co[:, 2].min()
+
+
+def joints_world():
+ mw = rig.matrix_world
+ pts = []
+ for kp in info["keypoints"]:
+ pb = rig.pose.bones[bones[kp["bone"]]]
+ pts.append(list(mw @ (pb.head if kp["end"] == "head" else pb.tail)))
+ return np.array(pts)
+
+
+rng = np.random.default_rng(seed + start)
+for i in range(start, start + count):
+ stem = out / f"{i:05d}"
+ if (out / f"{i:05d}_meta.json").exists():
+ continue
+ rig.animation_data_clear()
+ for a in list(bpy.data.actions):
+ bpy.data.actions.remove(a)
+ for pb in rig.pose.bones:
+ pb.location = (0, 0, 0)
+ pose = sample_pose(rng)
+ r = rng.random()
+ yaw = math.radians(rng.uniform(-30, 30) if r < 0.75 else rng.uniform(-70, 70) if r < 0.85 else 0)
+ loc = Vector((rng.uniform(-0.08, 0.08), rng.uniform(-0.25, 0.25), 0))
+ apply(pose, loc, yaw, None)
+ bpy.context.view_layer.update()
+ loc.z = -lowest_z() + (rng.uniform(0.05, 0.45) if rng.random() < 0.2 else 0)
+ blur = rng.random() < 0.5
+ if blur: # key the pose at frames 0, 1, 2 along a random velocity; render frame 1 with motion blur
+ vel = {n: rng.normal(0, math.radians(6 if any(k in n for k in ("arm", "meta", "shin", "thigh", "paw", "tail")) else 2.5), 3) for n in bones}
+ vloc = Vector(rng.normal(0, 0.015, 3).tolist())
+ vyaw = rng.normal(0, math.radians(3))
+ for f, s in ((0, -1), (1, 0), (2, 1)):
+ apply({n: pose[n] + s * vel[n] for n in bones}, loc + s * vloc, yaw + s * vyaw, f)
+ scene.frame_set(1)
+ scene.render.use_motion_blur = True
+ scene.render.motion_blur_shutter = rng.uniform(0.5, 1.0)
+ else:
+ apply(pose, loc, yaw, None)
+ scene.render.use_motion_blur = False
+ bpy.context.view_layer.update()
+ # lights and world
+ key.rotation_euler = (math.radians(rng.uniform(20, 70)), 0, rng.uniform(-math.pi, math.pi))
+ key.data.energy = rng.uniform(1.5, 4.5)
+ fill.rotation_euler = (math.radians(rng.uniform(30, 80)), 0, rng.uniform(-math.pi, math.pi))
+ fill.data.energy = rng.uniform(0.2, 1.5)
+ rim.data.energy = rng.uniform(0.0, 2.5)
+ bg.inputs["Strength"].default_value = rng.uniform(0.3, 0.9)
+ g = rng.uniform(0.4, 0.6)
+ bg.inputs["Color"].default_value = (g * rng.uniform(0.9, 1.1), g, g * rng.uniform(0.9, 1.1), 1)
+
+ jw = joints_world()
+ front = np.stack([common.W_FRONT / 2 + jw[:, 0] / M, H / 2 - (jw[:, 2] - ZC) / M], 1)
+ side = np.stack([common.W_SIDE / 2 - jw[:, 1] / M, H / 2 - (jw[:, 2] - ZC) / M], 1)
+ for name, (cam, w) in cams.items():
+ scene.camera = cam
+ scene.render.resolution_x, scene.render.resolution_y = round(w * scale), round(H * scale)
+ scene.render.filepath = f"{stem}_{name.split('_')[1]}.png"
+ bpy.ops.render.render(write_still=True)
+ meta = {"joints_world": jw.round(5).tolist(), "front_uv": front.round(3).tolist(), "side_uv": side.round(3).tolist(),
+ "scale": scale, "blur": blur, "yaw": yaw, "root": list(loc),
+ "pose": {n: np.round(a, 5).tolist() for n, a in pose.items()}}
+ (out / f"{i:05d}_meta.json").write_text(json.dumps(meta))
+ print("sample", i, flush=True)
diff --git a/blender/render_ref.py b/blender/render_ref.py
new file mode 100644
index 0000000..a384f26
--- /dev/null
+++ b/blender/render_ref.py
@@ -0,0 +1,21 @@
+"""Render the rest pose from both layout cameras (RGBA), for the video model's first frame.
+
+blender -b -P blender/render_ref.py -- rigged.blend out_dir [samples]
+"""
+import pathlib, sys
+
+import bpy
+
+sys.path.insert(0, str(pathlib.Path(__file__).parent))
+import common # noqa: E402
+
+args = sys.argv[sys.argv.index("--") + 1:]
+out = pathlib.Path(args[1])
+out.mkdir(parents=True, exist_ok=True)
+bpy.ops.wm.open_mainfile(filepath=args[0])
+for pb in bpy.data.objects["rig"].pose.bones:
+ pb.rotation_mode = "XYZ"
+ pb.rotation_euler = (0, 0, 0)
+ pb.location = (0, 0, 0)
+common.studio(bpy.context.scene, samples=int(args[2]) if len(args) > 2 else 128)
+common.render_views(out, "ref")
diff --git a/blender/turntable.py b/blender/turntable.py
new file mode 100644
index 0000000..365922f
--- /dev/null
+++ b/blender/turntable.py
@@ -0,0 +1,85 @@
+"""A slow orbit around the creature at rest, for the explainer: textured, painted, or x-ray with its bones.
+
+blender -b -P blender/turntable.py -- rigged.blend rig.json out_dir mode [frames] [WxH] [deg_from,deg_to]
+mode: plain (texture, no paint), paint (limb colours), bones (a ghost of the mesh, then the skeleton as a second
+pass in out_dir/sticks; tools/stack_passes.py lays the solid bones over the ghost)
+The camera circles the creature's bounding box at a three-quarter height, framing it whole in every frame.
+"""
+import json, math, pathlib, sys
+
+import bpy
+import numpy as np
+from mathutils import Vector
+
+sys.path.insert(0, str(pathlib.Path(__file__).parent))
+import common # noqa: E402
+
+args = sys.argv[sys.argv.index("--") + 1:]
+blend, rig_json, out, mode = args[:4]
+frames = int(args[4]) if len(args) > 4 else 96
+w, h = (int(x) for x in (args[5] if len(args) > 5 else "1408x792").split("x"))
+a0, a1 = (float(x) for x in (args[6] if len(args) > 6 else "-60,-20").split(","))
+out = pathlib.Path(out)
+out.mkdir(parents=True, exist_ok=True)
+bpy.ops.wm.open_mainfile(filepath=blend)
+scene = bpy.context.scene
+rig, body = bpy.data.objects["rig"], bpy.data.objects["body"]
+for pb in rig.pose.bones:
+ pb.rotation_mode = "XYZ"
+ pb.rotation_euler = (0, 0, 0)
+if mode != "paint":
+ attr = body.data.color_attributes["legpaint"]
+ attr.data.foreach_set("color", np.zeros(len(attr.data) * 4))
+co = np.array([body.matrix_world @ v.co for v in body.data.vertices])
+lo, hi = co.min(0), co.max(0)
+centre = Vector(((lo + hi) / 2).tolist())
+radius = float(np.linalg.norm(hi - lo)) / 2
+
+if mode == "bones":
+ joints, bones, _ = common.load_rig(rig_json)
+ before = set(bpy.data.objects)
+ common.stick_figure(joints, bones, radius=0.022 * radius / 1.4)
+ sticks = list(set(bpy.data.objects) - before)
+ scene.render.engine = "BLENDER_WORKBENCH"
+ scene.display.shading.light = "FLAT"
+ scene.display.shading.color_type = "MATERIAL"
+ scene.display.shading.show_xray = True
+ scene.display.shading.xray_alpha = 0.18
+ scene.render.film_transparent = True
+ for m in bpy.data.materials:
+ if m.name.startswith("stick_"):
+ m.diffuse_color = (1, 1, 1, 1) # one ink for the bones: the patch is the only pink in a view
+ body.active_material.diffuse_color = (0.55, 0.56, 0.6, 1)
+else:
+ common.studio(scene, samples=24)
+ scene.cycles.use_adaptive_sampling = True
+ scene.cycles.denoising_use_gpu = True
+ scene.render.threads_mode = "FIXED"
+ scene.render.threads = 4
+
+cam = bpy.data.objects.new("orbit", bpy.data.cameras.new("orbit"))
+scene.collection.objects.link(cam)
+cam.data.lens = 50
+scene.camera = cam
+scene.render.resolution_x, scene.render.resolution_y = w, h
+scene.render.image_settings.file_format = "PNG"
+scene.render.image_settings.color_mode = "RGBA"
+fov = 2 * math.atan(36 / 2 / cam.data.lens) # horizontal, 36 mm sensor
+dist = radius / math.tan(min(fov, fov * h / w) / 2) * 0.64
+passes = [(out, None)]
+if mode == "bones": # the ghost (mesh only, x-ray), then the bones alone and solid
+ passes = [(out, False), (out / "sticks", True)]
+for d, show_sticks in passes:
+ d.mkdir(parents=True, exist_ok=True)
+ if show_sticks is not None:
+ for o in sticks:
+ o.hide_render = not show_sticks
+ body.hide_render = show_sticks
+ scene.display.shading.show_xray = not show_sticks
+ for f in range(frames):
+ a = math.radians(a0 + (a1 - a0) * f / max(1, frames - 1))
+ cam.location = centre + Vector((math.sin(a) * math.cos(0.32), -math.cos(a) * math.cos(0.32), math.sin(0.32))) * dist
+ cam.rotation_euler = (centre - cam.location).to_track_quat("-Z", "Y").to_euler()
+ scene.render.filepath = str(d / f"f_{f:04d}.png")
+ bpy.ops.render.render(write_still=True)
+print("turntable", mode, frames, "frames")
diff --git a/docs/PIPELINE.md b/docs/PIPELINE.md
new file mode 100644
index 0000000..926b813
--- /dev/null
+++ b/docs/PIPELINE.md
@@ -0,0 +1,73 @@
+# pipeline.
+
+How the pieces fit, file by file, and what each stage reads and writes. The skills in `skills/` say how to run it;
+this says what's inside.
+
+## The contract: one frame, two cameras
+
+Every stage agrees on one 1280 x 720 layout (`mocap/layout.py`, mirrored in `blender/common.py`):
+
+- **Front view**, left, `W_FRONT` px wide: an orthographic camera at -Y looking along +Y at the creature's face. Image
+ u grows with world X.
+- **Side view**, right, `W_SIDE` px wide: an orthographic camera at -X looking along +X at the creature's right flank,
+ head to the right. Image u grows with world -Y.
+- Both share the vertical axis: v grows downward with -Z, the ground (z = 0) is row `GROUND_V`, and one pixel is
+ `M_PER_PX` metres in both views. A joint at height z sits on the same row in both halves. That is what makes two
+ views enough for 3D (x from the front, y from the side, z from both) and what the sync check measures.
+- The studio: grey wall (128, 130, 134), a lighter floor band below the ground row (152, 154, 158), a dark divider.
+
+`MOCAP_CREATURE=assets/<c>` selects a creature; its `creature.json` sets the layout, the paint and the feet. Without
+it, every module falls back to the wolf's layout (420 + 860 px, 1.9 m of height in frame).
+
+## Files a creature brings
+
+| file | written by | holds |
+|---|---|---|
+| `assets/<c>/model.glb` | Tripo or any generator | the textured mesh |
+| `assets/<c>/creature.json` | you | `prep` (length_m, rotz_deg, axis), `layout`, `paint` (limb groups: colour + bones), `feet`, prompt words (`name`, `noun`, `describe`, `colour_code`, `count`, `flank`, `limbs`), the 3/4 showcase `camera` |
+| `assets/<c>/rig.json` | you | `joints` (metres, -Y forward, +X left), `bones` [name, head, tail, parent], `limits_deg` per bone or stem |
+| `assets/<c>/prep/static.blend` | `blender/prep_mesh.py` | the mesh at real size, facing -Y, on the ground |
+| `assets/<c>/rigged/rigged.blend` | `blender/build_rig.py` | armature, skinned mesh, limb paint as a colour attribute (`legpaint`) |
+| `assets/<c>/rigged/rig_info.json` | `blender/build_rig.py` | rest matrices, parents, lengths, limits, and the keypoints (which bone end each joint is) for the solver |
+
+## Stages
+
+| stage | code | reads | writes |
+|---|---|---|---|
+| reference frame | `blender/render_ref.py`, `tools/compose_ref.py` | rigged.blend | `runs/<c>/ref/ref.png` |
+| prompt | `tools/make_prompt.py` | creature.json + one action sentence | `prompts/<c>/<move>.txt` |
+| video | `mocap/generate.py` (fal queue client in `mocap/fal.py`) | ref.png + prompt | `runs/<c>/videos/<move>/s<seed>/<model>.mp4` |
+| dataset | `blender/render_dataset.py` | rigged.blend + rig_info.json | `runs/<c>/dataset/<i>_{front,side}.png`, `<i>_meta.json` (true joints in metres and layout px) |
+| reader | `mocap/model.py`, `mocap/train.py` | dataset | `runs/<c>/reader.pt` (state dict, joint names, held-out error) |
+| read | `mocap/detect.py` | clip + reader + ref.png | `det.npz`: `front_uv`, `side_uv` (T x J x 2, layout px), `front_conf`, `side_conf`, `fps`, `names`, `calib` |
+| fit | `mocap/solve.py` | det.npz + rig_info.json | `motion.json`: `bones`, `trans`, `root_quat`, `euler` (T x B x 3), `joints` (T x J x 3 m), `reproj_px`, `sync` (incl. `paw_agreement`) |
+| apply | `blender/apply_motion.py` | rigged.blend + motion.json | keyframed rig, `joints.json` (true joint positions from Blender), renders, `animation.glb` |
+| compare | `mocap/showcase.py` | clip + det.npz + renders | `showcase.mp4` |
+| exam | `mocap/exam.py` | rig_info.json | a random motion, its two-camera video, and a per-joint error score in cm |
+| LoRA | `tools/build_lora_set.py`, `mocap/mirror.py`, `mocap/lora.py` | captured motions + prompts | training clips, the fal run, `lora.json` |
+
+## Inside the reader
+
+DINOv2 ViT-B/14 with registers (`facebook/dinov2-with-registers-base`, Apache-2.0), fine-tuned end to end (backbone at
+2e-5, head at 1e-3, AdamW, cosine schedule with warm-up). Each view is padded to a square with the backdrop grey and
+resized to 448 x 448 (32 x 32 patches); the patch tokens go through a small conv head that upsamples to one 128 x 128
+heatmap per joint, trained against Gaussian targets (sigma 2). Peaks are refined to sub-pixel from their neighbours.
+Training images are laid on random backdrops and degraded like video; 4% of samples are held out.
+
+## Inside the fit
+
+`mocap/solve.py` redoes Blender's forward kinematics in torch (pose = parent pose x rest offset x Euler XYZ), with the
+root free and every other bone's Euler angles squashed into its limits by a sigmoid. Before fitting it scores the
+clip (paw agreement, height gap and best lag between views) and time-warps the front view onto the side view when
+that cuts the height gap by 15% or more. Joints are triangulated (x from the front, y from the side, height weighted
+0.25 front / 1 side by confidence), the root rotation comes from a weighted Kabsch fit of the points riding on the
+root bone, and an analytic IK pose aimed at the triangulated joints is the starting point. The loss is a robust
+(Cauchy) reprojection error in both views, its scale annealed from 40 px to 6 px over the first 60% of 1,500 Adam
+steps, plus joint acceleration, angular velocity, a small pull to rest, and a ground term for paws.
+
+## Known gaps in the code
+
+- The ground term and `fix_swaps` know the wolf's and dragon's limb names (`fpaw`, `ftoe`, `hpaw`, `htoe`; `LEGS` in
+ `solve.py`). Other creatures fit without a ground penalty, and `--fix-swaps` does nothing for them.
+- `mocap/exam.py`'s per-group scores use the wolf's joint names; the mean, median and p95 work for any creature.
+- `tools/build_lora_set.py` mirrors motions assuming a symmetric rig.
diff --git a/docs/diptych.gif b/docs/diptych.gif
new file mode 100644
index 0000000..fe2fcc8
Binary files /dev/null and b/docs/diptych.gif differ
diff --git a/docs/readme/footer-day.png b/docs/readme/footer-day.png
new file mode 100644
index 0000000..cd5fc64
Binary files /dev/null and b/docs/readme/footer-day.png differ
diff --git a/docs/readme/footer-evening.png b/docs/readme/footer-evening.png
new file mode 100644
index 0000000..49e6211
Binary files /dev/null and b/docs/readme/footer-evening.png differ
diff --git a/docs/readme/header-day.png b/docs/readme/header-day.png
new file mode 100644
index 0000000..324d8a3
Binary files /dev/null and b/docs/readme/header-day.png differ
diff --git a/docs/readme/header-evening.png b/docs/readme/header-evening.png
new file mode 100644
index 0000000..1b6ea19
Binary files /dev/null and b/docs/readme/header-evening.png differ
diff --git a/docs/readme/make_art.py b/docs/readme/make_art.py
new file mode 100644
index 0000000..777804d
--- /dev/null
+++ b/docs/readme/make_art.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+"""The README's art in Patch's brand (Direction 46 · Lights Down), in Day and Evening for GitHub's light and dark modes:
+the header, the footer, and the makers' marks used in the credits.
+
+ PATCH_BRAND_KIT=<kit folder> python3 docs/readme/make_art.py
+
+A README is somewhere people read, so it is the world: black ink by day, white ink in the evening, the patch pink in
+both. Drawn at 2x for sharp screens, on a transparent ground so it sits on GitHub's own page colour. Needs Patch's brand
+kit (Patch Pixel, Funnel Sans and the logo masters), which isn't part of this repo: put it at ./brand-kit or point
+PATCH_BRAND_KIT at it.
+
+Makers' marks follow the kit's rule for other companies' logos: wherever a company is named, its mark sits right
+before the name, in one colour, the ink of the text beside it (never its own colours, never pink). The masks in
+marks/src are white on transparent; this writes <name>-black.png and <name>-white.png at twice their display size.
+"""
+import os
+import re
+
+from PIL import Image, ImageDraw, ImageFont
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+KIT = os.environ.get('PATCH_BRAND_KIT', os.path.join(HERE, '..', '..', 'brand-kit'))
+PINK = (245, 60, 209)
+STYLES = {'day': ((0, 0, 0), (102, 102, 102)), 'evening': ((255, 255, 255), (153, 153, 153))}
+MARK_PX = 40 # 20 px on screen, the height of a line of README text
+
+
+def pixel(size):
+ assert size % 9 == 0, 'Patch Pixel is set at multiples of 9 px'
+ return ImageFont.truetype(os.path.join(KIT, '04 Type', 'Patch Pixel', 'PatchPixel-Regular.ttf'), size)
+
+
+def funnel(size, weight=500):
+ f = ImageFont.truetype(os.path.join(KIT, '04 Type', 'Funnel Sans', 'FunnelSans[wght].ttf'), size)
+ f.set_variation_by_axes([weight])
+ return f
+
+
+def logo(name, ink, quiet):
+ """A logo master's cells (10 units a cell, whole-cell rectangles), its ink swapped for this style's."""
+ svg = open(os.path.join(KIT, '01 Logo', 'SVG', name + '.svg'), encoding='utf-8').read()
+ rects = []
+ for fill, d in re.findall(r'<path fill="#([0-9A-Fa-f]{6})"[^>]* d="([^"]+)"', svg):
+ col = tuple(int(fill[i:i + 2], 16) for i in (0, 2, 4))
+ col = PINK if col == PINK else quiet if col in ((153, 153, 153), (102, 102, 102)) else ink
+ for x, y, w, h in re.findall(r'M(\d+) (\d+)h(\d+)v(\d+)h-\d+z', d):
+ rects.append((int(x) // 10, int(y) // 10, int(w) // 10, int(h) // 10, col))
+ return rects
+
+
+def draw_rects(d, rects, x, y, c):
+ for rx, ry, rw, rh, col in rects:
+ d.rectangle([x + rx * c, y + ry * c, x + (rx + rw) * c - 1, y + (ry + rh) * c - 1], fill=col)
+
+
+def header(style):
+ ink, quiet = STYLES[style]
+ img = Image.new('RGBA', (1600, 400), (0, 0, 0, 0))
+ d = ImageDraw.Draw(img)
+ draw_rects(d, logo('patch-lockup-white', ink, quiet), 0, 0, 6) # 3 px cells on screen
+ d.text((0, 254), 'diptych.', font=pixel(144), fill=ink, anchor='ls') # 8 px cells: the headline size
+ d.text((0, 352), 'any creature. any move.', font=funnel(52), fill=quiet, anchor='ls')
+ img.save(os.path.join(HERE, f'header-{style}.png'), optimize=True)
+
+
+def footer(style):
+ ink, quiet = STYLES[style]
+ img = Image.new('RGBA', (1000, 72), (0, 0, 0, 0))
+ d = ImageDraw.Draw(img)
+ draw_rects(d, logo('patch-address-white', ink, quiet), 0, 0, 8) # 4 px cells on screen
+ d.text((460, 44), 'Mashups, mods and browser games.', font=funnel(30, 400), fill=quiet, anchor='ls')
+ img.save(os.path.join(HERE, f'footer-{style}.png'), optimize=True)
+
+
+def marks():
+ src = os.path.join(HERE, 'marks', 'src')
+ for f in sorted(os.listdir(src)):
+ if not f.endswith('.png'):
+ continue
+ a = Image.open(os.path.join(src, f)).getchannel('A')
+ a = a.crop(a.getbbox())
+ k = MARK_PX / max(a.size)
+ a = a.resize((max(1, round(a.width * k)), max(1, round(a.height * k))), Image.LANCZOS)
+ box = Image.new('L', (MARK_PX, MARK_PX), 0)
+ box.paste(a, ((MARK_PX - a.width) // 2, (MARK_PX - a.height) // 2))
+ for style, (ink, _) in STYLES.items():
+ out = Image.new('RGBA', box.size, ink + (0,))
+ out.putalpha(box)
+ name = 'black' if style == 'day' else 'white'
+ out.save(os.path.join(HERE, 'marks', f.replace('.png', f'-{name}.png')), optimize=True)
+
+
+if __name__ == '__main__':
+ for s in STYLES:
+ header(s)
+ footer(s)
+ marks()
+ print('wrote', sorted(f for f in os.listdir(HERE) if f.endswith('.png')),
+ sorted(f for f in os.listdir(os.path.join(HERE, 'marks')) if f.endswith('.png')))
diff --git a/docs/readme/marks/bfl-black.png b/docs/readme/marks/bfl-black.png
new file mode 100644
index 0000000..c9774c4
Binary files /dev/null and b/docs/readme/marks/bfl-black.png differ
diff --git a/docs/readme/marks/bfl-white.png b/docs/readme/marks/bfl-white.png
new file mode 100644
index 0000000..d518c0e
Binary files /dev/null and b/docs/readme/marks/bfl-white.png differ
diff --git a/docs/readme/marks/blender-black.png b/docs/readme/marks/blender-black.png
new file mode 100644
index 0000000..ae3638b
Binary files /dev/null and b/docs/readme/marks/blender-black.png differ
diff --git a/docs/readme/marks/blender-white.png b/docs/readme/marks/blender-white.png
new file mode 100644
index 0000000..fe322f6
Binary files /dev/null and b/docs/readme/marks/blender-white.png differ
diff --git a/docs/readme/marks/fal-black.png b/docs/readme/marks/fal-black.png
new file mode 100644
index 0000000..39f50ec
Binary files /dev/null and b/docs/readme/marks/fal-black.png differ
diff --git a/docs/readme/marks/fal-white.png b/docs/readme/marks/fal-white.png
new file mode 100644
index 0000000..9b789f3
Binary files /dev/null and b/docs/readme/marks/fal-white.png differ
diff --git a/docs/readme/marks/meta-black.png b/docs/readme/marks/meta-black.png
new file mode 100644
index 0000000..8e7b733
Binary files /dev/null and b/docs/readme/marks/meta-black.png differ
diff --git a/docs/readme/marks/meta-white.png b/docs/readme/marks/meta-white.png
new file mode 100644
index 0000000..91d3ccd
Binary files /dev/null and b/docs/readme/marks/meta-white.png differ
diff --git a/docs/readme/marks/minimax-black.png b/docs/readme/marks/minimax-black.png
new file mode 100644
index 0000000..28cea6c
Binary files /dev/null and b/docs/readme/marks/minimax-black.png differ
diff --git a/docs/readme/marks/minimax-white.png b/docs/readme/marks/minimax-white.png
new file mode 100644
index 0000000..11bcb65
Binary files /dev/null and b/docs/readme/marks/minimax-white.png differ
diff --git a/docs/readme/marks/src/NOTICE.md b/docs/readme/marks/src/NOTICE.md
new file mode 100644
index 0000000..f42bdfa
--- /dev/null
+++ b/docs/readme/marks/src/NOTICE.md
@@ -0,0 +1,29 @@
+Where these marks come from. They are the companies' trademarks, shown only to credit their tools.
+
+- meta, tripo, minimax, fal, bfl (.svg): lobe-icons by LobeHub, @lobehub/icons-static-svg 1.101.0, MIT licence below.
+- blender (.svg): Simple Icons 16.36.0, CC0 1.0. The Blender logo is a trademark of the Blender Foundation.
+- The .png masks are the .svg files rasterized white on transparent at 512 px.
+
+-----
+
+MIT License
+
+Copyright (c) 2023 LobeHub
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/docs/readme/marks/src/bfl.png b/docs/readme/marks/src/bfl.png
new file mode 100644
index 0000000..de779fa
Binary files /dev/null and b/docs/readme/marks/src/bfl.png differ
diff --git a/docs/readme/marks/src/bfl.svg b/docs/readme/marks/src/bfl.svg
new file mode 100644
index 0000000..3a1bfa9
--- /dev/null
+++ b/docs/readme/marks/src/bfl.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Black Forest Labs</title><path d="M17.113 10.248H14.56l-2.553-3.616-7.963 11.27h2.558l5.405-7.654h2.552l-5.404 7.653h2.565l5.392-7.653L24 20 19.97 20v-2.091l-2.857-4.044-2.842 4.037V20H0L12.008 3l5.105 7.249z"></path></svg>
\ No newline at end of file
diff --git a/docs/readme/marks/src/blender.png b/docs/readme/marks/src/blender.png
new file mode 100644
index 0000000..2f6fc7d
Binary files /dev/null and b/docs/readme/marks/src/blender.png differ
diff --git a/docs/readme/marks/src/blender.svg b/docs/readme/marks/src/blender.svg
new file mode 100644
index 0000000..511377f
--- /dev/null
+++ b/docs/readme/marks/src/blender.svg
@@ -0,0 +1 @@
+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Blender</title><path d="M12.51 13.214c.046-.8.438-1.506 1.03-2.006a3.424 3.424 0 0 1 2.212-.79c.85 0 1.631.3 2.211.79.592.5.983 1.206 1.028 2.005.045.823-.285 1.586-.865 2.153a3.389 3.389 0 0 1-2.374.938 3.393 3.393 0 0 1-2.376-.938c-.58-.567-.91-1.33-.865-2.152M7.35 14.831c.006.314.106.922.256 1.398a7.372 7.372 0 0 0 1.593 2.757 8.227 8.227 0 0 0 2.787 2.001 8.947 8.947 0 0 0 3.66.76 8.964 8.964 0 0 0 3.657-.772 8.285 8.285 0 0 0 2.785-2.01 7.428 7.428 0 0 0 1.592-2.762 6.964 6.964 0 0 0 .25-3.074 7.123 7.123 0 0 0-1.016-2.779 7.764 7.764 0 0 0-1.852-2.043h.002L13.566 2.55l-.02-.015c-.492-.378-1.319-.376-1.86.002-.547.382-.609 1.015-.123 1.415l-.001.001 3.126 2.543-9.53.01h-.013c-.788.001-1.545.518-1.695 1.172-.154.665.38 1.217 1.2 1.22V8.9l4.83-.01-8.62 6.617-.034.025c-.813.622-1.075 1.658-.563 2.313.52.667 1.625.668 2.447.004L7.414 14s-.069.52-.063.831zm12.09 1.741c-.97.988-2.326 1.548-3.795 1.55-1.47.004-2.827-.552-3.797-1.538a4.51 4.51 0 0 1-1.036-1.622 4.282 4.282 0 0 1 .282-3.519 4.702 4.702 0 0 1 1.153-1.371c.942-.768 2.141-1.183 3.396-1.185 1.256-.002 2.455.41 3.398 1.175.48.391.87.854 1.152 1.367a4.28 4.28 0 0 1 .522 1.706 4.236 4.236 0 0 1-.239 1.811 4.54 4.54 0 0 1-1.035 1.626"/></svg>
\ No newline at end of file
diff --git a/docs/readme/marks/src/fal.png b/docs/readme/marks/src/fal.png
new file mode 100644
index 0000000..f1ad0b2
Binary files /dev/null and b/docs/readme/marks/src/fal.png differ
diff --git a/docs/readme/marks/src/fal.svg b/docs/readme/marks/src/fal.svg
new file mode 100644
index 0000000..c41076f
--- /dev/null
+++ b/docs/readme/marks/src/fal.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Fal</title><path clip-rule="evenodd" d="M15.477 0c.415 0 .749.338.788.752a7.775 7.775 0 006.985 6.984c.413.04.752.373.752.788v6.952c0 .415-.338.748-.752.788a7.775 7.775 0 00-6.985 6.984c-.04.414-.373.752-.788.752H8.525c-.416 0-.749-.338-.789-.752a7.775 7.775 0 00-6.984-6.984c-.414-.04-.752-.373-.752-.788V8.524c0-.415.338-.748.752-.788A7.775 7.775 0 007.736.752C7.776.338 8.11 0 8.526 0h6.95zM4.819 11.98a7.226 7.226 0 007.223 7.23 7.226 7.226 0 007.223-7.23c0-3.994-3.234-7.23-7.223-7.23a7.227 7.227 0 00-7.223 7.23z"></path></svg>
\ No newline at end of file
diff --git a/docs/readme/marks/src/meta.png b/docs/readme/marks/src/meta.png
new file mode 100644
index 0000000..76965f9
Binary files /dev/null and b/docs/readme/marks/src/meta.png differ
diff --git a/docs/readme/marks/src/meta.svg b/docs/readme/marks/src/meta.svg
new file mode 100644
index 0000000..7daf2eb
--- /dev/null
+++ b/docs/readme/marks/src/meta.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Meta</title><path d="M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z"></path></svg>
\ No newline at end of file
diff --git a/docs/readme/marks/src/minimax.png b/docs/readme/marks/src/minimax.png
new file mode 100644
index 0000000..485b6d3
Binary files /dev/null and b/docs/readme/marks/src/minimax.png differ
diff --git a/docs/readme/marks/src/minimax.svg b/docs/readme/marks/src/minimax.svg
new file mode 100644
index 0000000..1d32449
--- /dev/null
+++ b/docs/readme/marks/src/minimax.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Minimax</title><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z"></path></svg>
\ No newline at end of file
diff --git a/docs/readme/marks/src/tripo.png b/docs/readme/marks/src/tripo.png
new file mode 100644
index 0000000..53e37f7
Binary files /dev/null and b/docs/readme/marks/src/tripo.png differ
diff --git a/docs/readme/marks/src/tripo.svg b/docs/readme/marks/src/tripo.svg
new file mode 100644
index 0000000..40f4c37
--- /dev/null
+++ b/docs/readme/marks/src/tripo.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Tripo</title><path d="M12.661 4.752a.04.04 0 00-.013-.055.038.038 0 00-.02-.005H6.496a.19.19 0 01-.165-.092L4.245 1.052a.034.034 0 01.014-.047A.038.038 0 014.275 1c5.492 0 10.733 0 15.721.002 2.089 0 3.699 1.54 4.003 3.598.008.062-.019.092-.08.092h-6.67a.204.204 0 00-.174.1c-1.414 2.41-2.82 4.803-4.218 7.178-.28.472-.92.62-1.373.342-.19-.116-.357-.304-.502-.561a37.917 37.917 0 00-.882-1.489c-.222-.356-.234-.707-.035-1.052a661.77 661.77 0 012.597-4.46v.002z"></path><path d="M10.772 16.986c.57.972 1.935.916 2.489-.028L19 7.164a.127.127 0 01.116-.067h4.23c.017 0 .03.014.028.03 0 .005-.001.01-.003.013-2.605 4.432-5.232 8.906-7.88 13.42-1.283 2.191-4.278 2.517-6.179.947-.308-.254-.665-.727-1.069-1.417-2.525-4.324-5.098-8.71-7.72-13.162-1.063-1.803-.424-3.947 1.19-5.2.053-.041.095-.033.129.023 2.905 4.95 5.882 10.029 8.93 15.236z"></path></svg>
\ No newline at end of file
diff --git a/docs/readme/marks/tripo-black.png b/docs/readme/marks/tripo-black.png
new file mode 100644
index 0000000..e45b8fa
Binary files /dev/null and b/docs/readme/marks/tripo-black.png differ
diff --git a/docs/readme/marks/tripo-white.png b/docs/readme/marks/tripo-white.png
new file mode 100644
index 0000000..fa2aa5c
Binary files /dev/null and b/docs/readme/marks/tripo-white.png differ
diff --git a/docs/steps/step-1.png b/docs/steps/step-1.png
new file mode 100644
index 0000000..41220e5
Binary files /dev/null and b/docs/steps/step-1.png differ
diff --git a/docs/steps/step-2.png b/docs/steps/step-2.png
new file mode 100644
index 0000000..13ae77e
Binary files /dev/null and b/docs/steps/step-2.png differ
diff --git a/docs/steps/step-3.png b/docs/steps/step-3.png
new file mode 100644
index 0000000..0810745
Binary files /dev/null and b/docs/steps/step-3.png differ
diff --git a/docs/steps/step-4.png b/docs/steps/step-4.png
new file mode 100644
index 0000000..b4522d4
Binary files /dev/null and b/docs/steps/step-4.png differ
diff --git a/docs/steps/step-5.png b/docs/steps/step-5.png
new file mode 100644
index 0000000..87d92fd
Binary files /dev/null and b/docs/steps/step-5.png differ
diff --git a/docs/steps/step-6.png b/docs/steps/step-6.png
new file mode 100644
index 0000000..2b5b280
Binary files /dev/null and b/docs/steps/step-6.png differ
diff --git a/docs/steps/step-7.png b/docs/steps/step-7.png
new file mode 100644
index 0000000..e669985
Binary files /dev/null and b/docs/steps/step-7.png differ
diff --git a/docs/steps/step-8.png b/docs/steps/step-8.png
new file mode 100644
index 0000000..e32c410
Binary files /dev/null and b/docs/steps/step-8.png differ
diff --git a/examples/dragon_roar/det.npz b/examples/dragon_roar/det.npz
new file mode 100644
index 0000000..f6f6409
Binary files /dev/null and b/examples/dragon_roar/det.npz differ
diff --git a/mocap/__init__.py b/mocap/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/mocap/detect.py b/mocap/detect.py
new file mode 100644
index 0000000..c413c1b
--- /dev/null
+++ b/mocap/detect.py
@@ -0,0 +1,113 @@
+"""Read every joint in both halves of a two-camera video with a trained joint reader.
+
+python -m mocap.detect VIDEO.mp4 MODEL.pt REF.png OUT.npz [overlay.mp4]
+The clip is first aligned to the reference frame (the video model may resize or crop the canvas), then each frame is
+split into its front and side views. Writes pixel positions in layout coordinates and peak confidences per view.
+"""
+import sys
+
+import cv2
+import numpy as np
+import torch
+
+from mocap import layout
+from mocap.model import HM, SIZE, JointReader, decode, square
+
+
+def read_frames(path):
+ cap = cv2.VideoCapture(path)
+ fps = cap.get(cv2.CAP_PROP_FPS)
+ frames = []
+ while True:
+ ok, f = cap.read()
+ if not ok:
+ break
+ frames.append(f[..., ::-1])
+ return np.array(frames), fps
+
+
+def calibrate(first, ref):
+ """Affine map from video pixels to layout pixels, found by aligning the first frame to the reference image."""
+ h, w = first.shape[:2]
+ S = np.array([[layout.W / w, 0, 0], [0, layout.H / h, 0]], np.float32) # plain stretch to start
+ a = cv2.cvtColor(cv2.resize(ref, (640, 360)), cv2.COLOR_RGB2GRAY).astype(np.float32)
+ b = cv2.cvtColor(cv2.resize(cv2.warpAffine(first, S, (layout.W, layout.H)), (640, 360)), cv2.COLOR_RGB2GRAY).astype(np.float32)
+ warp = np.eye(2, 3, dtype=np.float32)
+ try:
+ _, warp = cv2.findTransformECC(a, b, warp, cv2.MOTION_AFFINE, (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 200, 1e-6), None, 5)
+ except cv2.error:
+ print("ECC did not converge; using a plain stretch")
+ # warp maps reference (half-size) coords to frame coords; we want frame -> layout
+ W2 = np.vstack([warp, [0, 0, 1]])
+ W2[:2, 2] *= 2 # half-size -> full-size translation
+ A = np.linalg.inv(W2) @ np.vstack([S, [0, 0, 1]])
+ return A[:2].astype(np.float32)
+
+
+def prep(view):
+ _, ox, oy, side = square(view, view[2, 2])
+ k = SIZE / side
+ A = np.array([[k, 0, ox * k], [0, k, oy * k]], np.float32)
+ fill = tuple(float(x) for x in view[2, 2])
+ out = cv2.warpAffine(view, A, (SIZE, SIZE), flags=cv2.INTER_AREA, borderMode=cv2.BORDER_CONSTANT, borderValue=fill)
+ return out, (ox, oy, side)
+
+
+def run(model, views, bs=32):
+ uv_all, conf_all = [], []
+ for i in range(0, len(views), bs):
+ batch = [prep(v) for v in views[i:i + bs]]
+ x = torch.from_numpy(np.stack([b[0] for b in batch])).permute(0, 3, 1, 2).float().cuda() / 255
+ with torch.autocast("cuda", dtype=torch.bfloat16):
+ hm = model(x).float()
+ uv, conf = decode(hm)
+ uv = uv.cpu().numpy() * SIZE / HM
+ for (_, (ox, oy, side)), u in zip(batch, uv):
+ uv_all.append(u * side / SIZE - np.array([ox, oy]))
+ conf_all.append(conf.cpu().numpy())
+ return np.array(uv_all), np.concatenate(conf_all)
+
+
+def load(model_path):
+ ck = torch.load(model_path, map_location="cpu", weights_only=True) # tensors, names and numbers only: safe for downloaded readers
+ model = JointReader(len(ck["names"])).cuda().eval()
+ model.load_state_dict(ck["state_dict"])
+ return model, ck["names"]
+
+
+def overlay(frames, fuv, suv, fconf, names, path, fps):
+ h, w = layout.H, layout.W
+ vw = cv2.VideoWriter(path, cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
+ col = lambda n: (209, 60, 245) if n.endswith("_L") else (255, 107, 47) if n.endswith("_R") else (255, 255, 255) # BGR
+ for t, f in enumerate(frames):
+ img = np.ascontiguousarray(f[..., ::-1])
+ for j, n in enumerate(names):
+ for (u, v), x0 in ((fuv[t, j], 0), (suv[t, j], layout.W_FRONT)):
+ cv2.circle(img, (int(u + x0), int(v)), 4, col(n), -1, cv2.LINE_AA)
+ vw.write(img)
+ vw.release()
+
+
+def main():
+ args = [a for a in sys.argv[1:] if not a.startswith("--")]
+ video, model_path, ref_path, out = args[:4]
+ frames, fps = read_frames(video)
+ ref = cv2.imread(ref_path)[..., ::-1]
+ if "--no-calib" in sys.argv: # already a layout frame (the exam)
+ A = np.array([[layout.W / frames.shape[2], 0, 0], [0, layout.H / frames.shape[1], 0]], np.float32)
+ else:
+ A = calibrate(frames[0], ref)
+ print("calibration (video px -> layout px):", A.round(4).tolist())
+ frames = np.array([cv2.warpAffine(f, A, (layout.W, layout.H), flags=cv2.INTER_AREA) for f in frames])
+ model, names = load(model_path)
+ fuv, fconf = run(model, [f[:, :layout.W_FRONT] for f in frames])
+ suv, sconf = run(model, [f[:, layout.W_FRONT:] for f in frames])
+ np.savez(out, front_uv=fuv, side_uv=suv, front_conf=fconf, side_conf=sconf, fps=fps, names=np.array(names), calib=A)
+ print(f"{len(frames)} frames at {fps:.2f} fps; mean confidence front {fconf.mean():.2f} side {sconf.mean():.2f}")
+ if len(args) > 4:
+ overlay(frames, fuv, suv, fconf, names, args[4], fps)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/mocap/exam.py b/mocap/exam.py
new file mode 100644
index 0000000..e48d3c3
--- /dev/null
+++ b/mocap/exam.py
@@ -0,0 +1,100 @@
+"""The exam: a made-up motion with known joints, filmed in the same studio, read back and scored bone by bone.
+
+python -m mocap.exam make rig_info.json motion.json [seed] [frames] random smooth motion inside the joint limits
+python -m mocap.exam video RENDER_DIR out.mp4 [fps] front/ + side/ renders -> one layout video
+python -m mocap.exam score truth_joints.json solved_joints.json per-joint error in centimetres
+"""
+import json, math, pathlib, sys
+
+import numpy as np
+
+
+def make(info_path, out, seed=0, T=120, fps=24):
+ info = json.load(open(info_path))
+ rng = np.random.default_rng(seed)
+ bones = [b["name"] for b in info["bones"]]
+ t = np.arange(T) / fps
+ eul = np.zeros((T, len(bones), 3))
+
+ def wave(amp):
+ f = rng.uniform(0.4, 1.8, 3)
+ ph = rng.uniform(0, 2 * math.pi, 3)
+ w = rng.dirichlet(np.ones(3))
+ return amp * (w[:, None] * np.sin(2 * math.pi * f[:, None] * t + ph[:, None])).sum(0)
+
+ for i, b in enumerate(info["bones"]):
+ if i == 0:
+ continue
+ lim = np.radians(np.array(b["limits_deg"], float))
+ for k in range(3):
+ lo, hi = lim[k]
+ c = np.clip(0.0, lo + 0.25 * (hi - lo), hi - 0.25 * (hi - lo))
+ amp = (0.45 if k == 0 else 0.25) * (hi - lo) / 2
+ eul[:, i, k] = np.clip(c + wave(amp), lo, hi)
+ yaw, pitch, roll = wave(math.radians(20)), wave(math.radians(8)), wave(math.radians(5))
+ quat = []
+ for y, p, r in zip(yaw, pitch, roll):
+ # pelvis basis rotation: local X = pitch, local Y (forward bone axis) = roll, local Z (down) = yaw
+ cx, sx, cy, sy, cz, sz = math.cos(p / 2), math.sin(p / 2), math.cos(r / 2), math.sin(r / 2), math.cos(y / 2), math.sin(y / 2)
+ qx, qy, qz = np.array([cx, sx, 0, 0]), np.array([cy, 0, sy, 0]), np.array([cz, 0, 0, sz])
+ quat.append(qmul(qz, qmul(qy, qx)).tolist())
+ trans = np.stack([wave(0.05), wave(0.12), 0.03 * np.abs(np.sin(2 * math.pi * 1.2 * t))], 1)
+ json.dump({"fps": fps, "bones": bones, "trans": trans.round(5).tolist(), "root_quat": quat,
+ "euler": eul.round(5).tolist()}, open(out, "w"))
+ print("exam motion", out, T, "frames")
+
+
+def qmul(a, b):
+ w1, x1, y1, z1 = a
+ w2, x2, y2, z2 = b
+ return np.array([w1 * w2 - x1 * x2 - y1 * y2 - z1 * z2, w1 * x2 + x1 * w2 + y1 * z2 - z1 * y2,
+ w1 * y2 - x1 * z2 + y1 * w2 + z1 * x2, w1 * z2 + x1 * y2 - y1 * x2 + z1 * w2])
+
+
+def video(render_dir, out, fps=24):
+ import cv2
+ from mocap import layout
+ d = pathlib.Path(render_dir)
+ fr = sorted((d / "front").glob("*.png"))
+ sd = sorted((d / "side").glob("*.png"))
+ vw = cv2.VideoWriter(out, cv2.VideoWriter_fourcc(*"mp4v"), fps, (layout.W, layout.H))
+ for a, b in zip(fr, sd):
+ f = cv2.imread(str(a), cv2.IMREAD_UNCHANGED)[..., [2, 1, 0, 3]]
+ s = cv2.imread(str(b), cv2.IMREAD_UNCHANGED)[..., [2, 1, 0, 3]]
+ if f.shape[0] != layout.H: # rendered below layout size
+ f = cv2.resize(f, (layout.W_FRONT, layout.H), interpolation=cv2.INTER_CUBIC)
+ s = cv2.resize(s, (layout.W_SIDE, layout.H), interpolation=cv2.INTER_CUBIC)
+ vw.write(np.ascontiguousarray(layout.compose(f, s)[..., ::-1]))
+ vw.release()
+ print("video", out, len(fr), "frames")
+
+
+GROUPS = {"paws": ("fpaw", "ftoe", "hpaw", "htoe"), "legs": ("elbow", "wrist", "knee", "hock", "shoulder", "hip_", "scap"),
+ "spine": ("hips", "spine", "chest"), "head": ("neck", "head", "nose"), "tail": ("tail",)}
+
+
+def score(truth_path, solved_path):
+ a = json.load(open(truth_path))
+ b = json.load(open(solved_path))
+ names = a["names"]
+ A, B = np.array(a["joints"]), np.array(b["joints"])
+ T = min(len(A), len(B))
+ e = np.linalg.norm(A[:T] - B[:T], axis=-1) * 100
+ out = {"mean_cm": float(e.mean()), "median_cm": float(np.median(e)), "p95_cm": float(np.percentile(e, 95))}
+ for g, keys in GROUPS.items():
+ idx = [i for i, n in enumerate(names) if any(n.startswith(k) for k in keys)]
+ out[f"{g}_cm"] = float(e[:, idx].mean())
+ worst = np.argsort(-e.mean(0))[:5]
+ out["worst_joints"] = {names[i]: round(float(e[:, i].mean()), 2) for i in worst}
+ print(json.dumps(out, indent=1))
+ return out
+
+
+if __name__ == "__main__":
+ cmd = sys.argv[1]
+ if cmd == "make":
+ make(sys.argv[2], sys.argv[3], int(sys.argv[4]) if len(sys.argv) > 4 else 0, int(sys.argv[5]) if len(sys.argv) > 5 else 120)
+ elif cmd == "video":
+ video(sys.argv[2], sys.argv[3], float(sys.argv[4]) if len(sys.argv) > 4 else 24)
+ elif cmd == "score":
+ score(sys.argv[2], sys.argv[3])
diff --git a/mocap/fal.py b/mocap/fal.py
new file mode 100644
index 0000000..b6a6b6b
--- /dev/null
+++ b/mocap/fal.py
@@ -0,0 +1,110 @@
+"""A small fal.ai queue client: submit, wait, upload, download (copied from prompt2moveset).
+
+The key comes from FAL_KEY (or a FAL_KEY= line in the repo's .env, which git ignores). Every finished request is
+appended to runs/fal_log.jsonl (endpoint, request id, status, wall time), so spend can be audited afterwards.
+"""
+import json, os, pathlib, time
+
+import requests
+
+ROOT = pathlib.Path(__file__).resolve().parents[1]
+LOG = pathlib.Path(os.environ.get("MOCAP_FAL_LOG", ROOT / "runs" / "fal_log.jsonl"))
+
+
+def key():
+ k = os.environ.get("FAL_KEY")
+ env = ROOT / ".env"
+ if not k and env.exists():
+ k = next((line.split("=", 1)[1].strip() for line in env.read_text().splitlines()
+ if line.startswith("FAL_KEY=")), None)
+ if not k:
+ raise SystemExit("set FAL_KEY (or put FAL_KEY=... in .env)")
+ return k
+
+
+def headers():
+ return {"Authorization": f"Key {key()}", "Content-Type": "application/json"}
+
+
+def retry(fn, tries=5):
+ """Run fn, retrying network failures with a growing pause."""
+ for attempt in range(tries):
+ try:
+ return fn()
+ except (requests.ConnectionError, requests.Timeout):
+ if attempt == tries - 1:
+ raise
+ time.sleep(3 * (attempt + 1))
+
+
+def submit(endpoint, payload):
+ for attempt in range(4):
+ r = retry(lambda: requests.post(f"https://queue.fal.run/{endpoint}", headers=headers(), json=payload, timeout=60))
+ if r.status_code < 500:
+ break
+ time.sleep(2 + 4 * attempt)
+ if r.status_code >= 400:
+ raise RuntimeError(f"submit {endpoint} -> {r.status_code}: {r.text[:800]}")
+ return {**r.json(), "endpoint": endpoint}
+
+
+def wait(sub, poll=3.0, timeout=1800):
+ t0, started = time.time(), None
+ while True:
+ s = retry(lambda: requests.get(sub["status_url"], headers=headers(), timeout=60)).json()
+ if s.get("status") == "IN_PROGRESS" and started is None:
+ started = time.time()
+ if s.get("status") == "COMPLETED":
+ break
+ if time.time() - t0 > timeout:
+ raise TimeoutError(sub["request_id"])
+ time.sleep(poll)
+ r = retry(lambda: requests.get(sub["response_url"], headers=headers(), timeout=120))
+ out = r.json()
+ info = {"wall_s": time.time() - t0, "run_s": (time.time() - started) if started else None}
+ LOG.parent.mkdir(parents=True, exist_ok=True)
+ with open(LOG, "a") as f:
+ f.write(json.dumps({"t": time.strftime("%Y-%m-%d %H:%M:%S"), "endpoint": sub.get("endpoint"),
+ "request_id": sub["request_id"], "status": r.status_code, **info}) + "\n")
+ if r.status_code >= 400:
+ raise RuntimeError(f"{r.status_code}: {json.dumps(out)[:800]}")
+ return out, info
+
+
+def run(endpoint, payload, **kw):
+ return wait(submit(endpoint, payload), **kw)
+
+
+TYPES = {"png": "image/png", "jpg": "image/jpeg", "jpeg": "image/jpeg", "webp": "image/webp", "mp4": "video/mp4",
+ "zip": "application/zip"}
+
+
+def upload(path):
+ """Upload a local file to fal storage and return its URL."""
+ p = pathlib.Path(path)
+ ct = TYPES[p.suffix[1:].lower()]
+
+ def go():
+ r = requests.post("https://rest.alpha.fal.ai/storage/upload/initiate?storage_type=fal-cdn-v3", headers=headers(),
+ json={"content_type": ct, "file_name": p.name}, timeout=60)
+ r.raise_for_status()
+ d = r.json()
+ requests.put(d["upload_url"], data=p.read_bytes(), headers={"Content-Type": ct}, timeout=300).raise_for_status()
+ return d["file_url"]
+
+ return retry(go)
+
+
+def download(url, dest):
+ dest = pathlib.Path(dest)
+ dest.parent.mkdir(parents=True, exist_ok=True)
+
+ def go():
+ with requests.get(url, stream=True, timeout=600) as r:
+ r.raise_for_status()
+ with open(dest, "wb") as f:
+ for c in r.iter_content(1 << 20):
+ f.write(c)
+ return dest
+
+ return retry(go)
diff --git a/mocap/generate.py b/mocap/generate.py
new file mode 100644
index 0000000..09c9555
--- /dev/null
+++ b/mocap/generate.py
@@ -0,0 +1,53 @@
+"""Send one two-camera reference frame and a prompt to several video models on fal, in parallel.
+
+python -m mocap.generate REF.png PROMPT.txt OUT_DIR [h3,h3max,seedance] [seconds] [seed]
+Each model's clip lands in OUT_DIR/<model>.mp4 with its request in OUT_DIR/<model>.json.
+"""
+import json, pathlib, sys
+from concurrent.futures import ThreadPoolExecutor
+
+from mocap import fal
+
+MODELS = {
+ "h3": ("minimax/h3/image-to-video",
+ lambda p, u, s: {"prompt": p, "image_url": u, "duration": s, "resolution": "768P", "prompt_expansion_mode": "disabled"}),
+ "h3max": ("minimax/h3-max/image-to-video",
+ lambda p, u, s: {"prompt": p, "image_url": u, "duration": s, "resolution": "768P", "prompt_expansion_mode": "disabled"}),
+ "h3maxturbo": ("minimax/h3-max-turbo/image-to-video",
+ lambda p, u, s: {"prompt": p, "image_url": u, "duration": s, "resolution": "768P", "prompt_expansion_mode": "disabled"}),
+ "seedance": ("bytedance/seedance-2.5/us/image-to-video",
+ lambda p, u, s: {"prompt": p, "image_url": u, "duration": str(s), "resolution": "720p", "generate_audio": False}),
+ "flux3max": ("blackforestlabs/flux-3-max/image-to-video",
+ lambda p, u, s: {"prompt": p, "image_url": u, "duration": s, "resolution": "720p", "generate_audio": False}),
+}
+
+
+def one(name, prompt, url, seconds, out, seed=None):
+ endpoint, payload = MODELS[name]
+ req = payload(prompt, url, seconds)
+ if seed is not None:
+ req["seed"] = seed
+ (out / f"{name}.json").write_text(json.dumps({"endpoint": endpoint, "request": req}, indent=1))
+ try:
+ res, info = fal.run(endpoint, req, timeout=3600)
+ except Exception as e: # keep the other models going
+ print(name, "FAILED", str(e)[:300], flush=True)
+ return
+ video = res.get("video") or (res.get("videos") or [{}])[0]
+ fal.download(video["url"], out / f"{name}.mp4")
+ (out / f"{name}.json").write_text(json.dumps({"endpoint": endpoint, "request": req, "response": res, "info": info}, indent=1))
+ print(name, "ok", round(info["wall_s"]), "s", flush=True)
+
+
+if __name__ == "__main__":
+ ref, prompt_file, out = sys.argv[1:4]
+ names = sys.argv[4].split(",") if len(sys.argv) > 4 else ["h3", "h3max", "seedance"]
+ seconds = int(sys.argv[5]) if len(sys.argv) > 5 else 5
+ seed = int(sys.argv[6]) if len(sys.argv) > 6 else None
+ out = pathlib.Path(out)
+ out.mkdir(parents=True, exist_ok=True)
+ url = fal.upload(ref)
+ prompt = pathlib.Path(prompt_file).read_text().strip()
+ with ThreadPoolExecutor(len(names)) as ex:
+ for n in names:
+ ex.submit(one, n, prompt, url, seconds, out, seed)
diff --git a/mocap/layout.py b/mocap/layout.py
new file mode 100644
index 0000000..2e7ad11
--- /dev/null
+++ b/mocap/layout.py
@@ -0,0 +1,62 @@
+"""The two-camera frame: compose renders into it, split video frames out of it, map pixels to metres and back.
+
+Mirrors blender/common.py. Front view (left, 420 px) looks along +Y: u grows with X. Side view (right, 860 px) looks
+along +X: u grows with -Y, so the head (-Y) is on the right. In both, v grows downward with -Z and the ground (z = 0)
+is row 630.
+"""
+import json, os, pathlib
+
+import numpy as np
+
+H, W_FRONT, W_SIDE = 720, 420, 860
+M_PER_PX = 1.9 / H
+GROUND_V = 630
+# MOCAP_CREATURE=<assets dir> with a creature.json "layout" overrides the wolf's framing (see blender/common.py)
+_cfg = pathlib.Path(os.environ.get("MOCAP_CREATURE", "")) / "creature.json"
+if os.environ.get("MOCAP_CREATURE") and _cfg.exists():
+ _l = json.load(open(_cfg)).get("layout", {})
+ W_FRONT, W_SIDE = _l.get("W_FRONT", W_FRONT), _l.get("W_SIDE", W_SIDE)
+ M_PER_PX, GROUND_V = _l.get("M_PER_PX", M_PER_PX), _l.get("GROUND_V", GROUND_V)
+W = W_FRONT + W_SIDE
+Z_CENTER = (GROUND_V - H / 2) * M_PER_PX
+BG, FLOOR, DIVIDER = (128, 130, 134), (152, 154, 158), (34, 34, 38)
+
+
+def compose(front_rgba, side_rgba, bg=BG, floor=FLOOR, divider=DIVIDER):
+ """Alpha-composite the two RGBA renders over the studio backdrop (grey wall, lighter floor band, divider)."""
+ out = np.zeros((H, W, 3), np.float32)
+ out[:] = bg
+ out[GROUND_V:] = floor
+ for img, x0 in ((front_rgba, 0), (side_rgba, W_FRONT)):
+ img = img.astype(np.float32)
+ a = img[..., 3:4] / 255.0
+ h, w = img.shape[:2]
+ out[:h, x0:x0 + w] = img[..., :3] * a + out[:h, x0:x0 + w] * (1 - a)
+ out[:, W_FRONT - 2:W_FRONT + 2] = divider
+ return out.clip(0, 255).astype(np.uint8)
+
+
+def split(frame):
+ """A 1280 x 720 frame (resize first if needed) into its front and side views."""
+ return frame[:, :W_FRONT], frame[:, W_FRONT:]
+
+
+def project(p):
+ """World points (..., 3) to pixel coordinates in each view: front (u, v) and side (u, v)."""
+ p = np.asarray(p, np.float64)
+ v = H / 2 - (p[..., 2] - Z_CENTER) / M_PER_PX
+ front = np.stack([W_FRONT / 2 + p[..., 0] / M_PER_PX, v], -1)
+ side = np.stack([W_SIDE / 2 - p[..., 1] / M_PER_PX, v], -1)
+ return front, side
+
+
+def unproject_front(uv):
+ """Front-view pixels to (x, z) in metres."""
+ uv = np.asarray(uv, np.float64)
+ return np.stack([(uv[..., 0] - W_FRONT / 2) * M_PER_PX, Z_CENTER + (H / 2 - uv[..., 1]) * M_PER_PX], -1)
+
+
+def unproject_side(uv):
+ """Side-view pixels to (y, z) in metres."""
+ uv = np.asarray(uv, np.float64)
+ return np.stack([-(uv[..., 0] - W_SIDE / 2) * M_PER_PX, Z_CENTER + (H / 2 - uv[..., 1]) * M_PER_PX], -1)
diff --git a/mocap/lora.py b/mocap/lora.py
new file mode 100644
index 0000000..ff72b79
--- /dev/null
+++ b/mocap/lora.py
@@ -0,0 +1,89 @@
+"""Train and use a MiniMax H3 image-to-video LoRA on fal for the two-camera layout.
+
+python -m mocap.lora pack DATA_DIR out.zip videos + same-name .txt captions -> zip
+python -m mocap.lora train out.zip RUN_DIR steps [--debug] upload, train, save lora.json (--debug: 1 step + the
+ trainer's preprocessed dataset, to check it first)
+python -m mocap.lora generate LORA REF.png PROMPT.txt OUT.mp4 [scale] [seed]
+ LORA: a training run's dir, a .safetensors, or a URL
+python -m mocap.lora resume RUN_DIR keep waiting on a submitted run (after a restart)
+"""
+import json, pathlib, sys, zipfile
+
+from mocap import fal
+
+TRIGGER = "TWOCAM"
+TRAINER = "minimax/h3/i2v/trainer"
+INFER = "minimax/h3/image-to-video/lora"
+
+
+def pack(data_dir, out):
+ d = pathlib.Path(data_dir)
+ vids = sorted(d.glob("*.mp4"))
+ with zipfile.ZipFile(out, "w", zipfile.ZIP_STORED) as z:
+ for v in vids:
+ z.write(v, v.name)
+ z.write(v.with_suffix(".txt"), v.with_suffix(".txt").name)
+ print(f"packed {len(vids)} clips into {out} ({pathlib.Path(out).stat().st_size / 1e6:.1f} MB)")
+
+
+def train(zip_path, run_dir, steps, debug=False):
+ run = pathlib.Path(run_dir)
+ run.mkdir(parents=True, exist_ok=True)
+ url = fal.upload(zip_path)
+ req = {"training_data_url": url, "number_of_steps": 1 if debug else steps, "rank": 32, "learning_rate": 2e-4,
+ "number_of_frames": 107, "frame_rate": 24, "resolution": "medium", "aspect_ratio": "16:9",
+ "first_frame_conditioning_p": 0.7, "trigger_phrase": TRIGGER, "debug_dataset": debug}
+ (run / "request.json").write_text(json.dumps(req, indent=1))
+ sub = fal.submit(TRAINER, req)
+ (run / "submitted.json").write_text(json.dumps(sub, indent=1))
+ print("submitted", sub["request_id"], flush=True)
+ res, info = fal.wait(sub, poll=20, timeout=6 * 3600)
+ (run / "lora.json").write_text(json.dumps({"response": res, "info": info}, indent=1))
+ if debug and res.get("debug_dataset"):
+ fal.download(res["debug_dataset"]["url"], run / "debug_dataset.zip")
+ print("done", json.dumps(res)[:600], info, flush=True)
+
+
+def resume(run_dir):
+ run = pathlib.Path(run_dir)
+ sub = json.loads((run / "submitted.json").read_text())
+ res, info = fal.wait(sub, poll=30, timeout=6 * 3600)
+ (run / "lora.json").write_text(json.dumps({"response": res, "info": info}, indent=1))
+ print("done", json.dumps(res)[:600], info, flush=True)
+
+
+def lora_path(src):
+ """The LoRA for fal to load: a training run's directory (the URL in its lora.json), a URL, or a local .safetensors
+ (uploaded to fal first, e.g. the wolf LoRA from the examples release)."""
+ if str(src).startswith(("http://", "https://")):
+ return str(src)
+ p = pathlib.Path(src)
+ if p.suffix == ".safetensors":
+ return fal.upload(p)
+ return json.loads((p / "lora.json").read_text())["response"]["lora_file"]["url"]
+
+
+def generate(run_dir, ref, prompt_file, out, scale=1.0, seed=None):
+ lora = lora_path(run_dir)
+ prompt = TRIGGER + " " + pathlib.Path(prompt_file).read_text().strip()
+ req = {"prompt": prompt, "image_url": fal.upload(ref), "loras": [{"path": lora, "scale": scale}], "duration": 5,
+ "resolution": "768P", "prompt_expansion_mode": "disabled"}
+ if seed is not None:
+ req["seed"] = seed
+ res, info = fal.run(INFER, req, timeout=3600)
+ fal.download(res["video"]["url"], out)
+ pathlib.Path(str(out) + ".json").write_text(json.dumps({"request": req, "response": res, "info": info}, indent=1))
+ print("generated", out, round(info["wall_s"]), "s")
+
+
+if __name__ == "__main__":
+ cmd, args = sys.argv[1], [a for a in sys.argv[2:] if not a.startswith("--")]
+ if cmd == "pack":
+ pack(*args[:2])
+ elif cmd == "train":
+ train(args[0], args[1], int(args[2]), "--debug" in sys.argv)
+ elif cmd == "resume":
+ resume(args[0])
+ elif cmd == "generate":
+ generate(args[0], args[1], args[2], args[3], float(args[4]) if len(args) > 4 else 1.0,
+ int(args[5]) if len(args) > 5 else None)
diff --git a/mocap/mirror.py b/mocap/mirror.py
new file mode 100644
index 0000000..b2c385b
--- /dev/null
+++ b/mocap/mirror.py
@@ -0,0 +1,24 @@
+"""Mirror a motion left to right: a new, equally plausible move (a limp on the other leg, a head turn the other way).
+
+python -m mocap.mirror motion.json mirrored.json
+Every bone's local X is world X, so mirroring across the YZ plane keeps rotations about X (flexion) and flips the
+ones about Y and Z; left and right bones swap, the pelvis quaternion becomes (w, x, -y, -z) and the root moves to -x.
+"""
+import json, sys
+
+
+def mirror(m):
+ names = m["bones"]
+ idx = {n: i for i, n in enumerate(names)}
+ partner = [idx.get(n[:-2] + ("_R" if n.endswith("_L") else "_L"), i) if n.endswith(("_L", "_R")) else i
+ for i, n in enumerate(names)]
+ out = dict(m)
+ out["euler"] = [[[e[partner[i]][0], -e[partner[i]][1], -e[partner[i]][2]] for i in range(len(names))] for e in m["euler"]]
+ out["root_quat"] = [[w, x, -y, -z] for w, x, y, z in m["root_quat"]]
+ out["trans"] = [[-x, y, z] for x, y, z in m["trans"]]
+ out.pop("joints", None)
+ return out
+
+
+if __name__ == "__main__":
+ json.dump(mirror(json.load(open(sys.argv[1]))), open(sys.argv[2], "w"))
diff --git a/mocap/model.py b/mocap/model.py
new file mode 100644
index 0000000..ef076f6
--- /dev/null
+++ b/mocap/model.py
@@ -0,0 +1,70 @@
+"""The joint reader: DINOv2 (ViT-B/14 with registers) plus a small upsampling head that draws one heatmap per joint.
+
+Both views go through the same network one at a time. A view is padded to a square with the backdrop grey, centred,
+and resized to 448 x 448 (32 x 32 patches); heatmaps come out at 128 x 128.
+"""
+import numpy as np
+import torch
+import torch.nn as nn
+import torch.nn.functional as F
+from transformers import AutoModel
+
+BACKBONE = "facebook/dinov2-with-registers-base"
+SIZE, HM = 448, 128
+MEAN = torch.tensor([0.485, 0.456, 0.406]).view(1, 3, 1, 1)
+STD = torch.tensor([0.229, 0.224, 0.225]).view(1, 3, 1, 1)
+
+
+class JointReader(nn.Module):
+ def __init__(self, n_joints, backbone=BACKBONE):
+ super().__init__()
+ self.backbone = AutoModel.from_pretrained(backbone)
+ self.n_reg = getattr(self.backbone.config, "num_register_tokens", 0)
+ c = self.backbone.config.hidden_size
+
+ def block(i, o):
+ return nn.Sequential(nn.Conv2d(i, o, 3, padding=1), nn.GroupNorm(16, o), nn.GELU())
+
+ self.neck = block(c, 256)
+ self.up1 = block(256, 128)
+ self.up2 = block(128, 128)
+ self.out = nn.Conv2d(128, n_joints, 1)
+
+ def forward(self, x):
+ b = x.shape[0]
+ tokens = self.backbone(pixel_values=(x - MEAN.to(x)) / STD.to(x)).last_hidden_state
+ g = SIZE // 14
+ f = tokens[:, 1 + self.n_reg:].transpose(1, 2).reshape(b, -1, g, g)
+ f = self.neck(f)
+ f = self.up1(F.interpolate(f, scale_factor=2, mode="bilinear", align_corners=False))
+ f = self.up2(F.interpolate(f, size=(HM, HM), mode="bilinear", align_corners=False))
+ return self.out(f)
+
+
+def square(img, fill):
+ """Pad an H x W x 3 view to a centred square; return it and the (offset_x, offset_y) of the view inside."""
+ h, w = img.shape[:2]
+ s = max(h, w)
+ out = np.empty((s, s, 3), img.dtype)
+ out[:] = fill
+ ox, oy = (s - w) // 2, (s - h) // 2
+ out[oy:oy + h, ox:ox + w] = img
+ return out, ox, oy, s
+
+
+def decode(hm):
+ """Heatmaps (B, J, 128, 128) to sub-pixel peaks in heatmap units and peak values."""
+ b, j, h, w = hm.shape
+ flat = hm.reshape(b, j, -1)
+ conf, idx = flat.max(-1)
+ y, x = (idx // w).float(), (idx % w).float()
+ # quadratic refinement from the neighbours of the peak
+ xi, yi = x.long().clamp(1, w - 2), y.long().clamp(1, h - 2)
+ gather = lambda dy, dx: hm.gather(-1, (xi + dx).view(b, j, 1, 1).expand(b, j, h, 1)).squeeze(-1) \
+ .gather(-1, (yi + dy).view(b, j, 1)).squeeze(-1)
+ c, l, r, u, d = gather(0, 0), gather(0, -1), gather(0, 1), gather(-1, 0), gather(1, 0)
+ dx = 0.5 * (r - l) / (2 * c - l - r).clamp(min=1e-6)
+ dy = 0.5 * (d - u) / (2 * c - u - d).clamp(min=1e-6)
+ x = x + dx.clamp(-0.5, 0.5)
+ y = y + dy.clamp(-0.5, 0.5)
+ return torch.stack([x, y], -1), conf
diff --git a/mocap/showcase.py b/mocap/showcase.py
new file mode 100644
index 0000000..fc84ebb
--- /dev/null
+++ b/mocap/showcase.py
@@ -0,0 +1,89 @@
+"""One comparison video per clip, 1920 x 1080, four panes:
+
+ AI clip, both cameras, with the joints the reader found | the rig playing the solved motion, three-quarter view
+ AI clip, side camera only | the rig through the same side camera
+
+python -m mocap.showcase VIDEO.mp4 DETECTIONS.npz RENDER_DIR out.mp4 "label"
+RENDER_DIR holds persp/ and side/ frames from blender/apply_motion.py. Left legs pink, right blue, middle white.
+"""
+import pathlib, sys
+
+import cv2
+import numpy as np
+
+from mocap import layout
+from mocap.detect import read_frames
+
+PINK, BLUE, WHITE = (209, 60, 245), (255, 107, 47), (245, 245, 245) # BGR
+
+
+def bone_pairs(names):
+ """Lines to draw between joints: every bone whose two ends are both read, from the creature's rig_info.json."""
+ import json, os, pathlib
+ root = pathlib.Path(os.environ.get("MOCAP_CREATURE", pathlib.Path(__file__).resolve().parents[1] / "assets/wolf"))
+ info = next((json.load(open(p)) for p in (root / "rigged_v2/rig_info.json", root / "rigged/rig_info.json") if p.exists()), None)
+ idx = {n: i for i, n in enumerate(names)}
+ return [(idx[b["head_joint"]], idx[b["tail_joint"]]) for b in (info or {"bones": []})["bones"]
+ if b["head_joint"] in idx and b["tail_joint"] in idx]
+
+
+def over_backdrop(rgba_bgr, floor=True):
+ a = rgba_bgr[..., 3:4] / 255.0
+ bg = np.empty((*rgba_bgr.shape[:2], 3), np.float32)
+ bg[:] = layout.BG[::-1]
+ if floor: # only meaningful for the layout's level cameras
+ bg[layout.GROUND_V * rgba_bgr.shape[0] // layout.H:] = layout.FLOOR[::-1]
+ return (rgba_bgr[..., :3] * a + bg * (1 - a)).astype(np.uint8)
+
+
+def fit(img, w, h, fill=(24, 22, 22)):
+ """Scale into a w x h cell, keeping the aspect, centred on a dark fill."""
+ k = min(w / img.shape[1], h / img.shape[0])
+ r = cv2.resize(img, (round(img.shape[1] * k), round(img.shape[0] * k)), interpolation=cv2.INTER_AREA)
+ cell = np.empty((h, w, 3), np.uint8)
+ cell[:] = fill
+ y, x = (h - r.shape[0]) // 2, (w - r.shape[1]) // 2
+ cell[y:y + r.shape[0], x:x + r.shape[1]] = r
+ return cell
+
+
+def label(img, text):
+ cv2.putText(img, text, (18, 32), cv2.FONT_HERSHEY_SIMPLEX, 0.7, WHITE, 1, cv2.LINE_AA)
+
+
+def main():
+ video, det_path, render_dir, out, title = sys.argv[1:6]
+ det = np.load(det_path)
+ names = [str(n) for n in det["names"]]
+ pairs = bone_pairs(names)
+ col = lambda n: PINK if n.endswith("_L") else BLUE if n.endswith("_R") else WHITE
+ frames, fps = read_frames(video)
+ persp = sorted((pathlib.Path(render_dir) / "persp").glob("*.png"))
+ side = sorted((pathlib.Path(render_dir) / "side").glob("*.png"))
+ T = min(len(frames), len(persp), len(side), len(det["front_uv"]))
+ vw = cv2.VideoWriter(out, cv2.VideoWriter_fourcc(*"mp4v"), fps, (1920, 1080))
+ for t in range(T):
+ f = np.ascontiguousarray(cv2.warpAffine(frames[t], det["calib"], (layout.W, layout.H), flags=cv2.INTER_AREA)[..., ::-1])
+ clean_side = f[:, layout.W_FRONT:].copy()
+ for uv, x0 in ((det["front_uv"][t], 0), (det["side_uv"][t], layout.W_FRONT)):
+ for a, b in pairs:
+ cv2.line(f, (int(uv[a, 0] + x0), int(uv[a, 1])), (int(uv[b, 0] + x0), int(uv[b, 1])), col(names[b]), 2, cv2.LINE_AA)
+ for j, n in enumerate(names):
+ cv2.circle(f, (int(uv[j, 0] + x0), int(uv[j, 1])), 4, col(n), -1, cv2.LINE_AA)
+ p = over_backdrop(cv2.imread(str(persp[t]), cv2.IMREAD_UNCHANGED), floor=False)
+ s = over_backdrop(cv2.imread(str(side[t]), cv2.IMREAD_UNCHANGED))
+ tl, tr, bl, br = fit(f, 960, 540), fit(p, 960, 540), fit(clean_side, 960, 540), fit(s, 960, 540)
+ label(tl, f"{title}: AI video, joints read by DINOv2")
+ label(tr, "the rig, solved motion")
+ label(bl, "AI video, side camera")
+ label(br, "the rig, same side camera")
+ canvas = np.vstack([np.hstack([tl, tr]), np.hstack([bl, br])])
+ canvas[:, 958:962] = (24, 22, 22)
+ canvas[538:542] = (24, 22, 22)
+ vw.write(canvas)
+ vw.release()
+ print("showcase", out, T, "frames")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/mocap/solve.py b/mocap/solve.py
new file mode 100644
index 0000000..4d97981
--- /dev/null
+++ b/mocap/solve.py
@@ -0,0 +1,423 @@
+"""Fit the rig to the joints read from both views: one pose per frame, smooth over time, inside the joint limits.
+
+python -m mocap.solve DETECTIONS.npz rig_info.json OUT.json
+Before fitting, the side view's left and right legs are checked against the front view: a joint has the same height
+in both halves, so if swapping a pair of legs in the side view makes the heights agree better, the side reader
+mixed up the near and far leg and they are swapped back. The same height test gives the sync score: how far apart
+the two halves disagree, and the time lag between them that agrees best.
+
+The fit runs Blender's forward kinematics in torch (pose = parent pose x rest offset x Euler XYZ), with the pelvis
+free to turn and move, every other bone limited to its range, and minimises the confidence-weighted distance between
+the rig's projected joints and the readings in both views, plus smoothness and a small pull toward the rest pose.
+"""
+import json, sys
+
+import numpy as np
+import torch
+
+from mocap import layout
+
+LEGS = {"F": ["scap", "shoulder", "elbow", "wrist", "fpaw", "ftoe"], "H": ["hip", "knee", "hock", "hpaw", "htoe"]}
+
+
+def leg_pairs(names):
+ """Index pairs (left, right) of every leg joint, grouped per front/hind pair."""
+ out = {}
+ for k, stems in LEGS.items():
+ pairs = []
+ for s in stems:
+ if f"{s}_L" in names:
+ pairs.append((names.index(f"{s}_L"), names.index(f"{s}_R")))
+ out[k] = pairs
+ return out
+
+
+def fix_swaps(d, names, margin=4.0):
+ """Swap near/far legs in the side view where the heights say the reader mixed them up."""
+ fv, sv = d["front_uv"][..., 1], d["side_uv"][..., 1]
+ c = np.minimum(d["front_conf"], d["side_conf"]).clip(0, 1)
+ swapped = {}
+ for k, pairs in leg_pairs(names).items():
+ L, R = np.array(pairs).T
+ same = (c[:, L] * np.abs(sv[:, L] - fv[:, L]) + c[:, R] * np.abs(sv[:, R] - fv[:, R])).sum(1)
+ swap = (c[:, L] * np.abs(sv[:, R] - fv[:, L]) + c[:, R] * np.abs(sv[:, L] - fv[:, R])).sum(1)
+ gain = (same - swap) / len(pairs)
+ gain = np.array([np.median(gain[max(0, t - 2):t + 3]) for t in range(len(gain))])
+ do = gain > margin
+ for t in np.where(do)[0]:
+ d["side_uv"][t, L], d["side_uv"][t, R] = d["side_uv"][t, R].copy(), d["side_uv"][t, L].copy()
+ d["side_conf"][t, L], d["side_conf"][t, R] = d["side_conf"][t, R].copy(), d["side_conf"][t, L].copy()
+ swapped[k] = int(do.sum())
+ return swapped
+
+
+def height_features(uv, conf, names):
+ """Per-frame heights that do not care about left/right labels: middle joints as they are, each leg pair as its
+ mean height and its height difference. Returns (T, K) features and (T, K) weights."""
+ v = uv[..., 1]
+ feats, w = [], []
+ for i, n in enumerate(names):
+ if not n.endswith(("_L", "_R")):
+ feats.append(v[:, i]); w.append(conf[:, i])
+ elif n.endswith("_L"):
+ a, b = i, names.index(n[:-2] + "_R")
+ c = np.minimum(conf[:, a], conf[:, b])
+ feats += [(v[:, a] + v[:, b]) / 2, np.abs(v[:, a] - v[:, b])]
+ w += [c, c]
+ return np.stack(feats, 1), np.stack(w, 1).clip(0, 1)
+
+
+def align_views(d, names, band=48, step_penalty=1.0):
+ """Video models often play the two halves out of step (one view runs ahead). Match the halves frame to frame
+ with dynamic time warping on joint heights, which both views share, and resample the front view onto the side
+ view's timeline. Returns how far each side frame's match was moved, in frames."""
+ F, Fw = height_features(d["front_uv"], d["front_conf"], names)
+ S, Sw = height_features(d["side_uv"], d["side_conf"], names)
+ T = len(F)
+ C = np.full((T, T), np.inf)
+ for i in range(T):
+ lo, hi = max(0, i - band), min(T, i + band + 1)
+ w = np.minimum(Fw[i][None], Sw[lo:hi])
+ C[i, lo:hi] = (w * np.abs(F[i][None] - S[lo:hi])).sum(1) / w.sum(1).clip(1e-6)
+ D = np.full((T, T), np.inf)
+ D[0, 0] = C[0, 0]
+ for i in range(T):
+ for j in range(max(0, i - band), min(T, i + band + 1)):
+ if i == j == 0:
+ continue
+ best = min(D[i - 1, j - 1] if i and j else np.inf, D[i - 1, j] + step_penalty if i else np.inf,
+ D[i, j - 1] + step_penalty if j else np.inf)
+ D[i, j] = C[i, j] + best
+ i, j, path = T - 1, T - 1, [(T - 1, T - 1)]
+ while i or j:
+ cands = [(D[i - 1, j - 1], i - 1, j - 1) if i and j else (np.inf, 0, 0),
+ (D[i - 1, j], i - 1, j) if i else (np.inf, 0, 0), (D[i, j - 1], i, j - 1) if j else (np.inf, 0, 0)]
+ _, i, j = min(cands)
+ path.append((i, j))
+ path = np.array(path[::-1])
+ match = np.array([path[path[:, 1] == j, 0].mean() for j in range(T)]) # front frame for each side frame
+ match = np.convolve(np.pad(match, 3, mode="edge"), np.ones(7) / 7, mode="valid") # no stair steps
+ t = np.arange(T)
+ for k in ("front_uv", "front_conf"):
+ a = d[k].reshape(T, -1)
+ d[k] = np.stack([np.interp(match, t, a[:, c]) for c in range(a.shape[1])], 1).reshape(d[k].shape)
+ return match - t
+
+
+def feet():
+ """The joints whose heights make the sync score: creature.json "feet" when MOCAP_CREATURE is set, else the wolf's."""
+ import os, pathlib
+ cfg = pathlib.Path(os.environ.get("MOCAP_CREATURE", "")) / "creature.json"
+ if os.environ.get("MOCAP_CREATURE") and cfg.exists():
+ return json.load(open(cfg)).get("feet", [])
+ return ["fpaw_L", "fpaw_R", "hpaw_L", "hpaw_R"]
+
+
+def paw_agreement(d, names):
+ """Correlation of each paw's height between the two views over the clip: +1 when both halves show the same
+ footfalls, near 0 or negative when the video model animated the views differently."""
+ out = {}
+ for k in feet():
+ if k in names:
+ j = names.index(k)
+ a, b = d["front_uv"][:, j, 1], d["side_uv"][:, j, 1]
+ out[k] = float(np.corrcoef(a, b)[0, 1]) if a.std() > 0.5 and b.std() > 0.5 else None
+ vals = [v for v in out.values() if v is not None]
+ out["score"] = float(np.mean(vals)) if vals else None
+ return out
+
+
+def sync_report(d):
+ """Mean height disagreement between the halves (layout px) and the lag (frames) that minimises it."""
+ fv, sv = d["front_uv"][..., 1], d["side_uv"][..., 1]
+ c = np.minimum(d["front_conf"], d["side_conf"]).clip(0, 1)
+ err = (c * np.abs(fv - sv)).sum(1) / c.sum(1).clip(1e-6)
+ best = None
+ T = len(fv)
+ for lag in range(-12, 13):
+ a = fv[max(0, lag):T + min(0, lag)]
+ b = sv[max(0, -lag):T + min(0, -lag)]
+ e = np.abs(a - b).mean()
+ if best is None or e < best[1]:
+ best = (lag, e)
+ return {"mean_height_gap_px": float(err.mean()), "worst_frame_gap_px": float(err.max()),
+ "per_frame_gap_px": err.round(2).tolist(), "best_lag_frames": best[0], "gap_at_best_lag_px": float(best[1])}
+
+
+def euler_xyz(a):
+ """Blender Euler XYZ (applied X, then Y, then Z) to rotation matrices: Rz @ Ry @ Rx."""
+ x, y, z = a.unbind(-1)
+ cx, sx, cy, sy, cz, sz = x.cos(), x.sin(), y.cos(), y.sin(), z.cos(), z.sin()
+ o, l = torch.zeros_like(x), torch.ones_like(x)
+ Rx = torch.stack([l, o, o, o, cx, -sx, o, sx, cx], -1).view(*x.shape, 3, 3)
+ Ry = torch.stack([cy, o, sy, o, l, o, -sy, o, cy], -1).view(*x.shape, 3, 3)
+ Rz = torch.stack([cz, -sz, o, sz, cz, o, o, o, l], -1).view(*x.shape, 3, 3)
+ return Rz @ Ry @ Rx
+
+
+def axis_angle(v):
+ th = v.norm(dim=-1, keepdim=True).clamp(min=1e-8)
+ k = v / th
+ K = torch.zeros(*v.shape[:-1], 3, 3, dtype=v.dtype, device=v.device)
+ K[..., 0, 1], K[..., 0, 2], K[..., 1, 0] = -k[..., 2], k[..., 1], k[..., 2]
+ K[..., 1, 2], K[..., 2, 0], K[..., 2, 1] = -k[..., 0], -k[..., 1], k[..., 0]
+ th = th[..., None]
+ return torch.eye(3, dtype=v.dtype, device=v.device) + th.sin() * K + (1 - th.cos()) * K @ K
+
+
+class Rig:
+ def __init__(self, info, dev="cpu"):
+ self.names = [b["name"] for b in info["bones"]]
+ self.parent = [b["parent"] for b in info["bones"]]
+ B = torch.tensor([b["matrix_local"] for b in info["bones"]], dtype=torch.float64, device=dev)
+ self.B = B
+ self.L = torch.tensor([b["length"] for b in info["bones"]], dtype=torch.float64, device=dev)
+ # rest offset of each bone in its parent's frame
+ self.off = torch.stack([B[i] if p < 0 else torch.linalg.inv(B[p]) @ B[i] for i, p in enumerate(self.parent)])
+ lim = np.radians(np.array([b["limits_deg"] for b in info["bones"]], float))
+ self.lo = torch.tensor(lim[..., 0], device=dev)
+ self.hi = torch.tensor(lim[..., 1], device=dev)
+ self.kp = [(k["bone"], k["end"]) for k in info["keypoints"]]
+ self.kp_names = [k["name"] for k in info["keypoints"]]
+ self.rest_kp = torch.tensor([k["rest"] for k in info["keypoints"]], dtype=torch.float64, device=dev)
+
+ def forward(self, trans, root_rot, eul):
+ """trans (T,3) world offset, root_rot (T,3,3) pelvis basis, eul (T,nb,3) Euler for every bone (root ignored)."""
+ T, nb = eul.shape[:2]
+ R = euler_xyz(eul)
+ P = [None] * nb
+ for i, p in enumerate(self.parent):
+ basis = torch.zeros(T, 4, 4, dtype=eul.dtype, device=eul.device)
+ basis[:, :3, :3] = root_rot if p < 0 else R[:, i]
+ basis[:, 3, 3] = 1
+ if p < 0:
+ M = self.off[i].expand(T, 4, 4) @ basis
+ M = M.clone()
+ M[:, :3, 3] += trans
+ else:
+ M = P[p] @ self.off[i] @ basis
+ P[i] = M
+ P = torch.stack(P, 1)
+ joints = []
+ for b, end in self.kp:
+ if end == "head":
+ joints.append(P[:, b, :3, 3])
+ else:
+ joints.append(P[:, b, :3, 1] * self.L[b] + P[:, b, :3, 3])
+ return torch.stack(joints, 1), P
+
+
+def project(J):
+ v = layout.H / 2 - (J[..., 2] - layout.Z_CENTER) / layout.M_PER_PX
+ f = torch.stack([layout.W_FRONT / 2 + J[..., 0] / layout.M_PER_PX, v], -1)
+ s = torch.stack([layout.W_SIDE / 2 - J[..., 1] / layout.M_PER_PX, v], -1)
+ return f, s
+
+
+def triangulate(d, front_height_weight=0.25):
+ """Joints in metres: x from the front view, y from the side view, height mostly from the side view."""
+ fx = (d["front_uv"][..., 0] - layout.W_FRONT / 2) * layout.M_PER_PX
+ sy = -(d["side_uv"][..., 0] - layout.W_SIDE / 2) * layout.M_PER_PX
+ fz = layout.Z_CENTER + (layout.H / 2 - d["front_uv"][..., 1]) * layout.M_PER_PX
+ sz = layout.Z_CENTER + (layout.H / 2 - d["side_uv"][..., 1]) * layout.M_PER_PX
+ w1, w2 = front_height_weight * d["front_conf"].clip(1e-3), d["side_conf"].clip(1e-3)
+ return np.stack([fx, sy, (fz * w1 + sz * w2) / (w1 + w2)], -1)
+
+
+def root_from_triangulation(tri, conf, rig, names, info):
+ """Per-frame root rotation (as the basis of the root bone, axis-angle) from the points that ride rigidly on it
+ (its two ends and the heads of the bones hung straight off it), by weighted Kabsch against the rest pose;
+ smoothed over time."""
+ bones = info["bones"]
+ ride = {bones[0]["head_joint"], bones[0]["tail_joint"]} | {b["head_joint"] for b in bones if b["parent"] == 0}
+ body = sorted(names.index(n) for n in ride if n in names)
+ h = names.index(bones[0]["head_joint"])
+ rest = rig.rest_kp.cpu().numpy()
+ a = rest[body] - rest[h]
+ Brot = rig.B[0, :3, :3].cpu().numpy()
+ out = []
+ for t in range(len(tri)):
+ b = tri[t, body] - tri[t, h]
+ w = conf[t, body]
+ U, _, Vt = np.linalg.svd((a * w[:, None]).T @ b)
+ D = np.diag([1, 1, np.sign(np.linalg.det(Vt.T @ U.T))])
+ W = Vt.T @ D @ U.T
+ R = Brot.T @ W @ Brot
+ ang = np.arccos(np.clip((np.trace(R) - 1) / 2, -1, 1))
+ axis = np.array([R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]])
+ out.append(axis / max(np.linalg.norm(axis), 1e-8) * ang if ang > 1e-6 else np.zeros(3))
+ out = np.array(out)
+ k = np.ones(5) / 5
+ return np.stack([np.convolve(np.pad(out[:, i], 2, mode="edge"), k, mode="valid") for i in range(3)], 1)
+
+
+def euler_from_matrix(R):
+ """Inverse of euler_xyz for one 3x3 matrix (Blender XYZ: R = Rz Ry Rx)."""
+ b = -np.arcsin(np.clip(R[2, 0], -1, 1))
+ return np.array([np.arctan2(R[2, 1], R[2, 2]), b, np.arctan2(R[1, 0], R[0, 0])])
+
+
+def rot_between(a, b):
+ """Smallest rotation taking unit vector a to unit vector b."""
+ v, c = np.cross(a, b), float(np.dot(a, b))
+ if np.linalg.norm(v) < 1e-9:
+ return np.eye(3) if c > 0 else np.diag([1.0, -1.0, -1.0])
+ K = np.array([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]])
+ return np.eye(3) + K + K @ K / (1 + c)
+
+
+def ik_init(tri, root_aa, info, rig):
+ """Point every bone at its triangulated child joint, down the hierarchy, with no twist and inside its limits:
+ a starting pose close to the answer, so the fit does not have to find a sit or a rear from a standing pose."""
+ names = rig.kp_names
+ bones = info["bones"]
+ off = rig.off.cpu().numpy()
+ Brot = rig.B[0, :3, :3].cpu().numpy()
+ lo, hi = rig.lo.cpu().numpy(), rig.hi.cpu().numpy()
+ T, nb = len(tri), len(bones)
+ eul = np.zeros((T, nb, 3))
+ y = np.array([0.0, 1.0, 0.0])
+ for t in range(T):
+ aa = root_aa[t]
+ ang = np.linalg.norm(aa)
+ k = aa / ang if ang > 1e-9 else np.array([1.0, 0, 0])
+ K = np.array([[0, -k[2], k[1]], [k[2], 0, -k[0]], [-k[1], k[0], 0]])
+ W = [None] * nb
+ W[0] = Brot @ (np.eye(3) + np.sin(ang) * K + (1 - np.cos(ang)) * K @ K)
+ for i in range(1, nb):
+ p = bones[i]["parent"]
+ base = W[p] @ off[i][:3, :3]
+ if bones[i]["head_joint"] not in names or bones[i]["tail_joint"] not in names:
+ W[i] = base # e.g. fur bones, whose root is not a tracked joint: start at rest
+ continue
+ d = tri[t, names.index(bones[i]["tail_joint"])] - tri[t, names.index(bones[i]["head_joint"])]
+ if np.linalg.norm(d) < 1e-6:
+ W[i] = base
+ continue
+ R = rot_between(y, base.T @ (d / np.linalg.norm(d)))
+ e = np.clip(euler_from_matrix(R), lo[i], hi[i])
+ eul[t, i] = e
+ W[i] = base @ euler_xyz(torch.tensor(e)).numpy()
+ return eul
+
+
+def fit(d, info, iters=1500, dev="cpu", log=True, front_height_weight=0.25):
+ rig = Rig(info, dev)
+ names = rig.kp_names
+ T = len(d["front_uv"])
+ f_obs = torch.tensor(d["front_uv"], dtype=torch.float64, device=dev)
+ s_obs = torch.tensor(d["side_uv"], dtype=torch.float64, device=dev)
+ f_c = torch.tensor(d["front_conf"], dtype=torch.float64, device=dev).clamp(0, 1) ** 2
+ s_c = torch.tensor(d["side_conf"], dtype=torch.float64, device=dev).clamp(0, 1) ** 2
+ tri_np = triangulate(d, front_height_weight)
+ tri = torch.tensor(tri_np, dtype=torch.float64, device=dev)
+ hips = names.index(info["bones"][0]["head_joint"])
+ trans = (tri[:, hips] - rig.rest_kp[hips]).clone().requires_grad_(True)
+ conf = np.minimum(d["front_conf"], d["side_conf"]).clip(1e-3, 1)
+ root0 = root_from_triangulation(tri_np, conf, rig, names, info) + 1e-4
+ root = torch.tensor(root0, dtype=torch.float64, device=dev).requires_grad_(True)
+ nb = len(rig.names)
+ # Euler = lo + (hi - lo) * sigmoid(phi), starting from the analytic IK pose
+ e0 = torch.tensor(ik_init(tri_np, root0, info, rig), dtype=torch.float64, device=dev)
+ z = ((e0 - rig.lo) / (rig.hi - rig.lo)).clamp(1e-3, 1 - 1e-3)
+ phi = torch.logit(z).clone().requires_grad_(True)
+ paws = [names.index(n) for n in names if any(n.startswith(p) for p in ("fpaw", "ftoe", "hpaw", "htoe"))]
+ sigma = 6.0 # px, robust scale (annealed down from 40 px so far-off joints still pull early on)
+ # The side view sees legs swing and the hips clearly; the front view foreshortens leg lifts and hides the hips
+ # when the creature sits, and video models animate it less faithfully. So heights come mostly from the side
+ # view and the front view mainly supplies left-right position.
+ f_axis = torch.tensor([1.0, front_height_weight], dtype=torch.float64, device=dev)
+
+ def loss_fn(stage):
+ nonlocal sigma
+ eul = rig.lo + (rig.hi - rig.lo) * torch.sigmoid(phi)
+ J, _ = rig.forward(trans, axis_angle(root), eul)
+ pf, ps = project(J)
+ rf = ((pf - f_obs) ** 2 * f_axis).sum(-1)
+ rs = ((ps - s_obs) ** 2).sum(-1)
+ data = (f_c * torch.log1p(rf / sigma ** 2)).sum() + (s_c * torch.log1p(rs / sigma ** 2)).sum()
+ acc = ((J[2:] - 2 * J[1:-1] + J[:-2]) ** 2).sum() / layout.M_PER_PX ** 2 * 0.02
+ vel = ((eul[1:] - eul[:-1]) ** 2).sum() * 2.0 + ((root[1:] - root[:-1]) ** 2).sum() * 2.0
+ prior = (eul ** 2).sum() * 0.05
+ ground = (torch.relu(-J[:, paws, 2]) ** 2).sum() / layout.M_PER_PX ** 2 * 0.5
+ total = data + acc + vel + prior + ground
+ return total, {"data": data.item(), "acc": acc.item(), "vel": vel.item(), "prior": prior.item(), "ground": ground.item()}, J, pf, ps, eul
+
+ opt = torch.optim.Adam([{"params": [trans], "lr": 0.01}, {"params": [root], "lr": 0.03}, {"params": [phi], "lr": 0.05}])
+ for it in range(iters):
+ sigma = 6.0 + 34.0 * max(0.0, 1 - it / (0.6 * iters))
+ if it == int(iters * 0.7):
+ for g in opt.param_groups:
+ g["lr"] *= 0.3
+ total, parts, J, pf, ps, eul = loss_fn(it)
+ opt.zero_grad()
+ total.backward()
+ opt.step()
+ if log and it % 250 == 0:
+ print(f" iter {it} loss {total.item():.1f}", {k: round(v, 1) for k, v in parts.items()}, flush=True)
+ sigma = 6.0
+ with torch.no_grad():
+ total, parts, J, pf, ps, eul = loss_fn(iters)
+ err_f = (pf - f_obs).norm(dim=-1)
+ err_fx = (pf - f_obs)[..., 0].abs()
+ err_s = (ps - s_obs).norm(dim=-1)
+ return {"trans": trans.detach().cpu().numpy(), "root_rotmat": axis_angle(root).detach().cpu().numpy(),
+ "euler": eul.detach().cpu().numpy(), "joints": J.cpu().numpy(),
+ "reproj_px": {"front": float(err_f.mean()), "front_x_only": float(err_fx.mean()), "side": float(err_s.mean())},
+ "bones": rig.names, "joint_names": names}
+
+
+def to_quat(Rm):
+ q = []
+ for R in Rm:
+ w = np.sqrt(max(0, 1 + R[0, 0] + R[1, 1] + R[2, 2])) / 2
+ x = np.copysign(np.sqrt(max(0, 1 + R[0, 0] - R[1, 1] - R[2, 2])) / 2, R[2, 1] - R[1, 2])
+ y = np.copysign(np.sqrt(max(0, 1 - R[0, 0] + R[1, 1] - R[2, 2])) / 2, R[0, 2] - R[2, 0])
+ z = np.copysign(np.sqrt(max(0, 1 - R[0, 0] - R[1, 1] + R[2, 2])) / 2, R[1, 0] - R[0, 1])
+ q.append([w, x, y, z])
+ return np.array(q)
+
+
+def main():
+ det_path, info_path, out = sys.argv[1:4]
+ raw = np.load(det_path)
+ d = {k: raw[k].copy() for k in ("front_uv", "side_uv", "front_conf", "side_conf")}
+ info = json.load(open(info_path))
+ names = [k["name"] for k in info["keypoints"]]
+ before = sync_report(d)
+ paws = paw_agreement(d, names)
+ print("paw height agreement between views:", {k: (None if v is None else round(v, 2)) for k, v in paws.items()})
+ print(f"sync as generated: mean height gap {before['mean_height_gap_px']:.1f} px, worst {before['worst_frame_gap_px']:.1f} px, "
+ f"best constant lag {before['best_lag_frames']} frames")
+ shift = None
+ if "--no-align" not in sys.argv:
+ trial = {k: v.copy() for k, v in d.items()}
+ s = align_views(trial, names)
+ gain = 1 - sync_report(trial)["mean_height_gap_px"] / max(before["mean_height_gap_px"], 1e-6)
+ if gain > 0.15: # only re-time when the halves really were out of step
+ d.update(trial)
+ shift = s
+ print(f"time-aligned the front view onto the side view: mean shift {np.abs(shift).mean():.1f} frames, "
+ f"largest {np.abs(shift).max():.1f} frames (height gap down {gain:.0%})")
+ else:
+ print(f"views already in step (re-timing would only cut the height gap by {gain:.0%}); left as generated")
+ # painted legs make the reader's left/right labels trustworthy, so swaps are only fixed on request
+ swapped = fix_swaps(d, names) if "--fix-swaps" in sys.argv else {}
+ sync = sync_report(d)
+ print("side-view leg swaps fixed (frames):", swapped)
+ print(f"sync after: mean height gap {sync['mean_height_gap_px']:.1f} px, worst {sync['worst_frame_gap_px']:.1f} px")
+ sync["before"] = {k: v for k, v in before.items() if k != "per_frame_gap_px"}
+ sync["paw_agreement"] = paws
+ sync["front_shift_frames"] = None if shift is None else shift.round(2).tolist()
+ res = fit(d, info, dev="cuda" if torch.cuda.is_available() else "cpu")
+ print("reprojection error px:", {k: round(v, 2) for k, v in res["reproj_px"].items()})
+ motion = {"fps": float(raw["fps"]), "bones": res["bones"], "trans": res["trans"].round(5).tolist(),
+ "root_quat": to_quat(res["root_rotmat"]).round(6).tolist(), "euler": res["euler"].round(5).tolist(),
+ "joints": res["joints"].round(4).tolist(), "joint_names": res["joint_names"],
+ "reproj_px": res["reproj_px"], "sync": sync, "swaps": swapped}
+ json.dump(motion, open(out, "w"))
+ print("saved", out)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/mocap/train.py b/mocap/train.py
new file mode 100644
index 0000000..d445d27
--- /dev/null
+++ b/mocap/train.py
@@ -0,0 +1,168 @@
+"""Teach the joint reader one creature, from the rendered dataset.
+
+python -m mocap.train DATASET_DIR rig_info.json OUT.pt [epochs] [batch]
+Every sample gives two training images (front and side). The renders are transparent, so each one is laid on a
+fresh random backdrop, then jittered in framing, colour, sharpness and compression, the ways a video model's frames
+differ from a clean render. Holds out 4% of samples and reports their mean joint error in layout pixels.
+"""
+import json, math, pathlib, sys, time
+
+import cv2
+import numpy as np
+import torch
+import torch.nn.functional as F
+from torch.utils.data import DataLoader, Dataset
+
+from mocap import layout
+from mocap.model import HM, SIZE, JointReader, decode, square
+
+
+def backdrop(h, w, ground, rng):
+ g = rng.uniform(95, 175)
+ tint = rng.uniform(-6, 6, 3)
+ img = np.empty((h, w, 3), np.float32)
+ img[:] = g + tint
+ img += np.linspace(-1, 1, h)[:, None, None] * rng.uniform(-10, 10)
+ img[ground:] += rng.uniform(5, 35) * (1 if rng.random() < 0.85 else -1)
+ return img
+
+
+def photometric(img, rng):
+ img = img.astype(np.float32)
+ if rng.random() < 0.8: # brightness, contrast, saturation, hue
+ img = img * rng.uniform(0.75, 1.25) + rng.uniform(-20, 20)
+ m = img.mean()
+ img = (img - m) * rng.uniform(0.75, 1.25) + m
+ hsv = cv2.cvtColor(img.clip(0, 255).astype(np.uint8), cv2.COLOR_RGB2HSV).astype(np.float32)
+ hsv[..., 0] = (hsv[..., 0] + rng.uniform(-5, 5)) % 180
+ hsv[..., 1] *= rng.uniform(0.7, 1.3)
+ img = cv2.cvtColor(hsv.clip(0, 255).astype(np.uint8), cv2.COLOR_HSV2RGB).astype(np.float32)
+ if rng.random() < 0.3:
+ img = cv2.GaussianBlur(img, (0, 0), rng.uniform(0.3, 1.5))
+ if rng.random() < 0.3:
+ f = rng.uniform(0.4, 0.8)
+ small = cv2.resize(img, None, fx=f, fy=f, interpolation=cv2.INTER_AREA)
+ img = cv2.resize(small, (img.shape[1], img.shape[0]), interpolation=cv2.INTER_LINEAR)
+ if rng.random() < 0.2:
+ img = img + rng.normal(0, rng.uniform(2, 8), img.shape)
+ img = img.clip(0, 255).astype(np.uint8)
+ if rng.random() < 0.5:
+ ok, buf = cv2.imencode(".jpg", img[..., ::-1], [cv2.IMWRITE_JPEG_QUALITY, int(rng.integers(35, 90))])
+ img = cv2.imdecode(buf, cv2.IMREAD_COLOR)[..., ::-1]
+ return img
+
+
+class Views(Dataset):
+ def __init__(self, metas, train):
+ self.metas, self.train = metas, train
+
+ def __len__(self):
+ return 2 * len(self.metas)
+
+ def __getitem__(self, i):
+ rng = np.random.default_rng() if self.train else np.random.default_rng(i)
+ m = self.metas[i // 2]
+ view = ("front", "side")[i % 2]
+ meta = json.loads(m.read_text())
+ s = meta["scale"]
+ rgba = cv2.imread(str(m).replace("_meta.json", f"_{view}.png"), cv2.IMREAD_UNCHANGED)[..., [2, 1, 0, 3]].astype(np.float32)
+ h, w = rgba.shape[:2]
+ kp = np.array(meta[f"{view}_uv"], np.float32) * s
+ if self.train:
+ bg = backdrop(h, w, round(layout.GROUND_V * s), rng)
+ else:
+ bg = np.empty((h, w, 3), np.float32); bg[:] = layout.BG; bg[round(layout.GROUND_V * s):] = layout.FLOOR
+ a = rgba[..., 3:] / 255
+ img = rgba[..., :3] * a + bg * (1 - a)
+ if self.train and rng.random() < 0.7: # the divider at the shared edge
+ img[:, -2:] = 34 if view == "front" else img[:, -2:]
+ img[:, :2] = 34 if view == "side" else img[:, :2]
+ _, ox, oy, side = square(img, bg[0, 0])
+ k = SIZE / side
+ A = np.array([[k, 0, ox * k], [0, k, oy * k]], np.float32)
+ if self.train: # framing jitter: scale, small rotation, shift
+ sc, rot = rng.uniform(0.85, 1.15), math.radians(rng.uniform(-4, 4))
+ c = SIZE / 2
+ R = cv2.getRotationMatrix2D((c, c), math.degrees(rot), sc)
+ R[:, 2] += rng.uniform(-0.05, 0.05, 2) * SIZE
+ A = R @ np.vstack([A, [0, 0, 1]])
+ out = cv2.warpAffine(img, A.astype(np.float32), (SIZE, SIZE), flags=cv2.INTER_AREA if k < 1 else cv2.INTER_LINEAR,
+ borderMode=cv2.BORDER_CONSTANT, borderValue=tuple(float(x) for x in bg[0, 0]))
+ kp = kp @ A[:, :2].T + A[:, 2]
+ if self.train:
+ out = photometric(out, rng)
+ x = torch.from_numpy(np.ascontiguousarray(out)).permute(2, 0, 1).float() / 255
+ return x, torch.from_numpy(kp.astype(np.float32)), torch.tensor([ox, oy, side, s], dtype=torch.float32)
+
+
+def heatmaps(kp, sigma=2.0):
+ """Gaussian targets at HM resolution for keypoints given in SIZE pixels."""
+ b, j, _ = kp.shape
+ g = (kp * HM / SIZE).view(b, j, 1, 1, 2)
+ ys, xs = torch.meshgrid(torch.arange(HM, device=kp.device), torch.arange(HM, device=kp.device), indexing="ij")
+ d2 = (xs - g[..., 0]) ** 2 + (ys - g[..., 1]) ** 2
+ return torch.exp(-d2 / (2 * sigma ** 2))
+
+
+def main():
+ data, info_path, out = sys.argv[1:4]
+ epochs = int(sys.argv[4]) if len(sys.argv) > 4 else 12
+ bs = int(sys.argv[5]) if len(sys.argv) > 5 else 24
+ info = json.load(open(info_path))
+ names = [k["name"] for k in info["keypoints"]]
+ def split():
+ metas = sorted(pathlib.Path(data).glob("*_meta.json"))
+ val = [m for m in metas if int(m.name[:5]) % 25 == 0]
+ return [m for m in metas if int(m.name[:5]) % 25 != 0], val
+
+ train, val = split()
+ print(f"{len(train)} train / {len(val)} val samples so far, {len(names)} joints", flush=True)
+ vl = DataLoader(Views(val, False), batch_size=bs, num_workers=4)
+ dev = "cuda"
+ model = JointReader(len(names)).to(dev)
+ head = [p for n, p in model.named_parameters() if not n.startswith("backbone")]
+ opt = torch.optim.AdamW([{"params": model.backbone.parameters(), "lr": 2e-5},
+ {"params": head, "lr": 1e-3}], weight_decay=0.05)
+ base = [g["lr"] for g in opt.param_groups]
+ step, t0, warm = 0, time.time(), 300
+ for ep in range(epochs):
+ train, _ = split()
+ dl = DataLoader(Views(train, True), batch_size=bs, shuffle=True, num_workers=10, drop_last=True)
+ print(f"epoch {ep}: {len(train)} train samples", flush=True)
+ model.train()
+ for bi_, (x, kp, _) in enumerate(dl):
+ f = 0.5 * (1 + math.cos(math.pi * (ep + bi_ / len(dl)) / epochs)) * min(1, (step + 1) / warm)
+ for g, b0 in zip(opt.param_groups, base):
+ g["lr"] = b0 * f
+ x, kp = x.to(dev, non_blocking=True), kp.to(dev, non_blocking=True)
+ with torch.autocast("cuda", dtype=torch.bfloat16):
+ pred = model(x)
+ loss = F.mse_loss(pred.float(), heatmaps(kp)) * 1000
+ opt.zero_grad(set_to_none=True)
+ loss.backward()
+ torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)
+ opt.step()
+ step += 1
+ if step % 50 == 0:
+ print(f"ep {ep} step {step} loss {loss.item():.4f} lr {f:.3f} {time.time() - t0:.0f}s", flush=True)
+ model.eval()
+ errs = {"front": [], "side": []}
+ with torch.no_grad():
+ for bi, (x, kp, geo) in enumerate(vl):
+ with torch.autocast("cuda", dtype=torch.bfloat16):
+ pred = model(x.to(dev)).float()
+ uv, _ = decode(pred)
+ uv = uv.cpu() * SIZE / HM
+ # back to layout pixels: undo resize, padding and the render scale
+ lay = lambda p: (p * geo[:, None, 2:3] / SIZE - geo[:, None, :2]) / geo[:, None, 3:4]
+ e = (lay(uv) - lay(kp)).norm(dim=-1)
+ for r in range(len(x)):
+ errs[("front", "side")[(bi * bs + r) % 2]].append(e[r].numpy())
+ msg = {v: float(np.mean(errs[v])) for v in errs}
+ print(f"epoch {ep} val mean px error (layout pixels) front {msg['front']:.2f} side {msg['side']:.2f}", flush=True)
+ torch.save({"state_dict": model.state_dict(), "names": names, "epoch": ep, "val": msg}, out)
+ print("saved", out)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/prompts/demon/flap.txt b/prompts/demon/flap.txt
new file mode 100644
index 0000000..4bac651
--- /dev/null
+++ b/prompts/demon/flap.txt
@@ -0,0 +1 @@
+Animate the exact fire demon game model shown twice in this split-screen image. Left: a front camera, the demon faces the viewer. Right: a side camera on its right side, the demon faces right. Both are locked-off cameras filming the same demon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a towering fire demon of charred black obsidian rock with glowing orange lava cracks, curved horns, a long tail. Its limbs are colour-coded and the colours never change or swap: left arm pink, right arm blue, left leg yellow, right leg cyan, left wing orange, right wing green. Exactly two arms, two legs, two wings, one tail, one head. No flames, no smoke, no weapon. Action: the demon beats its wings powerfully, lifts off the ground and hovers, then lands back on both feet. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/demon/roar.txt b/prompts/demon/roar.txt
new file mode 100644
index 0000000..1618ca5
--- /dev/null
+++ b/prompts/demon/roar.txt
@@ -0,0 +1 @@
+Animate the exact fire demon game model shown twice in this split-screen image. Left: a front camera, the demon faces the viewer. Right: a side camera on its right side, the demon faces right. Both are locked-off cameras filming the same demon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a towering fire demon of charred black obsidian rock with glowing orange lava cracks, curved horns, a long tail. Its limbs are colour-coded and the colours never change or swap: left arm pink, right arm blue, left leg yellow, right leg cyan, left wing orange, right wing green. Exactly two arms, two legs, two wings, one tail, one head. No flames, no smoke, no weapon. Action: the demon spreads its wings wide, throws its arms out and roars, then folds its wings halfway and lowers its arms. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/demon/slam.txt b/prompts/demon/slam.txt
new file mode 100644
index 0000000..0aaa4b8
--- /dev/null
+++ b/prompts/demon/slam.txt
@@ -0,0 +1 @@
+Animate the exact fire demon game model shown twice in this split-screen image. Left: a front camera, the demon faces the viewer. Right: a side camera on its right side, the demon faces right. Both are locked-off cameras filming the same demon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a towering fire demon of charred black obsidian rock with glowing orange lava cracks, curved horns, a long tail. Its limbs are colour-coded and the colours never change or swap: left arm pink, right arm blue, left leg yellow, right leg cyan, left wing orange, right wing green. Exactly two arms, two legs, two wings, one tail, one head. No flames, no smoke, no weapon. Action: the demon raises both fists high over its head and smashes them down onto the ground in front of it, then straightens up. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/dragon/flap.txt b/prompts/dragon/flap.txt
new file mode 100644
index 0000000..5f1887c
--- /dev/null
+++ b/prompts/dragon/flap.txt
@@ -0,0 +1 @@
+Animate the exact dragon game model shown twice in this split-screen image. Left: a front camera, the dragon faces the viewer. Right: a side camera on its right flank, the dragon faces right. Both are locked-off cameras filming the same dragon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a dark charcoal dragon with bone-coloured horns and claws. Its limbs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan, left wing orange, right wing green. Exactly four legs, two wings, one tail, one head. Action: the dragon beats its wings powerfully, lifts a little off the ground and hovers, then lands back on all four legs. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/dragon/roar.txt b/prompts/dragon/roar.txt
new file mode 100644
index 0000000..790ed34
--- /dev/null
+++ b/prompts/dragon/roar.txt
@@ -0,0 +1 @@
+Animate the exact dragon game model shown twice in this split-screen image. Left: a front camera, the dragon faces the viewer. Right: a side camera on its right flank, the dragon faces right. Both are locked-off cameras filming the same dragon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a dark charcoal dragon with bone-coloured horns and claws. Its limbs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan, left wing orange, right wing green. Exactly four legs, two wings, one tail, one head. Action: the dragon rears up on its hind legs, spreads its wings wide and roars, then drops back onto all four legs. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/dragon/swipe.txt b/prompts/dragon/swipe.txt
new file mode 100644
index 0000000..88014a3
--- /dev/null
+++ b/prompts/dragon/swipe.txt
@@ -0,0 +1 @@
+Animate the exact dragon game model shown twice in this split-screen image. Left: a front camera, the dragon faces the viewer. Right: a side camera on its right flank, the dragon faces right. Both are locked-off cameras filming the same dragon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a dark charcoal dragon with bone-coloured horns and claws. Its limbs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan, left wing orange, right wing green. Exactly four legs, two wings, one tail, one head. Action: the dragon crouches, whips its tail around in a powerful swipe and snaps its jaws forward. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/dragon/walk.txt b/prompts/dragon/walk.txt
new file mode 100644
index 0000000..0b8be0e
--- /dev/null
+++ b/prompts/dragon/walk.txt
@@ -0,0 +1 @@
+Animate the exact dragon game model shown twice in this split-screen image. Left: a front camera, the dragon faces the viewer. Right: a side camera on its right flank, the dragon faces right. Both are locked-off cameras filming the same dragon at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a dark charcoal dragon with bone-coloured horns and claws. Its limbs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan, left wing orange, right wing green. Exactly four legs, two wings, one tail, one head. Action: the dragon walks on the spot like a video-game walk loop, wings half-folded, tail swaying. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/spider/bite.txt b/prompts/spider/bite.txt
new file mode 100644
index 0000000..fe2f6c9
--- /dev/null
+++ b/prompts/spider/bite.txt
@@ -0,0 +1 @@
+Animate the exact giant spider game model shown twice in this split-screen image. Left: a front camera, the spider faces the viewer. Right: a side camera on its right side, the spider faces right. Both are locked-off cameras filming the same spider at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a black armoured giant spider with bone-coloured markings. Its legs are colour-coded and the colours never change or swap: first left leg pink, first right leg blue; second left leg yellow, second right leg cyan; third left leg orange, third right leg green; fourth left leg purple, fourth right leg red. Exactly eight legs, two fangs, one body, one round abdomen. Action: the spider lunges forward and strikes with its fangs, pulls back and strikes again. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/spider/pounce.txt b/prompts/spider/pounce.txt
new file mode 100644
index 0000000..27a11d0
--- /dev/null
+++ b/prompts/spider/pounce.txt
@@ -0,0 +1 @@
+Animate the exact giant spider game model shown twice in this split-screen image. Left: a front camera, the spider faces the viewer. Right: a side camera on its right side, the spider faces right. Both are locked-off cameras filming the same spider at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a black armoured giant spider with bone-coloured markings. Its legs are colour-coded and the colours never change or swap: first left leg pink, first right leg blue; second left leg yellow, second right leg cyan; third left leg orange, third right leg green; fourth left leg purple, fourth right leg red. Exactly eight legs, two fangs, one body, one round abdomen. Action: the spider crouches low, then pounces up and lands on the same spot, legs splaying out. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/spider/rear.txt b/prompts/spider/rear.txt
new file mode 100644
index 0000000..f45fed6
--- /dev/null
+++ b/prompts/spider/rear.txt
@@ -0,0 +1 @@
+Animate the exact giant spider game model shown twice in this split-screen image. Left: a front camera, the spider faces the viewer. Right: a side camera on its right side, the spider faces right. Both are locked-off cameras filming the same spider at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a black armoured giant spider with bone-coloured markings. Its legs are colour-coded and the colours never change or swap: first left leg pink, first right leg blue; second left leg yellow, second right leg cyan; third left leg orange, third right leg green; fourth left leg purple, fourth right leg red. Exactly eight legs, two fangs, one body, one round abdomen. Action: the spider rears up on its back legs, raises its two front legs high and threatens, then drops back down. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/spider/walk.txt b/prompts/spider/walk.txt
new file mode 100644
index 0000000..a6ebffd
--- /dev/null
+++ b/prompts/spider/walk.txt
@@ -0,0 +1 @@
+Animate the exact giant spider game model shown twice in this split-screen image. Left: a front camera, the spider faces the viewer. Right: a side camera on its right side, the spider faces right. Both are locked-off cameras filming the same spider at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: a black armoured giant spider with bone-coloured markings. Its legs are colour-coded and the colours never change or swap: first left leg pink, first right leg blue; second left leg yellow, second right leg cyan; third left leg orange, third right leg green; fourth left leg purple, fourth right leg red. Exactly eight legs, two fangs, one body, one round abdomen. Action: the spider scuttles on the spot like a video-game walk loop, its eight legs stepping in a wave. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/heldout/dig.txt b/prompts/wolf/heldout/dig.txt
new file mode 100644
index 0000000..916e5a9
--- /dev/null
+++ b/prompts/wolf/heldout/dig.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf digs at the ground with its front paws, alternating left and right, head low. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/heldout/gallop.txt b/prompts/wolf/heldout/gallop.txt
new file mode 100644
index 0000000..7e411ad
--- /dev/null
+++ b/prompts/wolf/heldout/gallop.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf gallops on the spot like a video-game run loop, legs reaching far forward and gathering under its body. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/heldout/pounce.txt b/prompts/wolf/heldout/pounce.txt
new file mode 100644
index 0000000..6c5d854
--- /dev/null
+++ b/prompts/wolf/heldout/pounce.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf crouches low, wiggles its rear, then pounces forward and down onto something on the ground. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/heldout/shake.txt b/prompts/wolf/heldout/shake.txt
new file mode 100644
index 0000000..d887ae8
--- /dev/null
+++ b/prompts/wolf/heldout/shake.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf shakes its whole body hard as if drying off water, head to tail, then stands still. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/howl.txt b/prompts/wolf/howl.txt
new file mode 100644
index 0000000..bf379fa
--- /dev/null
+++ b/prompts/wolf/howl.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf sits down on its haunches, lifts its head high and howls at the sky, then stands back up on all four legs. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/rear.txt b/prompts/wolf/rear.txt
new file mode 100644
index 0000000..81e4e48
--- /dev/null
+++ b/prompts/wolf/rear.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf snarls, rears up on its hind legs, strikes down with both front paws as if pinning prey, lands on all four legs and snaps its jaws forward. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/bark.txt b/prompts/wolf/train/bark.txt
new file mode 100644
index 0000000..c1839d3
--- /dev/null
+++ b/prompts/wolf/train/bark.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf barks three times, its head and chest lunging forward with each bark, front paws planted. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/bite.txt b/prompts/wolf/train/bite.txt
new file mode 100644
index 0000000..a005de0
--- /dev/null
+++ b/prompts/wolf/train/bite.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf lunges forward and snaps its jaws, pulls back, and lunges and snaps again. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/death.txt b/prompts/wolf/train/death.txt
new file mode 100644
index 0000000..68d36df
--- /dev/null
+++ b/prompts/wolf/train/death.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf staggers, its legs buckle and it collapses onto its side, then lies still. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/growl.txt b/prompts/wolf/train/growl.txt
new file mode 100644
index 0000000..5d0f890
--- /dev/null
+++ b/prompts/wolf/train/growl.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf lowers its head and growls with its hackles raised, stepping slowly backward and then forward again. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/jump.txt b/prompts/wolf/train/jump.txt
new file mode 100644
index 0000000..1d15829
--- /dev/null
+++ b/prompts/wolf/train/jump.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf crouches and jumps straight up, lands softly on all four paws and settles. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/lie_down.txt b/prompts/wolf/train/lie_down.txt
new file mode 100644
index 0000000..43d789c
--- /dev/null
+++ b/prompts/wolf/train/lie_down.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf lowers itself and lies down on its belly with its front legs stretched forward, then rests its head on its paws. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/limp.txt b/prompts/wolf/train/limp.txt
new file mode 100644
index 0000000..e05a5cc
--- /dev/null
+++ b/prompts/wolf/train/limp.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf walks on the spot with a limp, keeping its front-left pink leg lifted off the ground. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/look_around.txt b/prompts/wolf/train/look_around.txt
new file mode 100644
index 0000000..a335cd4
--- /dev/null
+++ b/prompts/wolf/train/look_around.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf stands still and turns its head to the left, then to the right, then looks up, ears alert. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/play_bow.txt b/prompts/wolf/train/play_bow.txt
new file mode 100644
index 0000000..378590d
--- /dev/null
+++ b/prompts/wolf/train/play_bow.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf drops into a playful bow, front legs low and stretched forward with its rear up and tail wagging, then springs back up. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/scratch.txt b/prompts/wolf/train/scratch.txt
new file mode 100644
index 0000000..a936ca3
--- /dev/null
+++ b/prompts/wolf/train/scratch.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf sits down and scratches behind its ear with a hind leg, then stands back up. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/sniff.txt b/prompts/wolf/train/sniff.txt
new file mode 100644
index 0000000..52cbf70
--- /dev/null
+++ b/prompts/wolf/train/sniff.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf lowers its head to sniff the ground, shuffles its paws while sniffing, then lifts its head and looks ahead. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/stretch.txt b/prompts/wolf/train/stretch.txt
new file mode 100644
index 0000000..81559ce
--- /dev/null
+++ b/prompts/wolf/train/stretch.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf stretches: front legs forward with its chest low, then shifts forward and stretches each hind leg back in turn. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/tail_wag.txt b/prompts/wolf/train/tail_wag.txt
new file mode 100644
index 0000000..9a32651
--- /dev/null
+++ b/prompts/wolf/train/tail_wag.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf wags its tail fast and happily, shifting its weight between its front paws. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/train/walk.txt b/prompts/wolf/train/walk.txt
new file mode 100644
index 0000000..a6246c9
--- /dev/null
+++ b/prompts/wolf/train/walk.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf walks on the spot at a relaxed pace like a video-game walk loop, legs stepping one after another, head bobbing gently. It stays on the same spot, centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/prompts/wolf/trot.txt b/prompts/wolf/trot.txt
new file mode 100644
index 0000000..071d712
--- /dev/null
+++ b/prompts/wolf/trot.txt
@@ -0,0 +1 @@
+Animate the exact grey wolf game model shown twice in this split-screen image. Left: a front camera, the wolf faces the viewer. Right: a side camera on its right flank, the wolf faces right. Both are locked-off cameras filming the same wolf at the same moment, so every movement happens in both views at exactly the same time, frame for frame. Keep the model exactly as it is: grey fur, cream chest and muzzle, dark paws. Its legs are colour-coded and the colours never change or swap: front-left leg pink, front-right leg blue, hind-left leg yellow, hind-right leg cyan. Exactly four legs, one tail, one head. Action: the wolf trots on the spot like a video-game running loop: a natural trot (diagonal legs move together), paws lifting and landing under its body, body bobbing slightly, tail swaying, but it does not travel forward and stays centred in both views. One continuous 5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio background, the floor band and the dark vertical divider stay fixed.
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..7bf922e
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,9 @@
+# Python 3.11. Versions this was built and tested with (October 2026).
+# torch with CUDA comes from PyTorch's index: pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cu128
+torch==2.11.0
+transformers==5.20.2 # DINOv2 backbone (facebook/dinov2-with-registers-base, downloaded on first use)
+numpy==2.4.6
+opencv-python-headless==5.0.0.93
+pillow==12.3.0
+requests==2.34.2 # fal.ai queue client
+matplotlib==3.11.2 # tools/plot_heights.py only
diff --git a/skills/diptych-capture/SKILL.md b/skills/diptych-capture/SKILL.md
new file mode 100644
index 0000000..c304580
--- /dev/null
+++ b/skills/diptych-capture/SKILL.md
@@ -0,0 +1,82 @@
+---
+name: diptych-capture
+description: Turn a two-camera AI clip into a game-ready animation with diptych - read every joint with the creature's trained reader, check that the two views agree, fit the rig in both views at once, and export a GLB with renders and a side-by-side comparison. Covers the quality gates (paw agreement, reprojection error), what to do when a fit fails, and three-quarter showcase renders. Use when someone has a diptych clip to capture, asks whether a capture is good, wants the GLB or renders of a move, or a fit looks wrong.
+license: Apache-2.0
+compatibility: NVIDIA GPU for reading (a few GB), CPU or GPU for the fit, Blender 5.x for the GLB and renders, Python 3.11 venv from requirements.txt. Needs runs/<c>/reader.pt (diptych-reader) and runs/<c>/ref/ref.png (diptych-rig).
+---
+
+# diptych-capture: clip in, animation out
+
+```bash
+tools/capture.sh <c> runs/<c>/videos/roar/s1/h3max.mp4 roar
+```
+
+Writes `runs/<c>/clips/roar/`: `det.npz` (every joint in both views, every frame), `overlay.mp4` (the joints drawn on
+the clip), `motion.json` (the fit: root path and rotation, Euler angles per bone, joints in metres),
+`render/animation.glb` (the rig with the animation, for any engine), `render/persp` and `render/side` frames, and
+`showcase.mp4` (the AI clip with joints, the rig in 3/4, and clip vs rig through the same side camera).
+
+## What happens
+
+1. **Read.** The clip is aligned to the reference frame (video models resize or crop the canvas: an affine fit by
+ ECC; "ECC did not converge" means a plain stretch was used, so check the overlay), split into its two views, and
+ the reader finds every joint in each (about 10 s for 5 s of video).
+2. **Check the views agree.** A joint has the same height in both halves. Per foot (creature.json `"feet"`), the
+ correlation of its height between the views over the clip is the paw agreement. If the halves run out of step in
+ time, the front view is time-warped onto the side view (only when that cuts the height gap by 15% or more).
+3. **Fit.** Blender's forward kinematics in torch, Euler angles bounded by the joint limits, fitted to both views at
+ once. Heights come mostly from the side view (the front view foreshortens leg lifts), left-right from the front
+ view. It starts from an analytic IK pose aimed at the triangulated joints and anneals a robust loss from 40 px to
+ 6 px, so big poses (sit, rear, slam) are found. Under a minute for 5 s (20 s for the dragon's roar on a CPU).
+4. **Export.** Blender keys the rig, writes the GLB and renders the views.
+
+## Is it good? Read the solve output
+
+The dragon's roar, for example:
+
+```
+paw height agreement between views: {'fpaw_L': 1.0, 'fpaw_R': 1.0, 'hpaw_L': 0.78, 'hpaw_R': None, 'score': 0.93}
+sync as generated: mean height gap 4.4 px, worst 8.6 px, best constant lag 0 frames
+reprojection error px: {'front': 5.92, 'front_x_only': 2.55, 'side': 7.99}
+```
+
+- **Paw agreement score:** 0.8 or more, the views tell one story: keep it. 0.5-0.8: look at `showcase.mp4`, often one
+ limb is off. Under 0.5: the video model animated the views differently; reroll the clip (diptych-film). `None` for
+ a foot means it barely moved (planted feet in a roar); judge that clip by the reprojection error instead.
+- **Reprojection error** (layout pixels, how far the fitted rig's joints land from the readings): front_x_only of 1-3
+ px and side of 2-8 px were typical on good clips. Scale by the creature's size in the frame.
+- Results so far: dragon take-off 1.00, roar 0.93, swipe 0.85, walk 0.81; spider rear-up 0.99, bite 0.96, pounce
+ 0.89, walk 0.36-0.49 (fails); demon wing beat 0.99, slam 0.84, roar 0.73 with feet planted and 3 px reprojection;
+ wolf trot 0.94 with H3 Max.
+
+## When a fit is wrong
+
+- Legs crossed or a limb flipped side to side in the side view: the painted colours make labels reliable, so swap
+ fixing is off. `python -m mocap.solve ... --fix-swaps` swaps near/far legs where heights say the reader mixed them
+ up; it "fixed" correct labels on one clip, so only use it after looking. (Leg names are the wolf's; other
+ creatures need `LEGS` in `mocap/solve.py` extended.)
+- The fit stays standing while the clip sits or rears: check `overlay.mp4`; if the readings are right, the limits in
+ rig.json are too tight for the pose.
+- Feet slide or sink: the solver's ground term knows paw names starting `fpaw`, `ftoe`, `hpaw`, `htoe` (wolf,
+ dragon); other creatures get no ground penalty yet.
+- Run `--no-align` to skip the time warp when the views were already in step and it hurt.
+
+Debug views: `python tools/fit_check.py VIDEO runs/<c>/clips/<name> out.jpg 10 40 80` (readings as rings, fitted
+joints as dots, per frame) and `python tools/plot_heights.py runs/<c>/clips/<name>/det.npz out.png` (joint heights
+per view over time: lags and swaps show up as curves that don't overlap). Both need `MOCAP_CREATURE` set.
+
+## Showcase renders (3/4 view on a shadow-catcher floor)
+
+```bash
+MOCAP_CREATURE=assets/<c> blender -b -P blender/apply_motion.py -- assets/<c>/rigged/rigged.blend \
+ assets/<c>/rigged/rig_info.json runs/<c>/clips/roar/motion.json runs/<c>/clips/roar/tile \
+ --views persp --samples 16 --res 1152x648 --cam -5.4,-6.0,1.4 --target 0,-0.3,1.5 --lens 32
+```
+
+`tools/capture.sh` uses creature.json `"camera"` for its 3/4 renders. Options take a space, never `=`. Frame the
+creature to its whole clip, not its rest pose: read the joint heights
+from the render's `joints.json` (the demon flew to 5.3 m), then check every frame's alpha bounding box. Cameras that
+worked: dragon `--cam -5.4,-6.0,1.4 --target 0,-0.3,1.5`, spider `-3.3,-3.65,1.3 / 0,-0.1,0.78`, demon
+`-6.4,-7.1,1.8 / 0,-0.1,2.1` (flying: `-7.4,-8.3,2.1 / 0,-0.1,2.6`). The shadow catcher leaves a faint denoiser haze
+in the alpha; when compositing, drop alpha under 10/255. `--springs assets/wolf/fur.json` adds damped spring fur on
+the wolf (bones from `blender/add_fur_bones.py`).
diff --git a/skills/diptych-film/SKILL.md b/skills/diptych-film/SKILL.md
new file mode 100644
index 0000000..52c7dae
--- /dev/null
+++ b/skills/diptych-film/SKILL.md
@@ -0,0 +1,59 @@
+---
+name: diptych-film
+description: Make the two-camera AI clip for a diptych creature - write the move's prompt from creature.json, send the reference frame to MiniMax H3 Max (or H3, Seedance, FLUX 3 Max) on fal, and check the clip kept the split screen, the limb colours and both views in step before capture. Use when someone wants a new move for a rigged diptych creature, when clips come back with swapped colours, a moving camera or a broken split screen, or when choosing a video model for two-camera clips.
+license: Apache-2.0
+compatibility: Needs a fal.ai key (FAL_KEY in .env or the environment) and a creature already set up with diptych-rig (runs/<c>/ref/ref.png).
+---
+
+# diptych-film: one move, two cameras, one clip
+
+The video model gets one image, `runs/<c>/ref/ref.png` (front view left, side view right, limbs painted), and a prompt
+that pins everything except the action. Both views come from one generation, which is what keeps them in step.
+
+## 1. Write the prompt
+
+```bash
+.venv/bin/python tools/make_prompt.py assets/<c> "the dragon rears up on its hind legs, spreads its wings wide and roars, then drops back onto all four legs." prompts/<c>/roar.txt
+```
+
+The template says: animate the exact model shown twice, front camera left and side camera right, locked off, same
+moment frame for frame; keep the model as it is (`describe`); limbs colour-coded and never swapping (`colour_code`);
+the body count (`count`); then the action; it stays on the same spot, centred in both views; one continuous 5 s shot
+at natural speed; the cameras never move.
+
+Write the action as one sentence that starts and ends in the rest pose ("..., then drops back onto all four legs").
+That keeps the creature in frame and makes clips loop. Name the limbs the way `colour_code` does. Keep it on the spot:
+walks and runs work as "on the spot like a video-game running loop". Add bans to `count` when the model drifts
+("No flames, no smoke, no weapon." for the fire demon). `python tools/make_prompt.py --check` confirms every prompt
+under `prompts/` still matches its creature.json.
+
+## 2. Generate
+
+Say the cost first: about $0.26 per 5 s clip with H3 Max (October 2026), one clip per model and seed.
+
+```bash
+tools/film.sh <c> roar h3max 1,2 # runs/<c>/videos/roar/s1/h3max.mp4 and s2/; about 1-2 min each
+```
+
+Models (`mocap/generate.py`): `h3max` (MiniMax H3 Max, best sync of the views so far), `h3` (MiniMax H3, $0.30),
+`h3maxturbo`, `seedance` (ByteDance Seedance 2.5, expensive: three 720p clips cost $7.10), `flux3max` (FLUX 3 Max). Two
+seeds per move is a good default; capture both and keep the one whose views agree better.
+
+## 3. Check the clip before capture
+
+Look at a few frames (or the whole clip) and reject it if:
+
+- the split screen breaks: a view zooms, pans or cuts, the divider moves, the creature walks out of a view;
+- a limb's colour changes or swaps sides (plain H3 swapped them on 2 of 5 wolf clips; the reader then labels the
+ wrong legs); the LoRA (diptych-lora) kept them on 5 of 5;
+- the body count changes (an extra leg, a lost wing), or the creature turns to face another way;
+- fire, smoke, dust or a weapon covers joints.
+
+The real gate is numeric and comes in capture: the paw agreement between the views (diptych-capture). What the
+clips taught so far:
+
+- Views disagree in the legs, not in time. Seedance's trot played the front legs in anti-phase between the views
+ (paw agreement -0.04) while H3 Max scored 0.94 on the same prompt.
+- Big single gestures (rear up, roar, slam, take off, pounce) read best: dragon take-off 1.00, spider rear-up 0.99,
+ demon wing beat 0.99. Eight-legged walking fails (0.36-0.49): the views disagree on which legs are up.
+- Lying down and dying poses failed on the wolf: the reader's random training poses don't cover them.
diff --git a/skills/diptych-lora/SKILL.md b/skills/diptych-lora/SKILL.md
new file mode 100644
index 0000000..308aaba
--- /dev/null
+++ b/skills/diptych-lora/SKILL.md
@@ -0,0 +1,69 @@
+---
+name: diptych-lora
+description: Train and use a MiniMax H3 image-to-video LoRA on fal that keeps diptych's two-camera layout - split screen held, limb colours kept, both views in step. Builds the dataset by re-rendering clean captured motions (and their mirrors) from both cameras, packs it, runs a cheap debug pass, trains, and A/B tests against plain H3 with the same seeds. Use when plain video models keep swapping limb colours or breaking the split screen for a creature, or when someone asks about @Graalitoo's LoRA step, its cost or its training data.
+license: Apache-2.0
+compatibility: Needs a fal.ai key (FAL_KEY), Blender 5.x, and a creature with several good captures (diptych-capture). Training runs on fal, not locally.
+---
+
+# diptych-lora: teach the video model the layout
+
+Graalitoo's addition to the method: a LoRA on MiniMax H3 (open weights) so two-camera clips come out right more
+often. fal hosts both the trainer (`minimax/h3/i2v/trainer`, $0.01 a step) and LoRA inference
+(`minimax/h3/image-to-video/lora`, about $0.375 a 5 s clip, about 200 s each). No local GPU needed for this part.
+
+## The data, and what it is
+
+Each training clip is one motion the pipeline already captured cleanly (paw agreement 0.8 or more), re-rendered in
+Blender from both layout cameras on the painted rig, composed into the two-camera frame, and captioned with the prompt
+that produced it. Each is also mirrored left to right (left/right and colour words swapped in the action sentence), so
+19 motions give 38 clips. Every clip comes from one 3D motion, so the two halves are in sync by construction. The
+motion itself is AI-made: it was solved from AI clips. Real animal mocap exists (for dogs, AI4Animation's data) but
+its licence is non-commercial; say which you're using.
+
+## Steps
+
+1. Capture 15-20 good moves (diptych-film, diptych-capture). Prompts live in `prompts/<c>/<move>.txt` or
+ `prompts/<c>/train/<move>.txt`; the wolf has 14 training and 4 held-out moves already written.
+2. Build the set (Blender renders each clip and its mirror, 5 at a time):
+ ```bash
+ MOCAP_CREATURE=assets/<c> .venv/bin/python tools/build_lora_set.py runs/<c>/lora/data trot_s1 howl_s1 ...
+ ```
+ Clip names are folders under `runs/<c>/clips/`; the move is the name up to its last `_`. It was built and tested on
+ the wolf, whose rig is symmetric; mirroring an asymmetric rig (the dragon's wings) needs checking.
+3. Pack, then a 1-step debug run ($0.01) to see what fal's preprocessing does (768 x 448, 107 frames at 24 fps):
+ ```bash
+ .venv/bin/python -m mocap.lora pack runs/<c>/lora/data runs/<c>/lora/data.zip
+ .venv/bin/python -m mocap.lora train runs/<c>/lora/data.zip runs/<c>/lora/debug 1 --debug
+ ```
+ Open `runs/<c>/lora/debug/debug_dataset.zip` and check the frames still show both views whole.
+4. Train. Say the cost first: 1,200 steps is about $12 and about 2 h (rank 32, lr 2e-4, trigger word `TWOCAM`).
+ ```bash
+ setsid .venv/bin/python -m mocap.lora train runs/<c>/lora/data.zip runs/<c>/lora/v1 1200 > runs/<c>/lora/v1.log 2>&1 &
+ ```
+ If the session drops, the run keeps going on fal: `python -m mocap.lora resume runs/<c>/lora/v1` re-attaches.
+5. Generate with it (the trigger word is added for you):
+ ```bash
+ .venv/bin/python -m mocap.lora generate runs/<c>/lora/v1 runs/<c>/ref/ref.png prompts/<c>/pounce.txt runs/<c>/videos/pounce/lora.mp4 1.0 42
+ ```
+ The wolf's trained LoRA is in the examples release, so it can be tried without training (about $0.38 a clip):
+ ```bash
+ tools/fetch_examples.sh wolf --clips --lora
+ .venv/bin/python -m mocap.lora generate runs/wolf/lora/twocam_wolf_h3_lora.safetensors runs/wolf/ref/ref.png \
+ prompts/wolf/heldout/pounce.txt runs/wolf/videos/pounce/lora.mp4 1.0 42
+ ```
+6. A/B test on held-out moves against plain H3 with the same seed, then capture both and compare paw agreement and
+ reprojection error (diptych-capture).
+
+## What it did for the wolf (one seed per move: a first read, not a benchmark)
+
+| move | plain H3 | H3 + LoRA |
+|---|---|---|
+| trot (in training set) | colours swapped, paws 0.15, fit 20.5 px | colours kept, paws 0.48, fit 6.0 px |
+| gallop | colours swapped, fit 44 px | colours kept, paws -0.06, fit 21.6 px |
+| pounce | one paw moves (-0.65), fit 6.0 px | all four move, paws 0.80, fit 6.2 px |
+| dig | paws 0.75, fit 5.6 px | paws 0.87, fit 4.8 px |
+| shake | paws 0.70, fit 9.1 px | paws 0.69, fit 6.9 px |
+
+Plain H3 broke the colour code on 2 of 5 clips, the LoRA on 0 of 5. Sync improved on trot, pounce and dig, not on the
+gallop. MiniMax H3's open weights carry a community licence (its page asks US, EU, UK and South Korea users to apply);
+hosted use on fal goes through fal's terms. Check both before shipping anything made with it.
diff --git a/skills/diptych-reader/SKILL.md b/skills/diptych-reader/SKILL.md
new file mode 100644
index 0000000..e120896
--- /dev/null
+++ b/skills/diptych-reader/SKILL.md
@@ -0,0 +1,67 @@
+---
+name: diptych-reader
+description: Train the joint reader for one diptych creature - render about 2,200 random poses from both layout cameras with every joint's true position, fine-tune DINOv2 (ViT-B/14 with registers) plus a heatmap head on them, check the held-out error, and optionally run the exam (a made-up motion with known joints, read back and scored in centimetres). Use after diptych-rig and before diptych-capture, when a reader misses or swaps joints on real clips, or when planning GPU time for dataset rendering and training.
+license: Apache-2.0
+compatibility: NVIDIA GPU with CUDA (about 12 GB at batch 20, so a 24 GB card), Blender 5.x, Python 3.11 venv from requirements.txt. Downloads facebook/dinov2-with-registers-base on first use.
+---
+
+# diptych-reader: teach DINOv2 one creature
+
+The reader is trained on the creature itself, so it knows every joint name and every limb colour. Data is free:
+Blender poses the rig at random inside its joint limits and records where each joint lands in both views.
+
+## 1. Render the dataset (about 25 min for 2,200 poses on one RTX 4090)
+
+```bash
+tools/dataset.sh <c> 2200 3 # 3 Blender processes -> runs/<c>/dataset/{00000_front.png, _side.png, _meta.json}
+```
+
+Half the poses spread uniformly over the limits, half stay near rest; the pelvis sometimes rears; half carry motion
+blur from a random velocity (video models smear fast limbs); lights, turn (±30°, sometimes ±70°), position and
+airtime are random. Open `runs/<c>/dataset_samples.jpg`: dots must sit on the joints. Interrupted renders resume:
+samples that exist are skipped.
+
+GPU budget on a 24 GB card under WSL: a reader training (about 12 GB) plus more than two Blender Cycles renders fills
+the card and everything stalls. Render first, or train beside at most two renders. Blender uses CUDA (OptiX is
+unreliable under WSL).
+
+## 2. Train (17-20 min, 20 epochs)
+
+```bash
+tools/train.sh <c> 20 20 # runs/<c>/reader.pt; prints held-out error per epoch in layout pixels
+```
+
+Every render is laid on a fresh random backdrop and degraded like video (framing jitter, colour, blur, downscale,
+noise, JPEG) so the reader works on AI clips, not just clean renders. 4% of the samples are held out. The checkpoint
+is rewritten after each epoch.
+
+What good looks like (front / side, layout pixels, after 20 epochs): spider 2.9 / 3.6, dragon 6.2 / 5.5, wolf
+6.9 / 3.8, demon 8.4 / 9.4. Judge it against the creature's size in the frame: the demon stands 412 px tall, so
+8.4 px is about 2% of its height, like the dragon. If the error stalls well above that, check the dataset sheet (dots
+off the joints means the layout in creature.json changed after rendering) and the joint limits.
+
+## 3. The exam (optional, about 10 min): known motion in, error in centimetres out
+
+A random smooth motion inside the limits is rendered in the same studio, read back and scored per joint.
+
+```bash
+export MOCAP_CREATURE=assets/<c>; R=assets/<c>/rigged; E=runs/<c>/exam
+.venv/bin/python -m mocap.exam make $R/rig_info.json $E/truth.json 0 120
+blender -b -P blender/apply_motion.py -- $R/rigged.blend $R/rig_info.json $E/truth.json $E/truth --views front,side --paint --blur
+.venv/bin/python -m mocap.exam video $E/truth $E/exam.mp4 24
+.venv/bin/python -m mocap.detect $E/exam.mp4 runs/<c>/reader.pt runs/<c>/ref/ref.png $E/det.npz --no-calib
+.venv/bin/python -m mocap.solve $E/det.npz $R/rig_info.json $E/solved.json
+blender -b -P blender/apply_motion.py -- $R/rigged.blend $R/rig_info.json $E/solved.json $E/solved
+.venv/bin/python -m mocap.exam score $E/truth/joints.json $E/solved/joints.json
+```
+
+The wolf scored 0.94 cm mean 3D joint error on a 1.6 m body (median 0.63 cm, paws 1.5 cm, worst joint 3.4 cm).
+
+## When the reader struggles on real clips
+
+- Joints jump between limbs: the limb colours in the clip drifted from the paint (diptych-film), or two limbs share
+ similar colours. Repaint far-apart colours and retrain.
+- A pose the clip shows never appeared in training (lying on its side, a full curl): widen that bone's limits in
+ rig.json, rebuild the rig, render and train again. Random poses don't cover lying-down; captured motions would.
+- Fur, cloth or ears flapping: the wolf's tracked-fur reader added a tip joint per fur bone
+ (`blender/add_fur_bones.py`, `blender/export_fur_rig_info.py`) and read swings of 7-28° from the video.
diff --git a/skills/diptych-rig/SKILL.md b/skills/diptych-rig/SKILL.md
new file mode 100644
index 0000000..1ec46df
--- /dev/null
+++ b/skills/diptych-rig/SKILL.md
@@ -0,0 +1,108 @@
+---
+name: diptych-rig
+description: Set up a new creature for diptych - get a textured mesh, scale and face it, place its skeleton in rig.json with grid views, build and skin the rig in Blender, paint each limb its own colour, choose the two-camera framing, and render the reference frame the video model starts from. Use when adding a creature to diptych, when a rig tears or deforms badly, when the creature is cut off or tiny in the two-camera frame, or when someone asks how to rig a non-humanoid for diptych.
+license: Apache-2.0
+compatibility: Blender 5.x on PATH (or BLENDER=...), Python 3.11 venv from requirements.txt. A fal.ai key only if the mesh is generated with Tripo.
+---
+
+# diptych-rig: one creature, ready to film
+
+Everything for creature `<c>` lives in `assets/<c>/`: `model.glb` (the mesh), `creature.json` (framing, paint, words
+for the prompt), `rig.json` (the skeleton). Copy a close example to start: `assets/wolf` (quadruped), `assets/dragon`
+(quadruped with wings), `assets/spider` (eight legs), `assets/demon` (biped with wings and tail).
+
+## 1. The mesh
+
+- Any textured GLB works. diptych's examples are Tripo H3.1 (`tripo3d/h3.1/image-to-3d` on fal, $0.40 with HD
+ texture) from one FLUX 3 concept image: a plain 3/4 view of the creature on a neutral background, whole body in
+ frame, limbs apart and clearly separate.
+- Prefer a design where every limb reads separately. Fire, smoke, capes, weapons and long hair hide joints from the
+ reader later; leave them to game VFX.
+
+## 2. Face it, scale it, stand it on the ground
+
+Fill in `creature.json` → `"prep": {"length_m": ..., "rotz_deg": ..., "axis": "y"}`: the real size along `axis` (y is
+nose to tail; x for creatures wider than long, like a spider's leg span; z for tall bipeds), and the turn about Z that
+makes it face -Y. Then:
+
+```bash
+tools/prep.sh <c> # assets/<c>/prep/static.blend, verts.npy, and views.png (side, front, top, 10 cm grid)
+```
+
+Check `assets/<c>/prep/views.png`: in the side view the head is on the right, the feet sit on z = 0, and both feet of a
+pair are level in the front view. Tripo's `align_image` orientation can leave a creature turned a few degrees; fix
+`rotz_deg` until the feet are level (the demon needed -73, not -90). If unsure which way it faces, run
+`blender -b -P blender/inspect_mesh.py -- assets/<c>/model.glb runs/<c>/inspect` and look at the four views.
+
+## 3. The skeleton: rig.json
+
+Metres in the prepped mesh's frame: the creature faces -Y, its left is +X, Z is up, the ground is z = 0.
+
+```json
+{
+ "joints": {"hips": [0, 0.32, 0.86], "spine1": [0, 0.05, 0.95], "shoulder_L": [0.21, -0.55, 1.02]},
+ "bones": [["pelvis", "hips", "spine1", null], ["upperarm_L", "shoulder_L", "elbow_L", "chest"]],
+ "limits_deg": {"pelvis": [[-30, 30], [-20, 20], [-30, 30]], "upperarm": [[-70, 50], [-10, 10], [-25, 25]]}
+}
+```
+
+- `joints`: name to [x, y, z]. Every `_L` joint is mirrored to `_R` (x negated) unless you give the `_R` joint
+ yourself; give both for asymmetric meshes (the dragon's wings).
+- `bones`: [name, head joint, tail joint, parent]. The first bone is the root (free to turn and move). `_L` bones are
+ mirrored too. Joints at bone ends are what the reader learns to find, so put one at every place the video should
+ control: paw tips, wing tips, tail segments (6 for a long tail), jaw if the mouth opens.
+- `limits_deg`: per bone name, or per stem without `_L`/`_R`: [[x lo, x hi], [y lo, y hi], [z lo, z hi]] in degrees.
+ Local X is the bending axis (world X for bones in the body's plane), Y runs along the bone (twist: small for spine
+ and legs, ±8-20; arms can need ±40), Z swings sideways. Limits shape the training poses as well as the fit: too wide
+ and the reader learns impossible poses, too narrow and it can't read the move.
+
+Place joints from the grid views. After each edit:
+
+```bash
+tools/prep.sh <c> # redraws views.png with the joints and bones on the grid
+tools/rig.sh <c> preview # joints over an x-ray of the mesh: assets/<c>/prep/preview/joints_{side,front,top}.png
+```
+
+Joints belong inside the limb, at the pivot: the elbow at the bend, not on the skin. For legs, take the centre line
+from the side and front views; for wings, put the wrist and finger tips on the membrane's edge.
+
+## 4. Build, skin, paint, render the reference
+
+Fill in `creature.json` → `"paint"`: one group per limb with a colour and the bones it covers, left and right in
+different colours, all colours far apart (pink #F53CD1, blue #2F6BFF, yellow #FFD21F, cyan #19D3E0, orange #FF7A1A,
+green #2BD94A, purple #9B4DFF, red #FF2B2B). Set `"feet"` to the paw or foot joints (the sync score uses them).
+
+```bash
+tools/rig.sh <c> # assets/<c>/rigged/{rigged.blend, rig_info.json, testpose_*.png}, runs/<c>/ref/ref.png
+```
+
+`build_rig.py` merges the seam vertices first (Tripo splits the mesh at every texture seam; skipping this tears the
+thighs open when a joint bends), skins with Blender's automatic weights, smooths them and keeps 4 bones per vertex.
+Check `testpose_front.png` and `testpose_side.png`: the bent limbs stay whole and only the painted part moves.
+
+## 5. The two-camera framing: creature.json "layout"
+
+`{"W_FRONT": 640, "W_SIDE": 640, "M_PER_PX": 0.006875, "GROUND_V": 630}`: widths of the two views in pixels (they sum
+to 1280; 420 + 860 suits a long, narrow quadruped, 640 + 640 a wide one), metres per pixel, and the ground's pixel
+row in the 720-row frame. The creature in its biggest pose must fit both views with margin: height under about
+`GROUND_V × M_PER_PX × 0.85`, width under `W_FRONT × M_PER_PX`, length under `W_SIDE × M_PER_PX`. A dragon rearing
+with wings up needs more headroom than one standing. Re-run `tools/rig.sh <c>` after changing it and look at
+`runs/<c>/ref/ref.png`: the whole creature, both views, a dark divider between them, nothing touching an edge.
+
+## 6. Words for the prompt
+
+Also in `creature.json`: `name` ("spider"), `noun` ("giant spider"), `describe` ("a black armoured giant spider with
+bone-coloured markings"), `colour_code` ("first left leg pink, first right leg blue; ..."), `count` ("Exactly eight
+legs, two fangs, one body, one round abdomen."), `flank` ("flank" or "side") and `limbs` ("legs" or "limbs").
+`tools/make_prompt.py` builds every prompt from these (diptych-film).
+
+Last, `"camera": {"cam": "-5.4,-6.0,1.4", "target": "0,-0.3,1.5", "lens": 32}` is the 3/4 view that
+`tools/capture.sh` renders each move from (diptych-capture says how to frame it). Without it, the wolf's applies.
+
+## Failure modes seen
+
+- Torn or gaping thighs when a leg bends: seam vertices weren't merged (a mesh from a tool other than build_rig.py),
+ or a joint sits outside the limb.
+- A limb half painted: the paint group misses a bone, or the weights spill onto the body; move the joint, rebuild.
+- The rig bends the wrong way: the bone's local X isn't the bending axis. Keep bones of a limb in one plane.
+- Automatic rigging (UniRig) can replace hand placement; its install pulls prebuilt flash-attn wheels from GitHub.
diff --git a/skills/diptych/SKILL.md b/skills/diptych/SKILL.md
new file mode 100644
index 0000000..46cd6b3
--- /dev/null
+++ b/skills/diptych/SKILL.md
@@ -0,0 +1,70 @@
+---
+name: diptych
+description: Motion capture for any creature from one AI video, with the diptych repo. A video model films a rigged 3D creature from two cameras in one frame, a DINOv2 joint reader trained on that creature finds every joint in both views, and the rig is fitted to them and exported as a GLB. Use when someone wants to animate a non-human creature (dragon, spider, wolf, monster) from a text prompt or an AI video, asks how diptych works, or needs to know which step comes next; it routes to diptych-rig, diptych-film, diptych-reader, diptych-capture and diptych-lora.
+license: Apache-2.0
+compatibility: Needs an NVIDIA GPU with CUDA (24 GB to train a reader at batch 20), Blender 5.x, Python 3.11, and a fal.ai key for video generation.
+---
+
+# diptych
+
+Animate any rigged creature from one AI video. The trick is the frame: one image holds two orthographic views of the
+creature at the same scale, front on the left and side on the right, sharing the vertical axis. A joint sits on the
+same pixel row in both halves, so the front view gives left-right and height, the side view gives front-back and
+height, and together they pin the joint in 3D. The method is @CanItCode's; the LoRA step is @Graalitoo's idea.
+
+## The pipeline
+
+| step | once per | what happens | skill |
+|---|---|---|---|
+| 1. mesh | creature | a textured 3D model (Tripo H3.1 from one image, or your own GLB), facing -Y, real size | diptych-rig |
+| 2. skeleton | creature | joints placed in `assets/<c>/rig.json`, rig built and skinned in Blender | diptych-rig |
+| 3. limb colours | creature | each limb painted its own colour so left and right never swap | diptych-rig |
+| 4. two cameras | move | the painted reference frame plus a strict prompt go to MiniMax H3 Max on fal | diptych-film |
+| 5. teach a reader | creature | 2,200 random poses rendered with known joints; DINOv2 learns this creature | diptych-reader |
+| 6. read every joint | clip | the reader finds every joint in both views, every frame | diptych-capture |
+| 7. two views, 3D | clip | shared heights tie the views; the pair gives each joint in 3D | diptych-capture |
+| 8. the rig follows | clip | forward kinematics in torch fitted to both views; GLB out | diptych-capture |
+| optional | creature | a MiniMax H3 LoRA that keeps the two-camera layout and colours more reliably | diptych-lora |
+
+## Before anything
+
+1. Work in a diptych checkout. If the working directory has no `tools/capture.sh`, clone it:
+ `git clone https://github.com/Patch-gg/diptych && cd diptych`.
+2. Set up once: `python3.11 -m venv .venv`, then
+ `.venv/bin/pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cu128` and
+ `.venv/bin/pip install -r requirements.txt`. Blender 5.x must be on PATH, or set `BLENDER=/path/to/blender`.
+3. For video generation and LoRA training, put `FAL_KEY=...` in `.env` (git ignores it) or export it. Never print it.
+4. Every command takes a creature name; its config is `assets/<c>/creature.json` and every output lands in
+ `runs/<c>/` (reference frame, dataset, `reader.pt`, videos, clips). The scripts set `MOCAP_CREATURE` for you; when
+ you run a `python -m mocap...` module by hand, set `MOCAP_CREATURE=assets/<c>` first, or the wolf's layout applies.
+
+## Which step next
+
+- No `assets/<c>/model.glb`: make or fetch the mesh. Examples: `tools/fetch_examples.sh <c>` (wolf, dragon, spider,
+ demon). New creature: diptych-rig.
+- No `assets/<c>/rigged/rigged.blend` or `runs/<c>/ref/ref.png`: `tools/prep.sh <c>` then `tools/rig.sh <c>`
+ (diptych-rig).
+- No `runs/<c>/reader.pt`: diptych-reader (about 45 min on one RTX 4090), or `tools/fetch_examples.sh <c> --readers`.
+- No clip for the move: diptych-film (about $0.26 a 5 s clip).
+- A clip: diptych-capture, `tools/capture.sh <c> <video.mp4> <name>`.
+- Clips keep swapping limb colours or the halves drift apart: diptych-lora.
+
+## Try it without a GPU
+
+The repo carries the dragon's roar as read by its reader. Fit it on the CPU in about 20 seconds:
+
+```bash
+mkdir -p runs/dragon/clips/roar
+MOCAP_CREATURE=assets/dragon .venv/bin/python -m mocap.solve examples/dragon_roar/det.npz \
+ assets/dragon/rigged/rig_info.json runs/dragon/clips/roar/motion.json
+```
+
+It prints the paw agreement (about 0.93) and the reprojection error per view; `motion.json` holds the keyframes.
+
+## Costs and time (October 2026, one RTX 4090)
+
+- Tripo H3.1 mesh with HD texture: $0.40. MiniMax H3 Max clip: about $0.26 for 5 s (H3: $0.30).
+- Dataset of 2,200 poses: about 25 min. Reader training: 17-20 min. Reading a clip: 10 s. Fitting: under a minute.
+- A LoRA: $0.01 a training step, so 1,200 steps cost about $12 and take about 2 h on fal.
+
+Say what a step will cost before calling fal, and confirm with the person before spending on a batch.
diff --git a/tools/_env.sh b/tools/_env.sh
new file mode 100644
index 0000000..30302e2
--- /dev/null
+++ b/tools/_env.sh
@@ -0,0 +1,8 @@
+# Shared by the tools/*.sh scripts: run from the repo root, find Python and Blender.
+cd "$(dirname "${BASH_SOURCE[0]}")/.."
+if [ -n "${PYTHON:-}" ]; then PY=$PYTHON; elif [ -x .venv/bin/python ]; then PY=.venv/bin/python; else PY=python3; fi
+BLENDER=${BLENDER:-blender}
+need_creature() {
+ [ -n "${1:-}" ] && [ -f "assets/$1/creature.json" ] || { echo "no assets/${1:-<creature>}/creature.json" >&2; exit 1; }
+ export MOCAP_CREATURE=assets/$1
+}
diff --git a/tools/build_lora_set.py b/tools/build_lora_set.py
new file mode 100644
index 0000000..368a5ac
--- /dev/null
+++ b/tools/build_lora_set.py
@@ -0,0 +1,73 @@
+"""Build the H3 LoRA training set: each solved motion (and its mirror) re-rendered from both layout cameras on the
+painted rig, composed into the two-camera frame, with its prompt as the caption.
+
+MOCAP_CREATURE=assets/wolf python tools/build_lora_set.py OUT_DIR clip[:prompt_file] ...
+Clip names are folders under runs/<creature>/clips/ (from tools/capture.sh); a clip's prompt defaults to
+prompts/<creature>/<move>.txt or prompts/<creature>/train/<move>.txt, where <move> is the clip name up to its last "_".
+Writes OUT_DIR/<clip>.mp4 + .txt and <clip>_m.mp4 + .txt (mirrored). Tested on the wolf, whose rig is symmetric.
+"""
+import json, os, pathlib, re, subprocess, sys
+from concurrent.futures import ThreadPoolExecutor
+
+ROOT = pathlib.Path(__file__).resolve().parents[1]
+sys.path.insert(0, str(ROOT))
+from mocap.mirror import mirror # noqa: E402
+
+CREATURE = pathlib.Path(os.environ.get("MOCAP_CREATURE", "assets/wolf"))
+NAME = CREATURE.name
+RIG = ROOT / CREATURE / "rigged"
+PY = os.environ.get("PYTHON") or (str(ROOT / ".venv/bin/python") if (ROOT / ".venv/bin/python").exists() else sys.executable)
+BLENDER = os.environ.get("BLENDER", "blender")
+SWAP = {"left": "right", "right": "left", "Left": "Right", "Right": "Left", "pink": "blue", "blue": "pink",
+ "yellow": "cyan", "cyan": "yellow", "orange": "green", "green": "orange"}
+
+
+def mirror_action(prompt):
+ """Swap left/right words in the action sentence only; the colour code stays as it is."""
+ head, sep, action = prompt.partition("Action:")
+ return head + sep + re.sub(r"\b(" + "|".join(SWAP) + r")\b", lambda m: SWAP[m.group(1)], action)
+
+
+def render(motion, work, mp4):
+ if mp4.exists():
+ return
+ subprocess.run([BLENDER, "-b", "-P", str(ROOT / "blender/apply_motion.py"), "--", str(RIG / "rigged.blend"),
+ str(RIG / "rig_info.json"), str(motion), str(work), "--views", "front,side", "--paint", "--blur",
+ "--samples", "12", "--scale", "0.75"], check=True, capture_output=True)
+ fps = json.load(open(motion)).get("fps", 24)
+ subprocess.run([PY, "-m", "mocap.exam", "video", str(work), str(mp4) + ".raw.mp4", str(fps)],
+ check=True, cwd=ROOT, capture_output=True)
+ subprocess.run(["ffmpeg", "-loglevel", "error", "-y", "-i", str(mp4) + ".raw.mp4", "-c:v", "libx264", "-crf", "16",
+ "-pix_fmt", "yuv420p", str(mp4)], check=True)
+ pathlib.Path(str(mp4) + ".raw.mp4").unlink()
+ print("rendered", mp4.name, flush=True)
+
+
+def main():
+ out = pathlib.Path(sys.argv[1])
+ out.mkdir(parents=True, exist_ok=True)
+ jobs = []
+ for arg in sys.argv[2:]:
+ clip, _, prompt_file = arg.partition(":")
+ move = clip.rsplit("_", 1)[0]
+ prompt_file = prompt_file or next(p for p in (ROOT / f"prompts/{NAME}/{move}.txt", ROOT / f"prompts/{NAME}/train/{move}.txt")
+ if p.exists())
+ prompt = pathlib.Path(prompt_file).read_text().strip()
+ m = json.load(open(ROOT / f"runs/{NAME}/clips/{clip}/motion.json"))
+ work = out.parent / "work"
+ mot = work / "motions"
+ mot.mkdir(parents=True, exist_ok=True)
+ json.dump(m, open(mot / f"{clip}.json", "w"))
+ json.dump(mirror(m), open(mot / f"{clip}_m.json", "w"))
+ (out / f"{clip}.txt").write_text(prompt + "\n")
+ (out / f"{clip}_m.txt").write_text(mirror_action(prompt) + "\n")
+ jobs += [(mot / f"{clip}.json", work / clip, out / f"{clip}.mp4"),
+ (mot / f"{clip}_m.json", work / f"{clip}_m", out / f"{clip}_m.mp4")]
+ with ThreadPoolExecutor(5) as ex:
+ for f in [ex.submit(render, *j) for j in jobs]:
+ f.result()
+ print("done", len(jobs), "clips")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/capture.sh b/tools/capture.sh
new file mode 100755
index 0000000..226e234
--- /dev/null
+++ b/tools/capture.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Per clip: read every joint in both views, fit the rig, and write the animation as a GLB with renders and a
+# side-by-side comparison of the AI clip and the rig.
+# tools/capture.sh CREATURE VIDEO.mp4 NAME [views=persp,side] -> runs/CREATURE/clips/NAME/
+# det.npz (joints read), overlay.mp4, motion.json (the fit), render/animation.glb, showcase.mp4
+set -euo pipefail
+source "$(dirname "$0")/_env.sh"
+need_creature "${1:-}"
+c=$1; video=${2:?video}; name=${3:?name}; views=${4:-persp,side}
+rig=assets/$c/rigged; out=runs/$c/clips/$name
+# the 3/4 showcase camera: creature.json "camera" (frame it to the creature's biggest move; see diptych-capture)
+read -r cam target lens < <($PY -c "import json; c = json.load(open('assets/$c/creature.json')).get('camera', {}); print(c.get('cam', '-3.2,-3.0,1.6'), c.get('target', '0,0,0.5'), c.get('lens', 50))")
+mkdir -p "$out"
+$PY -m mocap.detect "$video" "runs/$c/reader.pt" "runs/$c/ref/ref.png" "$out/det.npz" "$out/overlay.mp4" | tail -1
+$PY -m mocap.solve "$out/det.npz" "$rig/rig_info.json" "$out/motion.json" | grep -v "iter"
+$BLENDER -b -P blender/apply_motion.py -- "$rig/rigged.blend" "$rig/rig_info.json" "$out/motion.json" "$out/render" \
+ --views "$views" --samples 24 --cam "$cam" --target "$target" --lens "$lens" --glb > "$out/blender.log" 2>&1
+$PY -m mocap.showcase "$video" "$out/det.npz" "$out/render" "$out/showcase.mp4" "$c $name"
+if command -v ffmpeg > /dev/null; then
+ ffmpeg -loglevel error -y -i "$out/showcase.mp4" -c:v libx264 -crf 20 -pix_fmt yuv420p "$out/showcase_h264.mp4"
+fi
+echo "done: $out (animation: $out/render/animation.glb)"
diff --git a/tools/compose_ref.py b/tools/compose_ref.py
new file mode 100644
index 0000000..e8f9b39
--- /dev/null
+++ b/tools/compose_ref.py
@@ -0,0 +1,18 @@
+"""Compose the two RGBA renders from blender/render_ref.py into the two-camera reference frame for the video model.
+
+MOCAP_CREATURE=assets/dragon python tools/compose_ref.py runs/dragon/ref ref_front.png + ref_side.png -> ref.png
+The frame is the layout's: grey studio wall, lighter floor band, front view left, side view right, a dark divider.
+"""
+import pathlib, sys
+
+import numpy as np
+from PIL import Image
+
+sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
+from mocap import layout # noqa: E402
+
+d = pathlib.Path(sys.argv[1])
+f = np.array(Image.open(d / "ref_front.png").convert("RGBA"))
+s = np.array(Image.open(d / "ref_side.png").convert("RGBA"))
+Image.fromarray(layout.compose(f, s)).save(d / "ref.png")
+print("wrote", d / "ref.png", f"{layout.W} x {layout.H}")
diff --git a/tools/dataset.sh b/tools/dataset.sh
new file mode 100755
index 0000000..019baf3
--- /dev/null
+++ b/tools/dataset.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Once per creature, step 3: render COUNT random poses inside the joint limits from both cameras, with the true pixel
+# position of every joint, in PROCS Blender processes; then a contact sheet of the first samples.
+# tools/dataset.sh CREATURE [count=2200] [procs=3] [seed=500] -> runs/CREATURE/dataset
+# About 25 min for 2,200 poses on one RTX 4090. Don't run more than 2 Blender processes beside a reader training.
+set -euo pipefail
+source "$(dirname "$0")/_env.sh"
+need_creature "${1:-}"
+a=assets/$1; n=${2:-2200}; p=${3:-3}; seed=${4:-500}
+per=$(( (n + p - 1) / p ))
+mkdir -p "runs/$1/dataset"
+for k in $(seq 0 $((p - 1))); do
+ $BLENDER -b -P blender/render_dataset.py -- "$a/rigged/rigged.blend" "$a/rigged/rig_info.json" "runs/$1/dataset" \
+ $((k * per)) "$per" "$seed" > "runs/$1/dataset_$k.log" 2>&1 &
+done
+wait
+$PY tools/show_samples.py "runs/$1/dataset" "runs/$1/dataset_samples.jpg" 8
+echo "$(ls "runs/$1/dataset" | grep -c _meta.json) samples; true joints drawn in runs/$1/dataset_samples.jpg"
diff --git a/tools/examples.txt b/tools/examples.txt
new file mode 100644
index 0000000..3deed5a
--- /dev/null
+++ b/tools/examples.txt
@@ -0,0 +1,23 @@
+# Release assets for the example creatures: sha256, bytes, asset name on the release, where it goes in the repo.
+# Release: https://github.com/Patch-gg/diptych/releases/tag/examples-v1 (tools/fetch_examples.sh downloads and checks these)
+# mesh: the Tripo H3.1 model each assets/<creature>/rig.json was placed on
+7d25b0f75c03f84d11bef0cde823d2039637115fd2250eba23e1d3ff99ffdce4 10726072 wolf.glb assets/wolf/model.glb
+bf2f97d4220cad1c208580fde139990da7b9552717f7962c9e9f081ce79d8128 13256908 dragon.glb assets/dragon/model.glb
+e82d443d1ab9f497db24622afc230b37ff2c36b0cc40ad6e656b3f1632ce0114 15377764 spider.glb assets/spider/model.glb
+fdc3948df59fb92fabb3eec8ae3d3e0b6409a1fc79994aa910de0bf057b852af 14874932 demon.glb assets/demon/model.glb
+# reader: a trained joint reader (DINOv2 ViT-B/14 + head), 20 epochs on 2,200 renders
+8a797cc9ce7162cdf1a835a96ab06fe7214e1d4d258bc98d970aa59d1ecdad75 355298675 reader-wolf.pt runs/wolf/reader.pt
+17066c0f4c3900445b6e406271d7ac9d113094888f84655d1c50b8c5a661f29a 355306587 reader-dragon.pt runs/dragon/reader.pt
+c80b7db316c976af19baa658c10a5175cc4ccf8c36ea162847cd86e76dcf2daf 355301275 reader-spider.pt runs/spider/reader.pt
+b2b2ca1b9ca3156839ae1e062da9f481f91a182dc954bc1e8803d9170a764bdd 355304167 reader-demon.pt runs/demon/reader.pt
+# clip: one MiniMax H3 Max two-camera clip per creature and the reference frame it started from
+e06ebcaf4eb5fad98939c95ff682e9988390626a14670a61b158cb162a8e049f 245855 ref-wolf.png runs/wolf/ref/ref.png
+71d01d37e581b986d47cc25e45acbba3c8272d88fde7a427798a3bd87d4ba140 4385056 clip-wolf-trot.mp4 runs/wolf/videos/trot/s1/h3max.mp4
+9c7ad169c241842202bb3c68413b3633aa084706d96a80d58015de4b8d67a9fb 209092 ref-dragon.png runs/dragon/ref/ref.png
+135f4e8d79f7b8f76c122cc4abce7bc3d8f3f7a3cfd44350f3e82939ad7855f6 3766498 clip-dragon-roar.mp4 runs/dragon/videos/roar/s1/h3max.mp4
+44e6bcb87d6b7dc23b921cd9d534c31a4b3e1e1c3af81d2eb646894230558cd1 194984 ref-spider.png runs/spider/ref/ref.png
+f852e1386fcd67fc4fc9e438c2b1c9e713392a05603f61f384b0ec98ecd90842 3444393 clip-spider-rear.mp4 runs/spider/videos/rear/s1/h3max.mp4
+264493c12adecc09069b5e5d740abecfc51169b5cc57484a92121b7a4543fdf7 282439 ref-demon.png runs/demon/ref/ref.png
+2062ef188701f01b11c38dab8a768ce321a0e42a5375e2a1eb9cd390be7ef951 4762986 clip-demon-flap.mp4 runs/demon/videos/flap/s1/h3max.mp4
+# lora: the wolf's two-camera LoRA on MiniMax H3 (1,200 steps; skills/diptych-lora). MiniMax H3's community licence applies, not Apache-2.0
+2eaa8a8e558d6468443422719a48575be9182c03fe4deae249322d07be81eded 131229792 lora-wolf-twocam-h3.safetensors runs/wolf/lora/twocam_wolf_h3_lora.safetensors
diff --git a/tools/fetch_examples.sh b/tools/fetch_examples.sh
new file mode 100755
index 0000000..6ab4167
--- /dev/null
+++ b/tools/fetch_examples.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# Download the example creatures from the GitHub release and check each file's SHA-256 (tools/examples.txt).
+# tools/fetch_examples.sh [wolf] [dragon] [spider] [demon] [--readers] [--clips] [--lora]
+# by default: every named creature's mesh, assets/<creature>/model.glb (11-15 MB each); no names = all four
+# --readers: its trained joint reader, runs/<creature>/reader.pt (355 MB each), to skip the dataset and training
+# --clips: one AI two-camera clip and its reference frame, to try tools/capture.sh without a fal key
+# --lora: the wolf's MiniMax H3 LoRA (131 MB; MiniMax H3's community licence), runs/wolf/lora/
+set -euo pipefail
+cd "$(dirname "$0")/.."
+URL=${DIPTYCH_RELEASE_URL:-https://github.com/Patch-gg/diptych/releases/download/examples-v1}
+kinds=(glb); creatures=()
+for a in "$@"; do
+ case $a in
+ --readers) kinds+=(reader) ;;
+ --clips) kinds+=(clip ref) ;;
+ --lora) kinds+=(lora) ;;
+ *) creatures+=("$a") ;;
+ esac
+done
+[ ${#creatures[@]} -gt 0 ] || creatures=(wolf dragon spider demon)
+sum() { if command -v sha256sum > /dev/null; then sha256sum "$1" | cut -c1-64; else shasum -a 256 "$1" | cut -c1-64; fi; }
+grep -v '^#' tools/examples.txt | while read -r sha size name dest; do
+ kind=${name%%-*}; kind=${kind%.glb}; c=${name%.*}; c=${c#*-}; c=${c%%-*}
+ [ "$name" = "$c.glb" ] && kind=glb
+ [[ " ${creatures[*]} " == *" $c "* ]] || continue
+ [[ " ${kinds[*]} " == *" $kind "* ]] || continue
+ if [ -f "$dest" ] && [ "$(sum "$dest")" = "$sha" ]; then echo "have $dest"; continue; fi
+ mkdir -p "$(dirname "$dest")"
+ echo "get $name ($((size / 1000000)) MB) -> $dest"
+ curl -fL --retry 3 --progress-bar -o "$dest.part" "$URL/$name"
+ [ "$(sum "$dest.part")" = "$sha" ] || { echo "checksum mismatch for $name" >&2; rm -f "$dest.part"; exit 1; }
+ mv "$dest.part" "$dest"
+done
diff --git a/tools/film.sh b/tools/film.sh
new file mode 100755
index 0000000..f4f9950
--- /dev/null
+++ b/tools/film.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# Per move: send the reference frame and prompts/CREATURE/MOVE.txt to video models on fal, one clip per seed.
+# tools/film.sh CREATURE MOVE [models=h3max] [seeds=1,2] -> runs/CREATURE/videos/MOVE/s<seed>/<model>.mp4
+# Needs FAL_KEY. MiniMax H3 Max is about $0.26 a 5 s clip (October 2026); models: h3, h3max, h3maxturbo, seedance, flux3max.
+set -euo pipefail
+source "$(dirname "$0")/_env.sh"
+need_creature "${1:-}"
+c=$1; m=${2:?move}; models=${3:-h3max}; seeds=${4:-1,2}
+[ -f "prompts/$c/$m.txt" ] || { echo "write prompts/$c/$m.txt first (tools/make_prompt.py)" >&2; exit 1; }
+for s in ${seeds//,/ }; do
+ $PY -m mocap.generate "runs/$c/ref/ref.png" "prompts/$c/$m.txt" "runs/$c/videos/$m/s$s" "$models" 5 "$s" &
+done
+wait
+ls runs/$c/videos/$m/s*/*.mp4
diff --git a/tools/fit_check.py b/tools/fit_check.py
new file mode 100644
index 0000000..b74cf35
--- /dev/null
+++ b/tools/fit_check.py
@@ -0,0 +1,30 @@
+"""Draw the reader's joints (rings) and the fitted rig's joints (dots) on chosen frames of a clip.
+
+python tools/fit_check.py VIDEO.mp4 CLIP_DIR out.jpg frame [frame ...]
+"""
+import json, sys
+import cv2
+import numpy as np
+sys.path.insert(0, ".")
+from mocap import layout
+from mocap.detect import read_frames
+
+video, clip, out = sys.argv[1:4]
+ts = [int(t) for t in sys.argv[4:]]
+d = np.load(f"{clip}/det.npz")
+m = json.load(open(f"{clip}/motion.json"))
+J = np.array(m["joints"])
+pf, ps = layout.project(J)
+frames, _ = read_frames(video)
+tiles = []
+for t in ts:
+ img = np.ascontiguousarray(cv2.warpAffine(frames[t], d["calib"], (layout.W, layout.H))[..., ::-1])
+ for det, fit, x0 in ((d["front_uv"][t], pf[t], 0), (d["side_uv"][t], ps[t], layout.W_FRONT)):
+ for j in range(len(det)):
+ cv2.circle(img, (int(det[j, 0] + x0), int(det[j, 1])), 5, (0, 255, 255), 1, cv2.LINE_AA)
+ cv2.circle(img, (int(fit[j, 0] + x0), int(fit[j, 1])), 3, (0, 0, 255), -1, cv2.LINE_AA)
+ cv2.line(img, (int(det[j, 0] + x0), int(det[j, 1])), (int(fit[j, 0] + x0), int(fit[j, 1])), (0, 0, 255), 1)
+ cv2.putText(img, f"frame {t}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (255, 255, 255), 2)
+ tiles.append(cv2.resize(img, (960, 540)))
+rows = [np.hstack(tiles[i:i + 2]) if i + 1 < len(tiles) else np.hstack([tiles[i], np.zeros_like(tiles[i])]) for i in range(0, len(tiles), 2)]
+cv2.imwrite(out, np.vstack(rows))
diff --git a/tools/grid_views.py b/tools/grid_views.py
new file mode 100644
index 0000000..b8557e4
--- /dev/null
+++ b/tools/grid_views.py
@@ -0,0 +1,78 @@
+"""Draw a metre grid and a rig's joints and bones over blender/ortho_views.py renders, as one sheet.
+
+python tools/grid_views.py VIEWS_DIR out.png [rig.json] [step_m]
+_L joints are mirrored to _R unless the rig gives the _R joint itself. Left side pink, right blue, middle orange.
+"""
+import json, pathlib, sys
+from PIL import Image, ImageDraw
+
+d = pathlib.Path(sys.argv[1])
+views = json.load(open(d / "views.json"))
+rig = json.load(open(sys.argv[3])) if len(sys.argv) > 3 and sys.argv[3] != "-" else None
+step = float(sys.argv[4]) if len(sys.argv) > 4 else 0.1
+joints, bones = {}, []
+if rig:
+ joints = dict(rig["joints"])
+ for k, v in rig["joints"].items():
+ if k.endswith("_L") and k[:-2] + "_R" not in rig["joints"]:
+ joints[k[:-2] + "_R"] = [-v[0], v[1], v[2]]
+ for b in rig["bones"]:
+ bones.append(b)
+ if b[0].endswith("_L"):
+ bones.append([x[:-2] + "_R" if x and x.endswith("_L") else x for x in b])
+
+
+def to_px(v, p):
+ u = v["h_sign"] * (p[v["h_axis"]] - v["left"]) * v["ppm"]
+ w = v["v_sign"] * (v["top"] - p[v["v_axis"]]) * v["ppm"]
+ return u, w
+
+
+def col(n):
+ return (230, 40, 200) if n.endswith("_L") else (40, 90, 255) if n.endswith("_R") else (240, 130, 0)
+
+
+panels = []
+for name in ("side", "front", "top"):
+ v = views[name]
+ im = Image.open(d / f"{name}.png").convert("RGB")
+ dr = ImageDraw.Draw(im)
+ for axis, horiz in ((v["h_axis"], True), (v["v_axis"], False)):
+ extent = (v["w"] if horiz else v["h"]) / v["ppm"]
+ if horiz:
+ a0, a1 = sorted([v["left"], v["left"] + v["h_sign"] * extent])
+ else:
+ a0, a1 = sorted([v["top"], v["top"] - v["v_sign"] * extent])
+ k = int(a0 / step) - 1
+ while k * step <= a1 + 1e-9:
+ val = round(k * step, 4)
+ p = [0, 0, 0]
+ p[axis] = val
+ if horiz:
+ x = to_px(v, p)[0] if True else 0
+ dr.line([(x, 0), (x, v["h"])], fill=(255, 120, 120) if abs(val) < 1e-6 else (120, 160, 255), width=1)
+ if round(val / step) % 2 == 0:
+ dr.text((x + 2, 2), f"{val:+.1f}", fill=(255, 255, 0))
+ else:
+ y = to_px(v, p)[1]
+ dr.line([(0, y), (v["w"], y)], fill=(255, 120, 120) if abs(val) < 1e-6 else (120, 160, 255), width=1)
+ if round(val / step) % 2 == 0:
+ dr.text((2, y + 2), f"{val:+.1f}", fill=(255, 255, 0))
+ k += 1
+ for b in bones:
+ if b[1] in joints and b[2] in joints:
+ dr.line([to_px(v, joints[b[1]]), to_px(v, joints[b[2]])], fill=col(b[0]), width=3)
+ for n, p in joints.items():
+ x, y = to_px(v, p)
+ dr.ellipse([x - 5, y - 5, x + 5, y + 5], fill=col(n))
+ dr.text((x + 6, y - 6), n, fill=(255, 255, 255))
+ dr.text((v["w"] // 2 - 30, v["h"] - 16), name, fill=(255, 255, 255))
+ panels.append(im)
+W = panels[0].width + panels[1].width + 10
+H = max(panels[0].height, panels[1].height) + 10 + panels[2].height
+sheet = Image.new("RGB", (max(W, panels[2].width), H), (20, 20, 20))
+sheet.paste(panels[0], (0, 0))
+sheet.paste(panels[1], (panels[0].width + 10, 0))
+sheet.paste(panels[2], (0, max(panels[0].height, panels[1].height) + 10))
+sheet.save(sys.argv[2])
+print(sheet.size)
diff --git a/tools/make_prompt.py b/tools/make_prompt.py
new file mode 100644
index 0000000..9230804
--- /dev/null
+++ b/tools/make_prompt.py
@@ -0,0 +1,58 @@
+"""Write a two-camera video prompt for a creature from its creature.json and one action sentence.
+
+python tools/make_prompt.py assets/dragon "the dragon rears up on its hind legs, spreads its wings wide and roars, then drops back onto all four legs." [out.txt]
+python tools/make_prompt.py --check rebuild every prompt under prompts/ and report any that differ
+
+The prompt pins down what video models otherwise drift on: both halves are one moment from two locked cameras, the
+model stays exactly as rendered, every limb keeps its colour, the body count is fixed, and the creature stays centred.
+Only the action changes from move to move. creature.json gives the words: noun ("giant spider"), name ("spider"),
+describe, colour_code, count, flank ("flank" or "side") and limbs ("legs" or "limbs").
+"""
+import json, pathlib, re, sys
+
+ROOT = pathlib.Path(__file__).resolve().parents[1]
+
+TEMPLATE = (
+ "Animate the exact {noun} game model shown twice in this split-screen image. Left: a front camera, the {name} faces "
+ "the viewer. Right: a side camera on its right {flank}, the {name} faces right. Both are locked-off cameras filming "
+ "the same {name} at the same moment, so every movement happens in both views at exactly the same time, frame for "
+ "frame. Keep the model exactly as it is: {describe}. Its {limbs} are colour-coded and the colours never change or "
+ "swap: {colour_code}. {count} Action: {action} It stays on the same spot, centred in both views. One continuous "
+ "5-second shot at natural speed, no slow motion. The cameras never move, cut, pan or zoom; the plain grey studio "
+ "background, the floor band and the dark vertical divider stay fixed."
+)
+
+
+def prompt(creature_dir, action):
+ c = json.load(open(pathlib.Path(creature_dir) / "creature.json"))
+ action = action.strip()
+ if not action.endswith("."):
+ action += "."
+ return TEMPLATE.format(noun=c.get("noun", c["name"]), name=c["name"], flank=c.get("flank", "side"),
+ describe=c["describe"], limbs=c.get("limbs", "limbs"), colour_code=c["colour_code"],
+ count=c["count"], action=action)
+
+
+def check():
+ bad, hand = 0, 0
+ files = sorted((ROOT / "prompts").rglob("*.txt"))
+ for f in files:
+ creature = f.relative_to(ROOT / "prompts").parts[0]
+ text = f.read_text().strip()
+ m = re.search(r"Action: (.*?) It stays on the same spot", text)
+ if not m: # written by hand before the template (the wolf's trot says "stays centred" inside its action)
+ print("hand-written, kept as is:", f.relative_to(ROOT)); hand += 1; continue
+ if prompt(ROOT / "assets" / creature, m.group(1)) != text:
+ print("differs:", f.relative_to(ROOT)); bad += 1
+ print(f"{len(files) - bad - hand} of {len(files)} prompts rebuild exactly, {hand} hand-written")
+ return bad
+
+
+if __name__ == "__main__":
+ if sys.argv[1] == "--check":
+ raise SystemExit(1 if check() else 0)
+ text = prompt(sys.argv[1], sys.argv[2])
+ if len(sys.argv) > 3:
+ pathlib.Path(sys.argv[3]).parent.mkdir(parents=True, exist_ok=True)
+ pathlib.Path(sys.argv[3]).write_text(text + "\n")
+ print(text)
diff --git a/tools/mesh_views.py b/tools/mesh_views.py
new file mode 100644
index 0000000..37e84d6
--- /dev/null
+++ b/tools/mesh_views.py
@@ -0,0 +1,55 @@
+"""Draw side/front/top point projections of a mesh with a 10 cm grid, optionally with joints, for rig placement.
+
+python tools/mesh_views.py verts.npy out.png [joints.json]
+Side view looks from -X (head on the right), front from -Y, top from +Z (head at the bottom).
+"""
+import json, sys
+import numpy as np
+from PIL import Image, ImageDraw
+
+v = np.load(sys.argv[1])
+joints = json.load(open(sys.argv[3]))["joints"] if len(sys.argv) > 3 else {}
+PX = 400 # pixels per metre
+pad = 0.08
+lo, hi = v.min(0) - pad, v.max(0) + pad
+
+def panel(ax_h, ax_v, flip_h, flip_v, title):
+ h0, h1 = lo[ax_h], hi[ax_h]
+ v0, v1 = lo[ax_v], hi[ax_v]
+ W, H = int((h1 - h0) * PX), int((v1 - v0) * PX)
+ def to_px(p):
+ x = (p[ax_h] - h0) * PX
+ y = (p[ax_v] - v0) * PX
+ if flip_h: x = W - x
+ if flip_v: y = H - y
+ return x, y
+ img = Image.new("RGB", (W, H), (245, 245, 245))
+ d = ImageDraw.Draw(img)
+ for g in np.arange(np.floor(h0 * 10) / 10, h1, 0.1):
+ x = to_px({ax_h: g, ax_v: v0} | {k: 0 for k in range(3) if k not in (ax_h, ax_v)})[0]
+ d.line([(x, 0), (x, H)], fill=(200, 200, 255) if abs(g) > 1e-6 else (255, 120, 120))
+ d.text((x + 2, 2), f"{g:+.1f}", fill=(90, 90, 160))
+ for g in np.arange(np.floor(v0 * 10) / 10, v1, 0.1):
+ y = to_px({ax_h: h0, ax_v: g} | {k: 0 for k in range(3) if k not in (ax_h, ax_v)})[1]
+ d.line([(0, y), (W, y)], fill=(200, 200, 255) if abs(g) > 1e-6 else (255, 120, 120))
+ d.text((2, y + 2), f"{g:+.1f}", fill=(90, 90, 160))
+ pts = np.array([to_px({0: p[0], 1: p[1], 2: p[2]}) for p in v[::2]])
+ for x, y in pts:
+ d.point((x, y), fill=(60, 60, 60))
+ for name, j in joints.items():
+ x, y = to_px({0: j[0], 1: j[1], 2: j[2]})
+ col = (230, 40, 200) if name.endswith("_L") else (40, 90, 255) if name.endswith("_R") else (230, 120, 0)
+ d.ellipse([x - 4, y - 4, x + 4, y + 4], fill=col)
+ d.text((x + 5, y - 5), name, fill=col)
+ d.text((W // 2 - 40, H - 14), title, fill=(0, 0, 0))
+ return img
+
+side = panel(1, 2, True, True, "side (from -X), head right")
+front = panel(0, 2, False, True, "front (from -Y)")
+top = panel(0, 1, False, False, "top (head at bottom, +X right)")
+W = side.width + front.width + 20
+H = max(side.height, front.height) + top.height + 20
+sheet = Image.new("RGB", (W, H), "white")
+sheet.paste(side, (0, 0)); sheet.paste(front, (side.width + 20, 0)); sheet.paste(top, (0, max(side.height, front.height) + 20))
+sheet.save(sys.argv[2])
+print(sheet.size)
diff --git a/tools/plot_heights.py b/tools/plot_heights.py
new file mode 100644
index 0000000..ece9ad4
--- /dev/null
+++ b/tools/plot_heights.py
@@ -0,0 +1,22 @@
+"""Plot joint heights over time as read in each view, to see lags and swaps between the two halves.
+
+python tools/plot_heights.py DET.npz out.png
+"""
+import sys
+import matplotlib
+matplotlib.use("Agg")
+import matplotlib.pyplot as plt
+import numpy as np
+
+d = np.load(sys.argv[1])
+names = [str(n) for n in d["names"]]
+keys = ["head", "hips", "tail_tip", "fpaw_L", "fpaw_R", "hpaw_L", "hpaw_R", "wrist_L", "wrist_R"]
+fig, axs = plt.subplots(len(keys), 1, figsize=(10, 2.0 * len(keys)), sharex=True)
+for ax, k in zip(axs, keys):
+ j = names.index(k)
+ ax.plot(-d["front_uv"][:, j, 1], label="front", color="#F53CD1")
+ ax.plot(-d["side_uv"][:, j, 1], label="side", color="#2F6BFF")
+ ax.set_ylabel(k)
+axs[0].legend()
+plt.tight_layout()
+plt.savefig(sys.argv[2], dpi=70)
diff --git a/tools/prep.sh b/tools/prep.sh
new file mode 100755
index 0000000..74cf1e3
--- /dev/null
+++ b/tools/prep.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# Once per creature, step 1: scale the mesh to real size and stand it on the ground, then draw side, front and top
+# views with a 10 cm grid (and rig.json's joints, if there is one) for placing the skeleton.
+# tools/prep.sh CREATURE reads assets/CREATURE/model.glb and creature.json "prep": length_m, rotz_deg, axis
+set -euo pipefail
+source "$(dirname "$0")/_env.sh"
+need_creature "${1:-}"
+a=assets/$1
+read -r len rot axis < <($PY -c "import json; p = json.load(open('$a/creature.json')).get('prep', {}); print(p.get('length_m', 1.0), p.get('rotz_deg', 0), p.get('axis', 'y'))")
+$BLENDER -b -P blender/prep_mesh.py -- "$a/model.glb" "$len" "$a/prep" "$rot" "$axis" | grep -E "^size|^saved|Error" || true
+$BLENDER -b -P blender/ortho_views.py -- "$a/prep/static.blend" "$a/prep/views" 300 | grep -E "^views|Error" || true
+rig=$a/rig.json; [ -f "$rig" ] || rig=-
+$PY tools/grid_views.py "$a/prep/views" "$a/prep/views.png" "$rig"
+echo "check $a/prep/views.png: the creature faces -Y (head to the right in the side view), feet on z = 0"
diff --git a/tools/rig.sh b/tools/rig.sh
new file mode 100755
index 0000000..009d0da
--- /dev/null
+++ b/tools/rig.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Once per creature, step 2: build the armature from rig.json, skin it with Blender's automatic weights, paint each
+# limb its colour, and render the two-camera reference frame the video model starts from.
+# tools/rig.sh CREATURE preview only the joints over an x-ray of the mesh (side, front, top), to check placement
+# tools/rig.sh CREATURE assets/CREATURE/rigged/{rigged.blend,rig_info.json}, runs/CREATURE/ref/ref.png
+set -euo pipefail
+source "$(dirname "$0")/_env.sh"
+need_creature "${1:-}"
+a=assets/$1
+if [ "${2:-}" = preview ]; then
+ $BLENDER -b -P blender/build_rig.py -- "$a/prep/static.blend" "$a/rig.json" "$a/prep/preview" preview > /dev/null
+ echo "joints over the mesh: $a/prep/preview/joints_side.png, joints_front.png, joints_top.png"
+ exit 0
+fi
+$BLENDER -b -P blender/build_rig.py -- "$a/prep/static.blend" "$a/rig.json" "$a/rigged" \
+ | grep -E "merged|without weights|smoothed|painted|saved|Error" || true
+$BLENDER -b -P blender/render_ref.py -- "$a/rigged/rigged.blend" "runs/$1/ref" | grep -E "Error" || true
+$PY tools/compose_ref.py "runs/$1/ref"
+echo "test pose: $a/rigged/testpose_front.png, testpose_side.png"
diff --git a/tools/show_samples.py b/tools/show_samples.py
new file mode 100644
index 0000000..08f7546
--- /dev/null
+++ b/tools/show_samples.py
@@ -0,0 +1,31 @@
+"""Compose dataset samples into the two-camera frame and draw their true joints, as one contact sheet.
+
+python tools/show_samples.py DATASET_DIR out.jpg [n]
+"""
+import json, pathlib, sys
+import numpy as np
+from PIL import Image, ImageDraw
+
+sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
+from mocap import layout
+
+d = pathlib.Path(sys.argv[1])
+metas = sorted(d.glob("*_meta.json"))[: int(sys.argv[3]) if len(sys.argv) > 3 else 8]
+tiles = []
+for m in metas:
+ meta = json.loads(m.read_text())
+ s = meta["scale"]
+ f = Image.open(str(m).replace("_meta.json", "_front.png")).convert("RGBA").resize((layout.W_FRONT, layout.H))
+ si = Image.open(str(m).replace("_meta.json", "_side.png")).convert("RGBA").resize((layout.W_SIDE, layout.H))
+ img = Image.fromarray(layout.compose(np.array(f), np.array(si)))
+ dr = ImageDraw.Draw(img)
+ for (u, v), (us, vs) in zip(meta["front_uv"], meta["side_uv"]):
+ dr.ellipse([u - 3, v - 3, u + 3, v + 3], fill=(255, 255, 0))
+ dr.ellipse([us + layout.W_FRONT - 3, vs - 3, us + layout.W_FRONT + 3, vs + 3], fill=(255, 255, 0))
+ dr.text((8, 8), f"{m.stem} blur={meta['blur']}", fill=(255, 255, 255))
+ tiles.append(img.resize((640, 360)))
+cols = 2
+sheet = Image.new("RGB", (640 * cols, 360 * ((len(tiles) + cols - 1) // cols)))
+for i, t in enumerate(tiles):
+ sheet.paste(t, ((i % cols) * 640, (i // cols) * 360))
+sheet.save(sys.argv[2], quality=88)
diff --git a/tools/stack_passes.py b/tools/stack_passes.py
new file mode 100644
index 0000000..5aa8f95
--- /dev/null
+++ b/tools/stack_passes.py
@@ -0,0 +1,12 @@
+"""Lay the solid skeleton pass over the x-ray ghost pass, frame by frame (blender/turntable.py bones mode).
+
+python tools/stack_passes.py DIR DIR/f_*.png (ghost) + DIR/sticks/f_*.png -> DIR/f_*.png
+"""
+import pathlib, sys
+from PIL import Image
+
+d = pathlib.Path(sys.argv[1])
+for g in sorted(d.glob("f_*.png")):
+ ghost, sticks = Image.open(g).convert("RGBA"), Image.open(d / "sticks" / g.name).convert("RGBA")
+ Image.alpha_composite(ghost, sticks).save(g)
+print("stacked", len(list(d.glob("f_*.png"))))
diff --git a/tools/train.sh b/tools/train.sh
new file mode 100755
index 0000000..7e2e767
--- /dev/null
+++ b/tools/train.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Once per creature, step 4: teach the joint reader (DINOv2 ViT-B/14 + a heatmap head) this one creature.
+# tools/train.sh CREATURE [epochs=20] [batch=20] -> runs/CREATURE/reader.pt, log in runs/CREATURE/train.log
+# About 20 min and 12 GB of GPU memory at batch 20. Prints the held-out error in layout pixels after each epoch.
+set -euo pipefail
+source "$(dirname "$0")/_env.sh"
+need_creature "${1:-}"
+$PY -m mocap.train "runs/$1/dataset" "assets/$1/rigged/rig_info.json" "runs/$1/reader.pt" "${2:-20}" "${3:-20}" \
+ 2>&1 | tee "runs/$1/train.log" | grep --line-buffered -E "val mean|saved|Error"