Given this PG and some effort, I have reached a blocker.
I am trying to use a base idle animation and superimpose with it a variable level of an emotional “meh” pose.
Could you please point me the right direction?
@Cedric @Evgeni_Popov
Given this PG and some effort, I have reached a blocker.
I am trying to use a base idle animation and superimpose with it a variable level of an emotional “meh” pose.
Could you please point me the right direction?
@Cedric @Evgeni_Popov
Could it have something to do with need the equivalent of an additive identity element or zero reference? I do notice that this model lacks such and initial reference frame.
I work on the same team as ArrayBuffer. I have updated the playground above to have a clearer demonstration of the problem. Please see the playground below. I am authoring the additive animation in Blender and exporting to a GLB file. Doing my best to follow the example illustrated in additive animation section of the BabylonJS doc: Additive animation blending | Babylon.js Playground (babylonjs.com)
The result of the additive effect doesn’t match that from the Blender side:
the following code was used to convert the particular animation to additive
// Initialize additive poses. Slice of reference pose at first frame var thinkingPoseAnim = BABYLON.AnimationGroup.MakeAnimationAdditive(scene.getAnimationGroupByName("thinking-add")); thinkingPoseAnim.weight = 1; thinkingPoseAnim.start(true, 0.2, 1, 1, true);
Your code looks good, so it’s probably a problem on the export side.
cc @PatrickRyan in case he can help.
@llvir, can you share the Blender file with us so that we can take a look at the file setup and export as well, please?
@llvir, from a quick glance at the files you sent, the glb is showing a bad export on the additive animation states. I got the same when exporting again from blender, so the problem lies in how the mesh is set up. I need to dig in more as Blender isn’t my main tool and so I can’t do a sight read of what may be wrong. But you can see from dropping the glb in the sandbox that the states are not what you authored. Here’s the idle state:
And the meh-add state:
and the thinking add state:
There is obviously something happening on export. Maybe a modifier that needs to be baked in. I would first start there and see what may be causing the problem on export. The sandbox is a great tool for testing that.
Thanks Patrick.
I managed to get one of the Blender authored additive animations to work in BabylonJS Playground. The others are still not working. I need to backtrack a bit to see what made it work and keep at it.
Hi @PatrickRyan
May I ask which software other than Blender that you and your team used to author the additive animations? I have been experimenting between quaternion and XYZ euler for the armature bone rotations. So far the euler rotation seems to produce more favorable results in the playground. I also noticed that BabylonJS only process the additive animations when there are atleast two frames of data; frame 0 stores the reference pose (bind pose?) while the actual additive pose is on the next frame.
@llvir, I am primarily a Maya user, but we have others on the team who use Blender. I have just used Maya for so many years that it’s faster than Blender for me because I’m so used to the patterns in Maya.
In terms of how I would author additive animations, I would definitely not use super short sequence lengths due to optimization when exporting to glTF. I don’t have visibility into what the Blender exporter is doing, but I know that our Autodesk exporters do try to optimize animation curves to remove redundant keyframes. So if you bake the same value every frame, we ty to remove keys in the middle of the sequence which don’t change the value but take up space in the exported file. This is to keep the file size minimal.
With this in mind, I would always opt to use a longer sequence just to make sure that any unexpected optimization does not occur. Saving an animation sequence with one frame may fall into an edge case that the engineer who wrote the exporter did not consider.
The other thing that can be done, if you know that the additive animation is very simple and on a simple rig is to build that additive animation directly in Babylon if you are worried about file size. A Babylon animation can be used as an additive animation pointing at any transform or bone. Again, I would only do this on very simple animations like in your example, not on something complex like a character.
In terms of quaternion versus euler animation, I would always use euler animation for additive clips. The reason is that quaternion will always rotate along the shortest path between two vectors, where euler can be authored to rotate in any specific path. If you are adding two quaternion rotations, the path of shortest rotation is what you will get, and that could change based on the specific conditions making authoring in isolation tricky. Euler rotation is very prescriptive in terms of rotation and can be authored to take the most indirect path, but at the same time is very predictable and thus easier to author an additive animation for an euler rotation.
Thanks, I guess my suspicion was correct on switching over to euler. What threw me off was Blender defaults to quaternion for bone rotation upon skeleton (armature) creation and importing from glb files. I finally got a simple test scene to work as expected, but not the model in question. I’ll keep at it.