Rendering FBX animations

I was wondering if anyone has had any success rendering animations from an fbx file in MonoGame?

I have found some microsoft cpuskinningpipeline projects for XNA and some samples using them in MonoGame, but I cannot get these to work properly. There is a custom content processor and some custom datatypes. Using these I get conflicts between XNA data types (e.g. Matrix) and MonoGame datatypes (again, e.g. Matrix).

How do developers currently deal with skinning and keyframe animation on 3D models?


This one I assume…

Our whole model system is pretty much based off that CpuSkinningPipeline sample. It does work with MonoGame.

The issue you’re seeing is that you are trying to link an assembly built against XNA to an assembly built against MonoGame. You can’t do that.

In this case I think the “CpuSkinningDataTypes” project is the one that is causing you the trouble. You have to make a copy of that that references the MonoGame assemblies and removes all XNA assemblies. That new project is the one you link to your MonoGame based game.

I was suspecting this conflict was the case, but have had trouble figuring out and compiling. Thank you for your answer, I will try your suggestion!

P.S.: And thanks for a great framework, fun to bring my old games back to life. I am actually preparing a presentation of MonoGame at my workplace =)


What about GPU Skinning?
I tried porting the SkinnedModelProcessor to MonoGame, but for some reason MeshHelper.FindSkeleton returns null (on XNA it found the skeleton in that same FBX file), I’ve looked at the code for FindSkeleton and it looks fine, so I think the problem might be with AssImp not properly loading BoneContent.
Any thoughts?

There is for sure still bugs and missing features for model processing with animation. We have been able to import some models correctly, but have had issues with others.

We’re still working on it… it has been pretty challenging.

That is possible. Could also be a setting importing the model with AssImp… or simply that we’re not extracting the bones from it correctly.

We can use some help with this, so if you figure out the issue submit a PR or let us know.

1 Like

I might look into it later, I’m not very experienced in FBX (I just messed around with a bunch of skinned models before for a project), but I can compare the Node trees generated by both importers (XNA’s and AssImp’s) and try to pinpoint where it goes wrong.
For the time being I’ll use XNA’s FbxImporter (it’s important that I get something working now).
I was wondering however if it’s possible to use XNA’s FbxImporter with MGCB (and Pipeline GUI), I tried adding references to Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll and its dependencies but MGCB failed to load the assemblies, I was hoping to copy these XNA DLLs into the project so that my coworker could build content too without installing XNA.

No worries… I took a look and I have it implemented already. Just testing some before committing it to the develop branch.

It wouldn’t be. You cannot mix assemblies from Microsoft XNA and MonoGame into the same process like that because we share the same namespace and type names.

1 Like

This is gonna take a little longer, but I am going to fix it. :slight_smile:

I am running into the same issue. I have thus far been using XNA to build FBX content, but I’m trying to switch over to MGCB.

So far, I’ve running with XNA-built content, but it seems problematic for textures referenced by the FBX. It has been working so far for Windows (DirectX 11), but I wager that I’ll run into issues when moving to OpenGL or other platforms.

Debugging through the import process, the data returned from AssimpContent.ImportFile() does include information about the skeleton, but because my file contains no frames of animation, it is skipping creating the BoneContent in OpenAssetImporter.cs, line 67:

            if (_scene.HasAnimations)
                var skeleton = CreateSkeleton();

I think that this conditional should be done away with, and FindSkeletonRoot() should be made to handle the non-existence of a skeleton.

Great, after your suggestions the CpuSkinningDataTypes project is building successfully. Now I am having trouble building the CpuSkinningPipelineExtensions project. I tried replacing the XNA references with MonoGame here as well, but I am suspecting some XNA assemblies are needed?