Missing animations in Blender -> babylon export

I have a rigged model with armature in blender that I’m trying to export for use with Babylon. Using the Blender to babylon exporter (version 6.4.5), I’m not seeing any of my animations / actions exported.

There are two actions, both named after the mesh they are animating, and I have “Only currently assigned actions” unchecked. All transforms are applied to the model and armature, so I don’t believe that to be the issue.

When I export to gltf / glb the animations show up correctly, however that comes with it’s own baggage, such as needing to switch to a right handed coordinate system and having the “root” mesh added everywhere.

Attached here is the blend, babylon, and gltf files as well as the blender export log.

model.zip (261.6 KB)

Not quite sure what I’m missing, but any insights anyone has would be appreciated.

Adding @JCPalmer our blender -> babylon GURU :slight_smile: he is amazing at it and thanks to your files it should be easier to repro.

Please, be mindful than it is vacation period so there might be a slight delay before the answer.

@JCPalmer I keep learning from your answers and I hope one day I ll be able to help better than a ping :slight_smile:

The log file shows 2 animation on the legs, idle and walk:

processing begun of mesh:  legs
	animation processing begun
		processing action idle:  in[1 - 60], out[0 - 60]
		processing action walk:  in[1 - 24], out[70 - 94]
	processing begun of material:  legs
	registered as also a user of material:  legs
	num positions      :  1104
	num normals        :  1104
	num tangents       :  0
	num uvs            :  2208
	num uvs2           :  0
	num colors         :  0
	num triangles      :  368
	Skeleton stats:  
		Total Influencers:  1984
		Avg # of influencers per vertex:  1.7971
		Highest # of influencers observed:  3, num vertices with this:  80
		exported as 3 influencers
		num skeletonWeights and skeletonIndices:  4416

If you are talking about them not being run in the sandbox, that has to do with the sandbox only supporting armature based animations when the file format is .GLB. Unless you can start these with the inspector inside the sandbox, to see them for a .babylon, you will need to make a page, which loads the file, then starts them.

I do not really use Sandbox all that much, & I have my own animation system / custom exporter, so I really do not do this. The animations are there though.

2 Likes

Yeah, the animations are there and I can see the separate ranges for the separate animations, but when I start them in the inspector, nothing happens.

Also in game, when I call mesh.beginAnimation or scene.beginAnimation and pass in the range, nothing happens.

Once again, this all seems to work fine with gltf/glb, however I wasn’t aware of the different behavior in the sandbox for glb files, so I may be missing something else.

@Tim_Shannon : Well, I’m no expert when things go wrong, I leave that to @JCPalmer, but I have a few observations that may indicate something to JCP.

I opened your .blend file in Blender 2.90 and looked at the armature and looked at the animation associated with it and it includes something from the NLA editor. I’m not sure what impact this has on the exporter. I was never part of the exporter, I believe.

Looking at the .log file I see this at the end of the armature processing:

processing begun of bone: Bone.027, index: 26
processing begun of bone: IK.003, index: 27
processing begun of mesh: body

from your file, whereas when I export an animated rigged object I get something like this :

processing begun of bone: Toes.R, index: 25
Ignoring IK bone: leg.L.IK
Ignoring IK bone: leg.R.IK
Ignoring IK bone: arm.L.IK
Ignoring IK bone: arm.R.IK
processing action mouthAction: in[1 - 30], out[0 - 30]
processing begun of mesh: Trigger

Notice the line about processing the action. Missing in your log.

When I look at the .babylon file from your .blend file I see this kind of data under the skeleton:

{“name”:“Bone.001”,“index”:0,“matrix”:[0.9537,-0.1402,0.2661,0,0.1455,0.9894,0,0,0.2633,-0.0387,-0.9639,0,0.3166,0.4003,0.3031,1],“rest”:[0.9537,-0.1402,0.2661,0,0.1455,0.9894,0,0,0.2633,-0.0387,-0.9639,0,0.3166,0.4003,0.3031,1],“parentBoneIndex”:-1,“length”:0.1132
,“animation”:{“dataType”:3,“framePerSecond”:24,“keys”:,“loopBehavior”:1,“name”:“anim”,“property”:“_matrix”}},
{“name”:“Bone.002”,“index”:1,“matrix”:[0.971,-0.207,0.12,0,0.2343,0.924,-0.302,0,-0.0484,0.3214,0.9457,0,0,0.1132,0,1],“rest”:[0.971,-0.207,0.12,0,0.2343,0.924,-0.302,0,-0.0484,0.3214,0.9457,0,0,0.1132,0,1],“parentBoneIndex”:0,“length”:0.261
,“animation”:{“dataType”:3,“framePerSecond”:24,“keys”:,“loopBehavior”:1,“name”:“anim”,“property”:“_matrix”}},

With no animation data associated with any of the bones. I normally expect to see something like this with data for individual bones :

{“name”:“hip”,“index”:0,“matrix”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5671,0.0815,1],“rest”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5671,0.0815,1],“parentBoneIndex”:-1,“length”:0.2496
,“animation”:{“dataType”:3,“framePerSecond”:24,“keys”:[
{“frame”:1,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5671,0.0815,1]},
{“frame”:2,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5667,0.0822,1]},
{“frame”:3,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5655,0.0841,1]},
{“frame”:4,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5636,0.0872,1]},
{“frame”:5,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5611,0.0914,1]},
{“frame”:6,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5579,0.0966,1]},
{“frame”:7,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5542,0.1026,1]},
{“frame”:8,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.55,0.1095,1]},
{“frame”:9,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5453,0.117,1]},
{“frame”:10,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5403,0.1252,1]},
{“frame”:11,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.535,0.1339,1]},
{“frame”:12,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5294,0.143,1]},
{“frame”:13,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5236,0.1524,1]},
{“frame”:14,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5177,0.1621,1]},
{“frame”:15,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5117,0.1719,1]},
{“frame”:16,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.5056,0.1818,1]},
{“frame”:17,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4996,0.1916,1]},
{“frame”:18,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4937,0.2013,1]},
{“frame”:19,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4879,0.2107,1]},
{“frame”:20,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4823,0.2198,1]},
{“frame”:21,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.477,0.2285,1]},
{“frame”:22,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4719,0.2367,1]},
{“frame”:23,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4673,0.2442,1]},
{“frame”:24,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4631,0.2511,1]},
{“frame”:25,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4594,0.2571,1]},
{“frame”:26,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4562,0.2623,1]},
{“frame”:27,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4537,0.2665,1]},
{“frame”:28,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4518,0.2696,1]},
{“frame”:29,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4506,0.2715,1]},
{“frame”:30,“values”:[1,0,0,0,0,1,0,0,0,0,-1,0,0,0.4502,0.2722,1]}],“loopBehavior”:1,“name”:“anim”,“property”:“_matrix”}},

All your animation data ends up in something called “animations” at the end of mesh data for legs - not associated directly with the skeleton?

So is that NLA stuff causing this ? Maybe JCP knows? (See image below)

Do you have a .blend file without all the NLA stuff?

Stay Safe All, gryff :slight_smile:

NLA01

1 Like

Hm. I was under the impression that the NLA stuff was just a result of creating actions in the action editor. I’ll see if I can remove them and still preserve my actions.

Also, FWIW, the sandbox (and my code) shows an error when trying to play the animation:

Uncaught TypeError: Cannot read property 'frame' of undefined
    at new RuntimeAnimation (dataReader-16bc64e5.js:114)
    at Animatable.appendAnimations (dataReader-16bc64e5.js:1751)
    at Scene.beginAnimation (dataReader-16bc64e5.js:2018)
    at Scene.beginAnimation (dataReader-16bc64e5.js:2024)
    at Scene.beginAnimation (dataReader-16bc64e5.js:2024)
    at Mesh.Node.beginAnimation (node-9c7d6999.js:1196)

An image from something I created with an animation (sitAction) with the armature opened - shows no NLA stuff!

Stay Safe, gryff :slight_smile:

Yep, looks like the NLA stuff is from me pushing down and stashing actions in the action editor.

Attached is a new version of a blend without the NLA. I no longer get the error, but now I get no animations in engine.

no_nla.zip (148.8 KB)

I’ll keep messing with this. I appreciate your help in troubleshooting.

TY @Tim_Shannon. I will have a look later tonight - - it is supper time for me :wink:

I try to help when I can - @JCPalmer is the coder though not me. And he may have more detail :slight_smile:

Stay Safe, gryff :slight_smile:

On mobile, so just a short peck. The armature has the animation, not mesh. Something like

Mesh.skeleton.startAnimationRange(‘walk’)

After renaming the animation from legs-idle to idle, the animation range seems to have exported successfully

spider.zip (194.4 KB)

3 Likes

But then you can only have one animation right? My understanding (and maybe it’s out of date) is that if you want multiple animation ranges you need to define actions in blender and name them <mesh>-<range-name> and uncheck Only currently assigned actions.

So according to this the mesh has the animation, maybe that’s the issue?

console.log("mesh: ", mesh.animations);
console.log("skeleton: ", mesh.skeleton.animations);
mesh:  (3) [Animation, Animation, Animation]
skeleton:  undefined

The same seems to be true for the animation ranges

mesh:  (2) [AnimationRange, AnimationRange]
skeleton:  []

I’m going to rebuild the armature and animations from scratch, see if I can figure out where I messed up.

Your assumption about the action name is not true. You only need to prefix the name of action with the name of the mesh when there are multiple meshes with current action, AND you wish a specific Action to only apply to a single mesh.

You do not have an action on any meshes. It is on the skeleton. Probably why removing it got the the result @gbz has shown. I would check out what he did.

2 Likes

Thanks, I think I’m getting close. Should actions be associated to the mesh or the armature then? Both?

@Tim_Shannon : if you have two objects (two cubes, say) that are unrigged and you want to give each one a different action (just one) then use the action names like this :

Cube1-Action1
Cube2-Action2

If you just create Action1 and Action2, then both will be applied to Cube1 and Cube2

In your case you have a rigged set of meshes, and as @gbz points out the “mesh-” is screwing up your export. And as @JCPalmer points out above with an armature the armature is being animated not the mesh.

In fact removing the “mesh-” from the names in your original file (with the NLA stuff) produces a fine working creature in the sandbox. Two animations (see image below)

Stay Safe All, gryff :slight_smile:

1 Like

Thanks for the help everyone.

@Tim_Shannon : Just one more point/suggestion, you should probably have a “central” bone of some kind that is the parent to all those first leg bones (bone.001, bone.008, bone.015, bone.022 which have no parent) so that if you wish to move the whole “spider” in X,Y,Z directions it is easy.

Stay Safe, gryff :slight_smile:

1 Like

Yeah adding a central bone also helps the walking IK bones influence the whole model appropriately, however now I seem to have an issue where the body disconnects from the legs during animation.

model.zip (255.5 KB)

Once again this all exports fine to gtlf. My workflow doesn’t seem to mesh well with what the babylon exporter is expecting.