4
$\begingroup$

Usually videogames require you to create your NLA action tracks and export them as an @action_name.fbx (unity) individually, so the game engine will pick them up and apply that .fbx data only to the armature of the character in-game.

I am trying to accomplish the same thing in .gltf format. I have 2 animations in the NLA: Idle 1-150 Motion 1-250

I select my model in Blender 3.0, and mark with the star on the NLA track for the animation I want to export the .gltf with. But when I import the NLA action track in another application (I test it using Windows 3D viewer), the animation is not there.

I read the GLTF guidelines where it mentions I should put all my actions (one after another) in 1 NLA track to get them to be exported, but I can't get past the first stage which is to export the STARRED NLA track.

Please help. Thanks.

$\endgroup$
1
  • 1
    $\begingroup$ The star is completely ignored. Also you should put 1 action per track, not all actions in 1 track, that won't work. It can be hard to get glTF animations to export. $\endgroup$
    – scurest
    Jun 23 '21 at 14:52
4
$\begingroup$

The key to export .GLB and .GLTF actions from Blender's NLA has to do with the names of the NLA tracks.

  1. Create your rig and make sure you create a MASTER bone (bone with no transformations) at 0,0,0 of world position. Call it root. This bone is parented as father of the pelvis or whatever bone is the main center of gravity (COG) of your model.

  2. Animate your character. Create your action in the Timeline. (Blendshapes animations are always played in the main timeline when you export your .GLB / .GLTF file.)

  3. Switch to Dope sheet editorAction editor. Name your action and click on push down (or stash) to send the animation to the NLA editor.

  4. Open a new editor window set to NLA editor. Change the name of the NLA TRACK (this is very important) into the name of the action you just exported. To ensure you always match this name, name it all in lowercase.

    (I tested naming the action clip and the NLA track with "myaction 1-150", but placing numbers seem to throw off the exporter, and you'll get errors).

    You will also find serious export errors if anything in your rig has DRIVEN parameters. Make sure to bake-keyframe them or manually animate them BEFORE exporting to gltf.

    It's a good practice to previously save a file with all your drivers connected, and then another one "without drivers" before exporting to .gltf / .glb in case you need to correct something.

  5. Do name all your NLA tracks according to the name of the action clip in it and make sure you don't "star" any of them (all of them must be un-star-ed)

  6. Use the FILE→Export→GLB/GLTF menu entry and select your desired format from the top right selection dialogue. Also, target your texture directory (leave blank for relative path).

  7. You can test your model online with different viewers. I use this browser glTF viewer, which is done by one of the developers from the Khronos Group GLTF exporter addon for Blender

  8. Import into your game engine and check out the actions your Blender-rigged character now has. Animated blending shapes will be added or not, depending if you want to combine your animations in-game. Blendshape animations are always the top layer animation in .GLB/.GLTF format like you see in Blender.

$\endgroup$
2
  • $\begingroup$ There isn't really anything in this answer that isn't either (1) a basic Blender tool that users should probably know anyway in order to work with animations, or (2) described in the docs. Also, at least some drivers do get sampled correctly— You need to make sure they have a clean hierarchy: github.com/KhronosGroup/glTF-Blender-IO/pull $\endgroup$
    – Will Chen
    Jul 2 '21 at 12:59
  • 3
    $\begingroup$ You can say that now that has been resolved. It wasn't "that easy to follow, or basic, or described" until I researched for a week, and there were cases where all of the above wasn't even an idea. $\endgroup$ Jul 3 '21 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.