Replacing PBR material with standard material on a gltf model will lead to broken rotation and scaling.
Hi! Thanks for the clear repro ![]()
This isnāt a rotation/scaling bug - itās a missing feature. The Xbot.glb
model is a skinned (skeletal) mesh, and in Babylon Lite the skinning
(the bone transforms that pose each vertex) is handled inside the materialās
vertex shader.
Right now:
- PBR material has the skinning path built in, so the character poses correctly.
- StandardMaterial doesnāt have a skinning path yet - so when you swap the
PBR material for a StandardMaterial, the bone transforms are simply no longer
applied. The vertices render in their raw positions, which looks like broken
rotation and scaling.
So itās not that StandardMaterial gets the math wrong - it just doesnāt do
skinning at all yet. Thatās why your second (untouched) copy of the model looks
fine while the swapped one doesnāt.
Two ways we could go from here:
- Add skeletal skinning support to StandardMaterial so it works with skinned
models too. - At minimum, log a warning when a StandardMaterial is used on a skinned mesh,
so itās not a silent surprise.
CC @Deltakosh (when you are back
) - what do you think? Worth adding skinning to StandardMaterial in Lite, or should we keep Standard lightweight and just warn?
Hereās a PR to track: feat(standard): opt-in deform features (skeleton/vertex-color/uv-offset) + dynamic fog by PatrickRyanMS Ā· Pull Request #338 Ā· BabylonJS/Babylon-Lite Ā· GitHub, which contains skinning support for StandardMaterial. ![]()
Yes Iām adding it today or tomorrow
Ok just saw that @PatrickRyan started it ![]()
Iāll push it to the finish line today!
I see the PR is merged. Thanks for the huge work ![]()
Will enableStandardSkeleton, enableStandardUvOffset, enableStandardVertexColors be exported as well?
Oh yeah I forgot. Please do a PR to export them! iāll merge it
Sure, here it is:
merged!