# Gltf thin instances require explicit negative x scaling

**URL:** <https://forum.babylonjs.com/t/gltf-thin-instances-require-explicit-negative-x-scaling/63886>\
**Category:** Bugs\
**Tags:** lite\
**Created:** [August 3, 2026, 7:02pm UTC](https://forum.babylonjs.com/t/gltf-thin-instances-require-explicit-negative-x-scaling/63886 "2026-08-03T19:02:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ComicSans](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/comicsans/32/19314_2.png) [@ComicSans](https://forum.babylonjs.com/u/ComicSans)\
**Post date:** [August 3, 2026, 7:02pm UTC](https://forum.babylonjs.com/t/gltf-thin-instances-require-explicit-negative-x-scaling/63886/1 "2026-08-03T19:02:56Z")

</div>

Observed: Even if the source gltf has (-1,1,1) scaling, the instance also needs (-1,1,1).

Expected: A thin instance transform would compose with the model transform, in the same way that a parent transform node would.

> **[Babylon Lite Playground](https://liteplayground.babylonjs.com/snippet/N601SI/v/3)**

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [August 4, 2026, 10:49am UTC](https://forum.babylonjs.com/t/gltf-thin-instances-require-explicit-negative-x-scaling/63886/2 "2026-08-04T10:49:01Z")

</div>

checking! thanks for reporting

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [August 4, 2026, 11:27am UTC](https://forum.babylonjs.com/t/gltf-thin-instances-require-explicit-negative-x-scaling/63886/3 "2026-08-04T11:27:49Z")

</div>

> <https://github.com/BabylonJS/Babylon-Lite/pull/525>
>
> Fixes the forum report: \[glTF thin instances require explicit negative X scaling…\](https://forum.babylonjs.com/t/gltf-thin-instances-require-explicit-negative-x-scaling/63886) (\[repro playground\](https://liteplayground.babylonjs.com/snippet/N601SI/v/3)).
> 
> \## Problem
> 
> \`createHierarchyInstancePool()\` baked \`rootWorld⁻¹\` into every binding:
> 
> \`\`\`
> instanceMatrix = meshWorld⁻¹ · M · rootWorld⁻¹ · meshWorld
> finalWorld = mesh.world · instanceMatrix = M · rootWorld⁻¹ · meshWorld
> \`\`\`
> 
> So the instance matrix \*\*replaced\*\* the template root's world matrix rather than composing with it.
> 
> A \`loadGltf()\` hierarchy's \`\_\_root\_\_\` node carries the RH→LH conversion as scaling \`(-1, 1, 1)\` (\`load-gltf.ts:350\`). Dividing it out mirrors every instance and inverts its winding, which is why the reporter had to pass an explicit \`(-1, 1, 1)\` scale just to get the model back to its authored orientation. A coordinate-system conversion is not user placement and must never be cancelled by an instancing helper.
> 
> \## Fix
> 
> Store \`meshWorld\` instead of \`rootWorld⁻¹ · meshWorld\`, so the stored per-mesh matrix is \`meshWorld⁻¹ · M · meshWorld\` and:
> 
> \`\`\`
> finalWorld = M · meshWorld
> \`\`\`
> 
> The instance matrix now behaves like a parent transform node above the hierarchy root — identity reproduces the template unchanged, and translations/rotations apply in world space on top of it. This is exactly what the existing unit test already asserted (\`expected = rootInstance \* mesh.worldMatrix\`); it passed only because that test's template root world was identity.
> 
> Also drops the now-dead root-inversion path and its \`"requires an invertible root world matrix"\` error.
> 
> \## Breaking change
> 
> \`addHierarchyInstance()\` / \`setHierarchyInstanceMatrix()\` matrices compose with the template hierarchy instead of replacing the root world matrix. Only affects templates whose root world is not identity (every glTF). Callers relying on the old semantics should pass \`matrix \* rootWorld⁻¹\`.
> 
> \## Validation
> 
> \- New regression test with a flipped glTF-style root (\`scaling (-1, 1, 1)\`): identity instance is a no-op, and a translated instance equals \`offset \* templateWorld\`. Verified it \*\*fails\*\* on \`master\` and passes with the fix.
> \- \`vitest run tests/lite/unit/hierarchy-instance-pool.test.ts\` — 5 passed.
> \- \`tsc -p packages/babylon-lite/tsconfig.json --noEmit\` and \`tsc -p tests/lite/tsconfig.json --noEmit\` clean; eslint clean on changed files.
> \- No scene or lab code uses hierarchy instance pools, so no parity/bundle-manifest impact (the change is net code removal).

Solves the issue - [Babylon Lite Playground](https://liteplayground.babylonjs.com/pr/525/snippet/N601SI/v/3)
