Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(bake): pin that a Studio export carries no build without the server pass

nirholas94ae8d5b69b0
diff --git a/specs/PARAMETRIC_AVATAR.md b/specs/PARAMETRIC_AVATAR.md
index 44359f6fe..e83943086 100644
--- a/specs/PARAMETRIC_AVATAR.md
+++ b/specs/PARAMETRIC_AVATAR.md
@@ -81,6 +81,8 @@ The maths lives once, in `src/avatar-proportions.js`, and is dependency-free pre
`tests/bake-proportions.test.js` asserts the browser and server adapters produce bit-comparable bone locals on the real base. Invariants (rotations never written, feet stay grounded, root motion re-measured) are specified in [`AVATAR_PARAMETERS.md`](./AVATAR_PARAMETERS.md#proportions-build).
+**The server pass is what lands a build, on every path, including the one that looks like it does not need it.** Avatar Studio saves by exporting the live scene, which reads like proportions come along for free. They do not: `exportSceneGlb` calls `poseSkeletonsToBind` first so a clip caught mid-frame cannot be frozen into the file, and that resets every bone from the skin's inverse bind matrices, which a proportion edit deliberately never touches. The build is therefore absent from the exported GLB and is restored by the bake that follows the appearance PATCH. Same on `/avatars/:id/edit`, which never exports at all. If the export neutraliser changes, `tests/bake-proportions.test.js` is the test that says so.
+
### 3. Free sculpt (everything else)
`appearance.sculpt`. A radius-and-falloff brush that pushes vertices along their own surface normal, recorded as **one extra morph target per mesh**, named `customSculpt`, pinned at weight 1.
diff --git a/tests/bake-proportions.test.js b/tests/bake-proportions.test.js
index d6cc3f59b..1a23f34e2 100644
--- a/tests/bake-proportions.test.js
+++ b/tests/bake-proportions.test.js
@@ -210,3 +210,31 @@ describe('bake-proportions: end-to-end through bakeAppearance', () => {
expect(baked.y / plainHead.y).toBeCloseTo(1.1, 2);
});
});
+
+describe('bake-proportions: why the server pass is not optional', () => {
+ it('is the only thing that puts a build into a Studio export', async () => {
+ // Avatar Studio saves by exporting the live scene, which reads like
+ // "proportions come along for free". They do not. exportSceneGlb() calls
+ // poseSkeletonsToBind() first, so a clip mid-frame cannot be frozen into
+ // the file, and that resets every bone from the skin's inverse bind
+ // matrices, which a proportion edit deliberately never touches. The
+ // build is wiped out of the export, and only the server bake below puts
+ // it back. Change the export neutraliser and this is the test that says
+ // what else has to change with it.
+ const { poseSkeletonsToBind } = await import('../src/glb-bind-pose.js');
+ const { scene } = await loadThree();
+ const boneMap = canonicalBoneNodesFromObject(scene);
+ const hips = boneMap.get('Hips');
+ const leg = boneMap.get('LeftLeg');
+ const rest = { hips: hips.position.toArray(), leg: leg.position.toArray() };
+
+ applyProportionsToRoot(scene, { legLength: 1.15 }, { boneMap });
+ expect(leg.position.toArray()).not.toEqual(rest.leg);
+
+ expect(poseSkeletonsToBind(scene)).toBeGreaterThan(0);
+ for (let i = 0; i < 3; i++) {
+ expect(leg.position.toArray()[i]).toBeCloseTo(rest.leg[i], 5);
+ expect(hips.position.toArray()[i]).toBeCloseTo(rest.hips[i], 5);
+ }
+ });
+});