Hi there
I have problem when I want to set a skeleton of model to another model
I have a model generator that generate different avatar model with same shape
but I have problem there because my appending doesn’t work correctly
I want my avatar skeleton to be like this
https://playground.babylonjs.com/#H3ZMWM#8
but it works like this with another glb file
https://playground.babylonjs.com/#H3ZMWM#7
Hi,
If you clone a skeleton and attach it to a new mesh you need to retarget the matrices (indicies and weights) for the new mesh.
If it’s not problem Can you explain it more or change playground because I’m not understand you properly
Hi,
To understand how you can achieve this, you may look at the code I published. The code is made for me and my needs. It’s poorly documented and the code won’t work without modifications. Good luck
Here is the code I’m using to retarget an existing skeleton to a new mesh:
https://raw.githubusercontent.com/webgrid/glbtest/main/computeWeights.ts
Thanks for your answer
but I have question how you pass model.glb file to them
this code as I see, is related to compute weights
sorry is it possible to write it in a playground if you want of course
because i noob and don’t have a lot of knowledge about
This answer is providing a detailed way of doing it with a playground sample:
You might also find this post useful:
Those are quite hard topics but I guess a doc entry would be great @PirateJC, I can not find it back for @Drigax PG
thanks for your answer
but it dosent work for me i try a lot but in all case my model get depose like this playground
i dont know why this happened
do you have any idea?
Your meshes structure do look to be different that is the only think I can think of.
When you clone the skeleton you also need to retarget the bones and linkedTransform to fit with your new model.
Both of them generated with same engine using avatarsdk.com
sorry I’m noob at Babylon if it’s not problem can you show it inside playground
@DarraghBurke do you want to give it a go ?
If the mesh structures are not identical, you need to retarget the matrices, it’s not enough to retarget bones. You should check if a 3d modeling program like blender can assist you with that.
You could maybe try to use avatar sdk to re-create the models without the armature bone or with both of them having it. IDK if that’s the only difference, but the meshes have the same number of indices and verts at least and it looks like maybe that’s the crucial difference between their skeletons, so it might be worth a try…
I think this one might be a bit out of my depth Maybe someone who is more familiar with skeletons/animations could take a look? @Cedric do you have any ideas?
Sure! Let me take a look.
Let me try to summarize. You want to load superhero.glb
which is a skinned mesh with a skeleton. Then load model.glb
which is also a skinned mesh. then apply the skeleton and animation of model.glb
to superhero.glb
?
As you said, the hierarchy is the same. Did you also check the local matrices are the same? If both have the same hierarchy but not the same bind matrices, you will get an exploded mesh.
Can you try to display both skinned meshes with skeletonViewer
and see if you can find a difference of orientation ?
An example here:
https://playground.babylonjs.com/#1EVNNB#230
Also in your last PG, it kinda look like there is a right/left mismatch. Using the inspector, you can check a right hand in 1 skeleton is on the right on both meshes. If not, then, a name remapping will have to be done.