If you have an existing animation you can clone the animation and set the target to bones of another skeleton. This is essentially how retargeting is done in BabylonJS. However, this applies relative rotations not absolute rotations. This means if you are retargeting to a skeleton that has bones with different orientation and roll, they will rotate differently to what you expect.
I can demonstrate with this video where I show retargeting working as expected in Blender, then I show how it actually works with BabylonJS.
Another solution is to change the role/orientation of the bones to match the animation skeleton but as you can see in this old thread How to change roll of bone? - #21 by ozRocker no one can figure out how to do it.
So I’m wondering if anyone has manged to retarget like how it does in Blender.
I don’t know much about unity/unreal, but you can see in the video how Blender does it. Looks like its using absolute rotation but in BabylonJS its relative rotation
This is a good writeup from the godot engine. I believe ue4, unity, and three have similar models. three states in their docs their redesign is based on ue4 and unity. also, some, make some generalizations assuming its a humanoid model. I think blender rigify or one addon has pre-defined skeleton shapes for not only humans but also creatures. I think that could be an interesting expansion
Does anyone know how rotation info is stored in the GLB file? Is it relative rotation or absolute rotation? I have a feeling its stored as relative which is why the animation keyframes store relative rotation values
ah right. So I guess we can get global rotation by adding the local rotation to the bone orientation. Then the animation keyframes for rotation would now be global and applying that to a different skeleton would always yield the same result. But then the animation playback function would have to change to apply global rotations to the bones. This sounds simple in theory but maybe not possible to implement?
I’ve created a playground to demonstrate the problem. The worm on the left is the base and its animation is being copied to the worm on the right. The initial Y rotation of the target worm bone is 90 degrees different to base worm so after retargeting the target worm gets twisted. Can this problem be fixed if we use global rotation?
Isnt there issues with global transforms in large worlds though? I think those issues are especially relevant for the use case of avatars in an open world scenario, which seems to be one of the primary use cases.
So suppose you have an avatar in a large world at some xyz coordinate. If the transform is applied to these potentially numerically large global coordinates, as opposed to numerically small relative coordinates, it can cause issues. I vaguely remember an issue on github where three changed from relative to global some time ago and broke people.