FBX 3d model animations.

Hi folks.

I have a couple of ideas for 3d models that will be quite dynamic with animations that can’t really be baked.

I think I’ve worked out that parts of a model can be created as objects and moved around as independent items in a class. But is there a more contained option? Can the individual meshes in a model be moved and rotated etc?

If you think of a fan, the blades rotate while the body stays fixed. I’m looking at more complicated things, but that’s kind of what I’m thinking. So I’m just wondering which way is better, of if there is really only one way.

My other quick question on the subject, I know individual meshes in Blender can be named, can the names then be references in monogame as meshes(“Main_Body”) rather than meshes(0) etc.

Many thanks.

This is not a trivial topic in the least.

The answer i could best give would address two parts of your question separately.

  1. Blender and other programs may have different matrix setups and even animation and deformation matrix orders.
  2. Deformation and orientation matrices are used to make models move as you are describing.

As far as i know monogames ability to load a model and gleem information is limited.
There are a few people who have posted code on model loading here in the topics.
I suggest you search for topics on model loading on the forums and take a look at others code.

I even took a shot at it i have yet to revisit my class files and clean them up i used assimp and found it however does have some problems so does blender which are too lengthy to discuss for me here.

My incomplete work can be found here,
It is most definitely a personal rough draft and not meant as a tutorial.

This does work if the model will load but has quirks depending on how the model was made which i haven’t figured out a way to detect and smooth out yet. It requires you use the openassimp nuget package easily added from the visual studio nuget package manager. If you look in the code you will find the RiggedModel class which does the work and the shader RiggedModelEffect.fx in the content folder the other class file holds all the loading code and classes.

Loading the model is half the battle but manipulating it isn’t really trivial either.

Here is another post within the post is a link to nkasts aether model loader which is if you can get it working im sure in a more complete state. As well as where i was at when i last worked on mine.

The model class contains the bone/skeleton information you need.
You would have to draw each mesh separately. Instead of myModel.Draw(…)
you need to iterate through the Mesh parts and apply the rotation on the effect.
See this sample: Simple Animation · SimonDarksideJ/XNAGameStudio Wiki · GitHub

This might get slow for many models and/or ormodels with many meshparts. An alternative would be to use the SkinnedEffect, (see willmotil answer) and assign a single weight per bone/Meshpart.

You need a custom importer for that. That sample added this feature in the Skinning sample.

I also added this feature in my Animation importer Import Bone names by nkast · Pull Request #1 · tainicom/Aether.Extras · GitHub,
I guess you can just use that importer even if your model doesnt contain any animation, just use it as a regular Model
and the bone names -hopefully- will be there.