Glitch in skeletal meshes (affected by camera position)

Found an interesting bug if mesh.computeBonesUsingShaders = false and mesh.skeleton = null

If I load this scene using the default camera creator, the meshes scale normally

scene.activeCamera.attachControl(canvas, false);


However, the same code causes some of the meshes to glitch (i.e. not rescale correctly) if the camera is initialized differently.
Case in point: the hair and arm pads of this character model scale differently from the main body, which is weird because the only code difference is the camera position

Here’s the PG (it contains a flag to compare those two different camera initializations)

Btw I’m using mesh.computeBonesUsingShaders = false and mesh.skeleton = null to unbind a skeleton without changing the underlying mesh scale

If there’s a better solution, do let me know! I’m following the solution in this thread, but not sure if it’s the best way

This is working as intended, when using the default camera it frames automatically. if not, you need to correctly position it.

1 Like

To complete what @sebavan said: The problem is that bones are not selected in the renderlist when the camera is too close (because of frustum clipping)

One solution is to move the camera away:
Examples: Load glTF model | Babylon.js Playground (

Other solution is to force all meshes to be in the render list:
Examples: Load glTF model | Babylon.js Playground (

1 Like

Oh awesome, had no idea alwaysSelectAsActiveMesh was used this way
Thanks a lot, this helps!!

@Deltakosh does that mean I no longer need to run mesh.refreshBoundingInfo if mesh.alwaysSelectAsActiveMesh = true?
Based on testing it seems that way but just wanted to be sure
EDIT: I suppose refreshBoundingInfo is still needed for things like picking etc

Yup you could keep it for picking if you need it :slight_smile: but not usefull in the rendering only case.

1 Like