Lite: Standard material on gltf model causes broken rotation and scaling

Replacing PBR material with standard material on a gltf model will lead to broken rotation and scaling.

Hi! Thanks for the clear repro :folded_hands:

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:

  1. Add skeletal skinning support to StandardMaterial so it works with skinned
    models too.
  2. 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 :slight_smile: ) - 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. :slight_smile:

Yes I’m adding it today or tomorrow

Ok just saw that @PatrickRyan started it :smiley:

I’ll push it to the finish line today!

I see the PR is merged. Thanks for the huge work :grinning_face_with_smiling_eyes:

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!