How to import a Skeletal Mesh FBX that has the skeleton, skin and animations? Flax imports one or another only

Question

I have a FBX that contains a skinned mesh, skeleton and animations, how to can I import everything from the same FBX with Flax?

Flax imports either one or another.

  • If I switch to Animation, the skinned mesh is gone.
  • If I switch to skinned mesh, the animation is gone.

This FBX is already battle tested in Godot, Unity and UE. Everything, including the animations, imported with default settings out of the box in those 3, because I made a prototype in all the engines using the same FBX, so there’s nothing wrong with my FBX.

I also tried with GLTF to no success.

Documentation

The documentation is not clear on this one. Because from one side it says you have to choose whether the model file is a Skinned Model or an Animation, but then at the same time it mentions that picking up Animation imports the mesh.

But it seems not to be the case?

I’m absolutely lost and confused as to what is supposed to be the 1st and most fundamental step of a game engine - importing meshes and animations - I feel dumb here :monkey_face: :monkey_face:. So please, any help is appreciated!

Details

I have the following mesh which has a skeleton and two animations that I exported to FBX:

But in Flax either I import skinned model:

Or the animation (but then even importing the animations do not work, neither of the 2 main animations are here):

What am I missing here?

Flax expects you to have different FBX files for each of the animations. That’s also how I worked with Unreal Engine.

1 Like

Also, is it possible that Blender isn’t exporting the animations due to the NLA track not being enabled?

1 Like

Yes, you I’ll have to import 2 time. One for model and the other for animation. In your animation if you set the preview model to be the model you want you should see the animation play.

1 Like

Thanks for the help! :grinning_face_with_smiling_eyes:

So in my case, where I have some industrial machinery where some of the FBX files have 25 animations, I have to export it 26 times (1x mesh + 25x animations). Even Godot handles this transparently and out of the box :stuck_out_tongue: I.e. drag and drop FBX/GLTF, done, model, skin, animations, collisions, all there.

Hopefully I will have another chance to play with Flax for another project then. Definitely not going through this madness for this current project, of splitting all my existing models.

If there’s a way to suggest features, this is definitely one to be suggested :slight_smile: Seamless/Compatible Skeletal Mesh import process, to make it easy for ones trying to migrate from Unity or Unreal.

The FBX is fine and has everything, I used the same file to make the same game prototype with the other 3 big engines.

Unfortunately, the only one yielding a problem with this FBX is Flax.

For example, here’s the same FBX in Unity:

Honestly, whenever I use Godot or Unity, their way of importing animations is so counter-intuitive to me. It’s just a lot easier to manage seperate animations files for me.

I don’t think this is a deal-breaker at all. Exporting those animation files separately should be a matter of minutes, if they’re all split correctly.

Can you elaborate more, please? Maybe I am missing something here.

For UE/Unity/Godot the workflow is:

  • Export from Blender to FBX once
  • Add FBX to the Unity/Godot/UE folder
  • Open the editor
  • Done.

Skeletal mesh, mesh and animations all there, ready to be used, dragged and dropped around.

Now if I understood correctly, Flax will require me at least 52 additional steps for a single file that has 26 animations:

  • Export each animation individually
  • Import and prepare each one into Flax

What if I change or add a bone? I’m screwed, I’d have to re-export ALL separate animations again, whilst if it’s inside a single FBX, I re-export a single file, done, reflected in the engine.

Anyway I’ll give a try with Flax for another game prototype :slight_smile: Really digging the feel of the editor!

The animation files are linked to the skeleton. I imagine they’d still work, unless you’ve been completely changing everything about the skeleton, but I’ve never tried to test that, so take that with a grain of salt.

Yes, this would be how to do it. Even in Unreal Engine, which supports importing everything at once, I’d still set up the animations separately. It becomes easier to manage down the road. For example, when changing a single animation, you don’t have to re-import the whole skeleton and all 26 animations down the road, and re-set them up, etc.

2 Likes

Also, BTW, welcome to the forums. :partying_face:

3 Likes

Thank you and thanks for your insights! I’ll see what I do around here. I may even write a Blender Python script to automatize the process.

3 Likes

Blender Script to Export NLA Strips as separate FBX files. I spent more time on this than actually exporting manually (there’s a xkcd for that: xkcd: Is It Worth the Time?).

import bpy
import os

# Path must be absolute, ex: c:/alfred/desktop/export
output_dir = "/path/to/export"

obj = bpy.context.active_object
assert obj.type == 'ARMATURE'

current_action = obj.animation_data.action

for track in obj.animation_data.nla_tracks:
   action = bpy.data.actions.get(track.strips[0].action.name)
   obj.animation_data.action = action
   start_frame = int(action.frame_range[0])
   end_frame = int(action.frame_range[1])
   bpy.context.scene.frame_start = start_frame
   bpy.context.scene.frame_end = end_frame

   output_file = os.path.join(output_dir, f"{track.strips[0].name}.fbx")
   bpy.ops.export_scene.fbx(filepath=output_file, use_selection=True, bake_anim=True, bake_anim_use_all_actions=False, bake_anim_use_nla_strips=False, bake_anim_use_all_bones=False, bake_anim_force_startend_keying=True, bake_anim_step=1.0, bake_anim_simplify_factor=1.0)

obj.animation_data.action = current_action

Usage

  • Paste into the Blender’s text editor
  • Set the output path
  • Select an armature that has NLA strips
  • Run script

imagen

imagen

3 Likes

Amazing work!

By the way, unfortunately, I gave up on Flax. Some of my animations have bones that drive blend shapes/morph targets. So when I export only the animation, the morph targets do not get exported alongside.

It’s never fair to compare engines, but as I said, in Godot, Unity and Unreal you just drag and drop the full FBX, it’s there, even the animations with blend shapes (and again I say, EVEN IN GODOT 3 which is kind of barebones for 3D)!

IMO, the 3D pipeline is not pleasing at all with Flax, it just complicates things.

Anyway, maybe for a simpler project I may give Flax a try in the future. For now, I’m done.

But other than that I love the premise of “Unreal and Unity had a baby” - this is like the perfect balanced engine! Plus no damn “Loading Assemblies” blocking the view all the time like Unity - I wonder when Unity is going to learn that there’s something called “asynchronous compilation” :stuck_out_tongue:

So the greatest point for me so far in Flax was quick C# recompilation without blocking the workflow! (and of course just like with Godot and Unreal, Flax also has the source-code available, which is something I like, since I always end up tinkering with the engine/editor code).

2 Likes

You can make a feature request on the github https://github.com/FlaxEngine/FlaxEngine. It would be cool to have an ImportAnimations check mark on the skinned model or model import settings that would import the animations as well (maybe it could somehow get how many animations it has from the FBX and add them to the import list or just populate the animation settings as well once the check mark is clicked).

3 Likes

Good idea, we already support importing materials and textures from model asset so maybe we could also extract all animations from skinned model file as well. I’ll add task for it on a roadmap.

4 Likes

That is going to really help streamline the workflow, awesome.