[SOLVED] Animation and fbx

I’ve just about got everything working now from porting to mg from xna. The only thing left is animation.

Im using my own content processor based on an old xna project someone made called better skinned. My animations worked great in xna. I could loop, change speed, rewind etc.

After porting it to mg they still sort of work except it looks like the model is starting in its binding position (t pose). Rather than the first keyframe.

I tried exporting from 3ds and xsi and using the fbx convertor.

I also tried kosmonauts modelviewer which is nice and it plays my animations with the same problem.

Has anyone gone through this problem already and knows what tweak i need to make?

can you start the animation at the second keyframe? Maybe the t-pose is saved as a 1-keyframe animation in front?

You might be on to something there. If I run it side by side (XNA vs MG) the same code has 2 more bones in the MG version. The 2 bones have a keyframe set as nothing. That could well be the problem. I’ll have a fiddle around and see if i can get it to ignore these or see if that’s the problem at least.

Removing those 2 extra bones didn’t change a thing.

I guess I’ll try to make a new simple animation (rather than a whole human skeleton) and see if I can get that to do anything sensible.

Out of curiousity I copied the xnb from the animated model from my old xna content bin folder to the monogame one. Still has the same problem (animated but strangely kinda stuck in bind pose).

I’m stuck on this. I’ll come back to it since there are still plenty of other things to fix since moving to MG.

Does anyone have an fbx with an animation in it (that works in kosmonauts modelviewer or another mg implementation of betterskiinned) in they could let me have a play with? It would be much appreciated.

if I remember correctly @nkast has a pretty robust animation implementation, maybe he can help

1 Like

Thanks for the fish. I tried it in my games version of betterskinned and in your modelviewer.

Im my game engine it was just invisible. I tried scaled it up but nothing.

In the model viewer it just “failed to load”.

Ive tried making a basic wooden block man with 1 simple leg and arm wave animation and that just warps strangely.

Not getting very far with animation in mg so far. Luckily my xna project only had a few animations like rest, run, shoot, die so im not too bothered about recreating them i just need to know what the new “rules” are in mg compared to xna.

I don’t mind sending someone my fbx and they could maybe tell me what is wrong with it.

Everything else is working nicely in MG now except animation.

I’ve gone back to basics and created a model which consists of 3 joined cubes with a bone in each and made a simple animation with 3 keyframes of it just wiggling over to the left. Exported that and it works just fine…

So there must be something MG doesn’t like about my more complex models. Once I figure it out i’ll let you all know, maybe it will help someone else.

It’s really nice how fast MG compiles and runs my game compared to XNA and it somehow looks a bit better too the edge between my terrain and sky looks more crisp for some reason. Maybe some dx change. Anyway that’s completely Off topic.

Having a couple of simple animations that demonstrate the problem would be helpful to fix this. if possible we could add those in the tests.

One issue I found is that the importer converts NodeContent to BoneContent while XNA was moving all animations to the root.

I manage to fix this type of issues in the processor with this code.

Other incompatibility between XNA/MG I think it’s that XNA removes any bones with no animation, those that are =Identity for all keyframes (or have no keyframe or a single keyframe).

And also an issue that has been reported here in the past, FBX with no mesh but with a Skeleton/Animation are ignored.

any solution to solve the issue when FBX with no mesh with skeleton animation?

Ok i’ve narrowed it down a bit. I’ve made a simple block man with 3 bones made him kinda nod and that works perfectly (in my engine and in kosmonauts veiwer). I then used one of my peasant models and put the bones and made him do the same nodding animation and it doesn’t work. It seems strangely offset somewhere when the animation plays.

In XNA both are fine but that’s not really that relevant.

Here’s a link to a zip of both models. If anyone could work out the difference is that makes one work and the other not it would be much appreciated.

Something to do with the origin of the root bone or something? All of it seems exactly the same (except for the complexity of the model) to me.


Well I got i’ve got animation working again. My game’s avatar is now has his materials and does a basic nodding animation.

Problem is i’m not even entirely sure what i did differently. I made sure the parent mesh’s origin was 0,0,0 and the scale was 0,0,0 and the rotation was 0,0,0. Then i just added the simple spine i gave him to a keyset and stuck in a few keyframes… export fbx with standard settings (apart from selecting embed textures) and it’s working just fine.

I’ll try giving him his proper skeleton when i get time and get him doing a tolerable run animation. I was never intending to do the animation myself anyway, I just want it to work at all.

Hmm nope it’s not solved in fact. I’ve spent a large frustrating portion of my weekend trying to get my main avatar to move his arms in a casual gentle swinging resting post.

After endless variations or enveloping, rigging, keying etc i’m still not getting consistant/useable results.

I even tried buying a couple of cheap ‘game ready’ animated models from a model website and nope those don’t work either.

Does anyone have animated fbx’s working nicely in their projects and could give me a tip or two?

(Ive tied using kosmonauts model viewer and it gives the same weird results as mine engine does - probably because they’re both based on BetterSkinned)

I can get on with making the rest or my game i guess but its annoying that i can’t use my animations that worked in xna.

Help please!!

If anyone has a similar problem (as described in detail above) it was fixed by adding in a key at the first frame of the animation with the model at its binding pose which Kosmonaut sort of suggested.

Which is nice since I don’t have to remake all my animations now :slight_smile:

1 Like