Blender3D animations using actions in babylon.js "NonLinealAnimation" "ExportOficial" ".babylon"

Hello everyone, I’m testing animations in Blender3D, for example in this case I have 3 separate animations.
Each track is represented in the action editor as a separate animation.
Watch this video.



As it says in the documentation, each animated object has to be a different scene, in this code it is seen that I have the imported scene inside another imported scene.

I would be interested to know how to access each animation separately or together. Some documentation or something to guide me, I can’t figure out how to access the animations exported with the official plugin “.babylon” using blender3D actions.

I made this project in the playground, the imported cube has the actions created in Blender3D with the animations.
https://playground.babylonjs.com/#4L7DY6#2

An important issue is that the gltf2 if animations work in the sandbox.
I leave the gltf and .babylon files. to drag in the sandbox
cuboAnimado.glb.zip (5.6 KB)
cuboAnimado.babylon.zip (180.3 KB)

Here are the actions

adding @JCPalmer the mastermind behind the blender exporter

1 Like

We await your responses then.

@Ariel_Gimenez : I downloaded your .babylon file above - it contains no animation.

{“producer”:{“name”:“Blender”,“version”:“2.82 (sub 7)”,“exporter_version”:“6.4.2”,“file”:“cuboAnimado.babylon”},
“autoClear”:true,“clearColor”:[0.0509,0.0509,0.0509],“gravity”:[0,-9.81,0],“environmentTexture”:“lysGenerated_sunset.env”,“isPBR”:true,“environmentTextureRotationY”:0.8727,“createDefaultSkybox”:true,"skyboxBlurLevel ":0,
“materials”:[{“name”:“rojo”,“id”:“rojo”,“customType”:“BABYLON.PBRMaterial”,“backFaceCulling”:true,“checkReadyOnlyOnce”:false,“maxSimultaneousLights”:4,“environmentIntensity”:1,“reflectivity”:[0.5,0.5,0.5],“roughness”:0.1,
“alpha”:1,“transparencyMode”:0,“alphaCutOff”:0.4,“metallic”:0.8,
“albedoTexture”:{“name”:“rojo.jpg”,“level”:1,“hasAlpha”:false,“coordinatesMode”:0,“uOffset”:0,“vOffset”:0,“uScale”:1,“vScale”:1,“uAng”:0,“vAng”:0,“wAng”:0,“wrapU”:1,“wrapV”:1,“coordinatesIndex”:0,
“base64String”:"data:image/JPEG;base64,

[image data here]

“multiMaterials”:,
“skeletons”:,
“meshes”:[{“name”:“CuboAnimado”,“id”:“CuboAnimado”,“materialId”:“rojo”,“billboardMode”:0,“position”:[0,11.0088,2.7401],“rotation”:[0,-0.7037,0],“scaling”:[1,1,1],“isVisible”:true,“freezeWorldMatrix”:false,
“isEnabled”:true,“checkCollisions”:false,“receiveShadows”:false,“pickable”:true,“tags”:“”
,“positions”:[-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,1,-1
,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,-1]
,“normals”:[-1,0,0,-1,0,0,-1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0
,0,1,0,-1,0,0,0,0,1,1,0,0,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0]
,“uvs”:[0.625,0,0.375,0.25,0.375,0,0.625,0.25,0.375,0.5,0.375,0.25,0.625,0.5,0.375,0.75,0.375,0.5,0.625,0.75,0.375,1,0.375,0.75,0.375,0.5,0.125,0.75,0.125,0.5,0.875,0.5,0.625,0.75,0.625,0.5,0.625,
0.25,0.625,0.5,0.625,0.75,0.625,1,0.375,1,0.375,0.5,0.375,0.75
,0.125,0.75,0.875,0.5,0.875,0.75,0.625,0.75]
,“indices”:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,0,18,1,3,19,4,6,20,7,9,21,22,23,24,25,26,27,28]
,“subMeshes”:[{“materialIndex”:0,“verticesStart”:0,“verticesCount”:29,“indexStart”:0,“indexCount”:36}]
,“instances”:}
],
“morphTargetManagers”:,
“cameras”:,
“lights”:,
“shadowGenerators”:
}

I see from your second post that you are using the NLA editor - which I believe the exporter ignores. @JCPalmer can confirm this?

Stay Safe All, gryff :slight_smile:

Ok, thank you very much for taking the time to test it, of course the issue is when animations are separated into actions and I use the official exporter of babylon.js.

You can call each Blender action in BJS terminology an AnimationRange, where you supply the name of the action

There is some documentation where they explain in more detail how to use the Blender3D actions in babylon.js … I mean, I did this, but I don’t understand how to start the animations.

For skeletons: doc

skeleton.beginAnimation("Walk");

For Mesh, Lights & Camera implemented at Node super class: doc

mesh.beginAnimation("Rotate");
1 Like

Okay thank you very much. And since I can check if the animations exist, the problem is that when I use the official babylon plugin, I don’t see the animations, instead if I export in glb format, if I see them … Is there any option that allows me to export all the actions from blender3D ?. My idea is to use the official plugin. In this video you can see that with GLB you can see animations, but with babylon you cannot

Post your log file. It shows all animation ranges exported.

@JCPalmer
Ok, I have this cube with 3 actions, one of movement, another of rotation and another of scale


I export in .babylon format, but when uploading it to the sandbox it does not recognize the animations, I can see that the plugin does not export the animations

On the other hand, if I export in gltf2, if I export the animations.

The issue is that I want to continue using the official plugin since it has options that the gltf2 does not have. I also want to get involved in the development of the plugin, but I still lack knowledge.
Is there an option in the plugin that allows us to choose the tracks that we want to export or something like that?

This is the file that I just used in those videos.
cuboAnimadoMultiTrack.zip (1.8 KB)
This is what the console says when exporting that model

And here is the blender file I mean the .blend…Open with Blender 2.82
CuboAnimado.blend.zip (82.5 KB)

@JCPalmer
In this way the exported tracks appear, however they still do not work.
It seems to me that the .babylon exporter doesn’t export blender3D actions correctly.


Captura de pantalla_2020-07-09_19-57-44

The animations in the sandbox do not work either.
And this shows the console when it’s just actions.
Captura de pantalla_2020-07-09_19-55-59

You do not actually have an actions, made by the action editor, in your file. If you went to a dope sheet, then chose the action editor and hit new, then changed the name to ‘MyAction’.

You would get an action in the log, and the data in the file. I did not actually create any frames, but even then got a note of this in the log. You are adding tracks, not actions. That is not supported. Blender does things multiple ways for many things, not all of them are supported by anyone.

	processing begun of mesh:  Cube
		animation processing begun
			WARNING: action MyAction has no frames, ignored.
		processing begun of material:  CuboAnimado.Material
		num positions      :  30
		num normals        :  30
		num tangents       :  0
		num uvs            :  60
		num uvs2           :  0
		num colors         :  0
		num triangles      :  12

Some other things before you hit them. If you are having multiple actions, and you want more than the current one exported, you need to ensure you indicate so in world properties.

If you have both multiple actions and multiple meshes with animation, and some of the animations are specific to certain meshes, put the name of the mesh + ‘-’ + name as the name of the action, so it only gets exported for that mesh. e.g. 'mesh35-run '.

Finally, you are showing Animation Groups in the inspector. BJS decided to create them instead of using Animation Ranges when they added GLTF. Why, I do not know. If you want to check that they are at least there are there outside of the log file, without code, check 'Auto Launch` in world properties, and bring up in the sand box. You will get one combined animation, which will probably look terrible, but this is just a test.

3 Likes