MH into Godot tutorial

For discussions related to game development, and to game development software such as Unity, Unreal Engine, Godot and so on.

MH into Godot tutorial

Postby tomcat » Sun Nov 28, 2021 6:59 pm

Disclaimer
I've never done a tutorial before, so I apologize in advance if something is not quite right or not everything is clear.

How to put the model from MakeHuman into Godot with animation

Programs used:
Blender addons:
  1. MPFB2
  2. Retarget BVH
  3. Godot Blender Exporter

Step 1. Creating the Model in MH
1.1 In this case, for the example, we take an almost standard model of
Basic female Joel Palmius.
1.2. For the animation you need to assign a Rig. Here we have chosen a simple CMU.

Image

Step 2: Import into Blender and assign the animation
2.1. We load the model in Blender with MPFB2. You need to switch from the rig selection tab in MH before doing this. If the rig selection tab is open in MH, Blender will give you an error.
(2.1.optional). Duplicates the collection with the character (this step is optional if another, prepared animation will be used).
2.2 An animation is assigned via Retarget BVH. (Animation from the CMU is used here).
(2.2.optional). In order to make the character walk in one place, the "Hip" bone constraint is assigned (in pose mode), by the standing still character duplicated in the previous step.
2.3 The model is triangulated. The character is placed in a zero pose (frame 0) (not necessary anymore) and imported into .escn. What should not be imported should be marked as "Disable in Renders". There are plugins that allow the engine to open Blender files directly.

Image
02_01.bvh File size: 254KB

Step 3. Animated model in Godot
3.1 Open (or create a new) project in the engine.
3.2 Put the .escn file in the project folder. The sequence is not important: you can put the file to the ready project at once or import it there.
3.3 The .escn scene file is opened (Open Anyway).
There is a little problem here. For some reason, textures are not picked up. It is therefore desirable to prepare textures in advance and place them in the folder with the project. The textures are assigned. For textures of eyes it is necessary to set the flag "Transparent".

Image

3.5 Select AnimationPlayer and press Play (Shift+D).

Image
tutorial_final .mp4


This is one way to put the animated model from MakeHuman in Godot.
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 431
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: MH into Godot tutorial

Postby punkduck » Sun Nov 28, 2021 8:23 pm

Hi woodcat,

thanks for the tutorial. We can add that to the wiki (Docs and FAQ) later. I will also try to understand the system before ...

I will then explain what the principles and possibilities are, which will be more general. Of course we will use examples then.

When I started with UE all people explained that a special skeleton is needed and everything must be remapped etc. etc. I was sure, that was wrong.
The need of a special skeleton is only the case when animations from e.g. Mixamo are needed. I mostly do my own.

Retargeter can also be uses with the default skeleton. But that does not necessarily look better.

In the end I would explain, how new animations can be appended, if it makes sense to create characters with different clothes or not (in UE one can append clothes, but because of skin bleeding through I would not recommend this) etc. etc.

But at the moment the tutorial helps a lot.

Greetings
Punkduck
User avatar
punkduck
 
Posts: 1246
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: MH into Godot tutorial

Postby tomcat » Sun Nov 28, 2021 8:55 pm

Many thanks for the response.

punkduck wrote:When I started with UE all people explained that a special skeleton is needed and everything must be remapped etc. etc.

As far as I understand, Godot doesn't really care what skeleton is used. The only question is how it will look in the game.

In the end I would explain, how new animations can be appended, if it makes sense to create characters with different clothes or not…

I will deal with animation later and will add or write a separate tutorial.

Godot takes the animation from a Blender file. But you can add directly. Animations are controlled by AnimationPlayer, which I'll deal in more detail later. Clothing and hair are also in my plans for the next stage.
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 431
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: MH into Godot tutorial

Postby punkduck » Mon Nov 29, 2021 11:17 am

Hi

Yes, the idea that a skeleton of a horse normally is different from a human was the reason why I did not believe that I need a specific skeleton and tried another way in UE, I am pretty sure each game engine would do it like this. There are systems like OpenSim which demand a special skeleton (Bento). These are multi-purpose skeletons, which also have a second pair of legs, tail and wings for other characters. The jukebox in my gallery is working in UE and there is also a skeleton in it (it loads a record and plays it).

Btw.: The hip-bone of my character is not fixed to a position. I wrote a Blender plugin which will take an animation and calculate all frames in a manner so that the first and last frame are in the same position, those in between are calculated relatively. This allows a more natural and less linear movement. It also works for rotation (I use Euler basis then, not Quaternions). With this plugin I made most of my animations.

When I completely understand the NLA logic I will add the plugin to Github. Atm I have different files for different actions and use libraries. What is weird, these libraries are treated as an own track after export. In UE I have to delete them and only use the one I need.

Also MakeHuman is able to show more than one bvh-pose (on my box it works at least). I have to figure out which kind of refresh mechanism we may use, it will certainly not work like a game, but maybe we can see the movement in slow-motion at least. Then we could add not only poses but also loops for movement, e.g. swimming or whatever we need.

Punkduck

Edit: I did a first try. My Godot complains when a vertex is changed by more than 8 bones. I will add a special function in my blender addon to reduce that to a lower number of weights by simply removing the smallest ... (maybe such a function is already there ...). We can do the manual in wiki together when we found out all what can happen (you can also edit it there btw.). At the moment the tutorial here is okay.

And: for me it is kinda normal, I am usually good in accidentally finding pitfalls. :lol:
User avatar
punkduck
 
Posts: 1246
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: MH into Godot tutorial

Postby RobBaer » Wed Dec 01, 2021 7:26 pm

punkduck wrote:
Also MakeHuman is able to show more than one bvh-pose (on my box it works at least). I have to figure out which kind of refresh mechanism we may use, it will certainly not work like a game, but maybe we can see the movement in slow-motion at least. Then we could add not only poses but also loops for movement, e.g. swimming or whatever we need.


At one time the pose/animate tab had an animation sub-tab and the devel version Duststorm was working on actually was displaying animations from .bvh files. I don't know if this code is still buried deep within the source code or not.
User avatar
RobBaer
 
Posts: 1219
Joined: Sat Jul 13, 2013 3:30 pm
Location: Kirksville, MO USA

Re: MH into Godot tutorial

Postby tomcat » Wed Dec 01, 2021 10:53 pm

punkduck wrote:My Godot complains when a vertex is changed by more than 8 bones.
Very interesting, I've never seen anything like this before.

Then we could add not only poses but also loops for movement

It would be a good opportunity.
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 431
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: MH into Godot tutorial

Postby punkduck » Thu Dec 02, 2021 9:17 pm

@RobBaer: Yes I know the code. I have a dummy here which shows all frames of an animation. Unfortunately this is not a player. When you press play it runs ... you see nothing new and wait and wait... until the last frame is reached. Then this is displayed. I used it as a base for my perspective plugin once. First plugin I can do is a "step-by-step" view. At least different poses in one file like "dancing" would be possible. For a real animation I must check.

Btw: If you load a bvh now the first pose is displayed but the rest is in memory as well.

When I wrote that plugin I had no idea and hoped for the best. Meanwhile my knowledge of MakeHuman (and python) may allow to do this in a better way.

Woodcat also asked for an glTF exporter. It would be sth. not only for Godot. UE can handle that, Blender ... Atm. I don't have a lot of time. But this will change at christmas time.

I have an advantage now: since 3 weeks I am only coding python in the company, so some of my perl-looking code segments will slowly disappear :mrgreen:
User avatar
punkduck
 
Posts: 1246
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: MH into Godot tutorial

Postby tomcat » Sun Jan 02, 2022 10:42 pm

Addendum. Import textures and ShapeKeys

Textures

First I will outline the process that works correctly:

  1. Exporting the model from MH to .mhx2 ;

    Image

  2. Saving the .blend file to the project folder (requires installation of the plugin);

    Image

  3. PROFIT!

    Image

Material Problems:

  • Exporting from Blender in .escn format (when choosing "Material Mode" — Script Shader) saves the skin texture, but it is not displayed correctly.
  • If you use import to Blender via socket/MPFB2 and save the .blend file to the project folder, all the textures except the skin are preserved.
  • In all other cases, textures are invalid and must be assigned manually in the engine.

ShapeKeys

If you enable "Face Shapes" in the settings when importing the .mhx2, the ShapeKeys available in Blender will be transferred to the game engine. But for each individual body part, they must be set individually. For example, if you change "Mouth Open" in "Body", you have to change the same parameter in "Teeth_shape" and "Tongue". (It should probably be noted that in reality, the jaw has a little more mobility than just open/close.)

Image
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 431
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Re: MH into Godot tutorial

Postby MrP » Sat May 21, 2022 8:50 am

hey, can u be more specific on how we load our mh 1.2 model in blender using mpfb 2? i'm trying New human > From Makehuman > Import human but all i get is errors
MrP
 
Posts: 19
Joined: Fri Mar 25, 2022 7:23 pm

Re: MH into Godot tutorial

Postby tomcat » Sat May 21, 2022 10:49 am

MrP wrote:hey, can u be more specific on how we load our mh 1.2 model in blender using mpfb 2? i'm trying New human > From Makehuman > Import human but all i get is errors

About the errors I have mentioned:
You need to switch from the rig selection tab in MH before doing this. If the rig selection tab is open in MH, Blender will give you an error.


At the time when I wrote the tutorial, it was more reliable to use .mhx2 — only this option allows textures to transfer correctly.
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 431
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stan), The Aggressive Evil Empire

Next

Return to Game development

Who is online

Users browsing this forum: No registered users and 1 guest