I recently switched platforms (Unity 3D to Xamarin / Monogame) for game development.
I was able to do everything I wanted, interfaces, services, added 3D objects.
Now I’m in the stage where I need to put my 3D characters (with animations) to work and I realized that it’s not as simple as the other activities.
I searched all over the internet for examples, documentation, tutorials… but nothing seems to work.
I found no recent articles. Links to projects downloads that someone claims to work are broken.
I’m completely lost!
Already tried: Skinned Model Processor: Tried multiple examples (downloads and by myself), but always with a diferent problem. One of the codes do not build my model on MGCB, others neither build the project.
I read about a solution that looks better to me, the Better Skinned, but I did not find any example code or even the base for download (links are broken).
Could someone guide me on how to use 3D models with animations in my project? This is driving me crazy!!!
PS: I using Visual Studio 2015 to development and Blender to models and animations (and fbx export)
Thank you everyone for the attention!
For 3d animation unity is much better suited, since you have to implement animation yourself in here.
However, if you want to try, you can look at the source for 3d model viewer for Monogame [ver 0.6]
which has the better skinned animation integrated. You can also load your models in the program to see if they work.
Thank you very much!!!
I will try it and study the code now!
Looks like i have some wrong references (to my local monogame versions) in the solution, I think I fixed that in the git solution
Otherwise you would have to set the monogame.framework reference to your installation of monogame, typically in c:Program Files(x86)/Monogame etc
Using the already builded Viewer, when i open my model, its crashes.
I tried with a basic model (dude) and its load, but with some problems:
I got the source code and tried to run. Got a few errors, some i was able to work around, but still can’t run this.
The last error was “This MGFX effect is for an older release of MonoGame and needs to be rebuilt.” on the “_guiEffect = content.Load(“Graphical User Interface/GUIEffect”)” in GUIRenderer.
I will try to implement a new processor for my project based on your code.
you need to rebuild it then, go into content and rebuild the stuff. I used a different monogame version.
The default microsoft xna dude doesn’t work in many instances, it was build differently than all other skinned meshes I’ve come across. I think it also breaks for me when loading it in blender.
Every other one i’ve tried works, you can see some examples in the thread.
what is the crash?
If you want you can send me the model
I tried to rebuild the content, but stills got the same version error.
I’m trying to build the processor by myself piece by piece following your code as guide.
I’m a little slow on coding today (a little busy with another stuffs), but i will report to you the results.
Ty for the patience and attention!
I was finally able to build a Processor that works (with the help of your code). I managed to build the models successfully, and the game project runs with no errors.
I’m still trying to run with a “standard” model (dude.fbx), but so far, all I could do was display the static model on “T-Pose” and completely black.
I found a problem at random, I do not know if it is known to you: If in the directory where you are running the code some folders have name with blank space, several compilation errors occur that inform that they can not find the file.
About my model “breaking” the application: during some tests I came across the error: “Value does not fall within the expected range” where I applied “skinnedEffect.SetBoneTransforms” and I passed a list of “bones transforms”.
On debug, i noticed that i got 87 transforms and 89 bones. There is a problem with that?
If you want the model for research purpose, I can send the fbx to you (even the .blend), but I would not like to make the source of my model publicly.
I will keep trying to put models with animations to work with monogame, but I confess that I am already quite discouraged to continue.
I don’t think i have a line that says skinnedEffect.SetBoneTransforms in my solution - can you point me to the line and the class?
But yes, by default in monogame the max bone count is set to 72. That’s not a problem, in my program you would have to change 1 line.
#define SKINNED_EFFECT_MAX_BONES 72
to something higher like
#define SKINNED_EFFECT_MAX_BONES 90
It doesn’t really matter that it’s only 72, it can be higher, the performance penalty isn’t noticeable. It was just a default value i used there.
You can also check out my animation library and see if it works for you.
Thank you nkast.
Atm i’m doing some progress with the kos samples, but surely i’ll check yours too!
I finally managed to get my model to work in monogame!!! \o/
I created a project from scratch and recreated the viewer, this solved the monogame version problems.
Things I learned on the way to export fbx correctly from (maybe it helps others):
- Scale of the mesh and bones should be (1,1,1);
- Rotation of the mesh and bones should be (0,0,0);
- Turn on “Only deform bones” and turn off “Add leaf bones” in export
- First animation clip should be one without transforms (loc, roc and sacle).
- In units, i switched to “centimeters”, lenght: “metrics”, angle: “degrees” and scale: “0.01”
Now I can “clean” the code and leave only what I need to insert the models in my game.
I still need to test how it will work on mobile devices, but my hopes are renewed thanks to your help guys!
Once again, thank you!
Amazing work! Would you share your code with the rest of the community?
I’ve been through the same problem for weeks too…