Merging GLB meshes & attaching skeleton mangles animations

Hello!
I was trying to figure out how to merge meshes when importing a GLB file.
The end goal is to bake animations and use thin instances.

I found this was successfully done by some of the guys in the forums.
However with my character, it just mangles the animations when attaching a skeleton to the merged mesh. The model animations are imported from Mixamo and put together with Blender.

Playground (Uncomment the merge line)

Questions:

  • Is merging the way to go?
  • If not, should I somehow bake the animations for each mesh?
  • If yes, what causes the mangling when attaching the skeleton? Rotation related?
1 Like

I wonder what is the final goal of this setup. Are you going to have a lot of copies of your avatar?

I will need a performant way to handle hundreds of characters on the screen, with unique animations. Using thin instances is the only way I can think of doing it.

You must delete the parent of all meshes before merging them, otherwise you’ll integrate the parent’s transformation into the data, interfering with the skeleton’s animation data:

Can we use thin instances on skinned meshes and apply animations to them? If so, I wasn’t aware of that. I thought using thin instances limited most of the functionality.

I was surprised but it works for Ready Player Me avatar - https://playground.babylonjs.com/#CP2RN9#145

There’s a small section about it in the doc:

1 Like

@Evgeni_Popov Hello, I got another question. Is VAT only supporting single animations or can it bake all the different ones together? I don’t seem to get how it works. My model got a bunch of animations but it’s only playing the first one. Is there some something I need to do with the animation groups?

The goal would be to play a different animation for each thin instance.

You simply have to set, for each thin instance, the start and end frame corresponding to the animation you want to play. See line 41 in this PG:

But it looks like in this example it’s only looping the first animation “shooting a bow”.

It’s not randomly selecting a new animation.

Sorry, I did not see it was the same animation.

You will have to bake all the different animations in the same VAT texture. You can have a look here to see how it can be done:

Look at the bakeVertexData function.

1 Like