Documentation:MHBlenderTools: MakeShapes

From MakeHuman Community Wiki
Revision as of 14:36, 18 April 2020 by Assetdk (Talk | contribs) (Using MakeShapes)

Jump to: navigation, search

MakeShapes for Blender

This is a new tool for importing MakeHuman Targets as Shape Keys in Blender.

Please read the instructions below carefully and be sure to make a backup of any addons you change etc.

Introduction

When working with MakeHuman in Blender you will have some high quality characters to play with and you will see that the community addons can help you a lot. There are a few primary must have Blender addons please use Blender 2.8 - these are the tree you will need to have and know about to use MakeShapes:

  • Makehuman the community addon, that will allow you to fetch your character from MakeHuman to Blender directly!
  • MHX2 Runtime, that will allow you to the import MHX2 files you made in MakeHuman
  • Documentation:MHBlenderTools:_MakeTarget that will help you to make new Targets to be used from within MakeHuman.

When you want to use your characters in Blender, or when you want to export them to a game engine - UE4 or Unity - you even get some shape keys, also called morph targets. These are however not always "included" in the files exported from MakeHuman - specifically the shape keys are added by the MHX2 runtime addon. ( Also the community Blender addon contains some kind of shape key/pose functionality, but I have not been able to find any explanations for what they are doing! )

Rather than making your characters in MakeHuman with one fixed expression/shape/pose, you would probably want to have the same options available in Blender. So I investigated the above addons and made MakeShapes as a small extension to MakeTartarget2. The general idea is have been to to transfer the Targets, expressions and the expression builder "sliders"... as-is, so they can be used as shape keys.

You can also take a look at this page for more on how to work with Blender: Moving Assets into Blender. And I also made these pages:


Find the addon on GitHub

This is the link for the addon master: [1]

You need to add the addon to Blender and you need to know about two other addons, as described below. Currently this addon have been tested on Blender 2.80 only, but it should work on any Blender version that works for the two addons.

Current status

Thus far, in version 0.1.0 of the tool all of the Targets can be imported to Blender and the targets can be added to MHX2.

Getting started with MakeTarget2

It makes good sense to learn how to use MankeTarget2 first. In general this addon was made by Joel Palmius, and it builds upon the fact that you can directly transfer the characters you have loaded in MakeHuman. So start up MakeHuman and set it up to communicate with the Blender addon (This is done in the community/Socket tab, and the setting in the Blender addon must be the same. As they are by default).

The process is very simple, you load your character to MakeHuman, without any targets, but as you would like to see it in Blender/UE4/Unity. And then you go to Blender and run 'Import human'! In the current version of MakeTarget2 you will have two options, when you select the 'Body' or 'BaseMesh' you imported.

When you press the 'Load target' button you must locate an existing .target file. These can be found in a directory: C:\Users\<user>\Documents\makehuman\v1py3\data\custom (this may change depending on how you set up MH!). These are accessed in Makehuman via Modelling/community - make sure to check out that you can find even more community targets!

Try this now, selecting elf-ears.target and load this. Two new entries are made under shape keys: Basis, PrimaryTarget. And your character should now have elf ears! You can change the size of the ears, in 'Object mode'. The general scope of MakeTarget2 is that you can make a new target, or you can load one and change it - when you are satisfied with that you can save you new target file, import and use it in MakeHuman....:

  • Go to 'edit mode',
  • edit the elf-ears
  • Press 'Save target'
  • Name your target elf-ears2.target and save it

If you did this in the correct folder, your new target should appear in Makehuman and you can use it there!

When you made one target you can not make one more, so you need to delete the Shape keys, in blender, to load/make a new one. Be sure to make a backup if your work was brilliant! You may also notice that not all targets will get loaded correctly to Blender using MakeTarget2, I do not know why...

You can now import your character from Makehuman make a new community Target and you can get it to work in Makehuman. Using two of the must have Blender addons.

Using MHX2 import

Now try to EXPORT your MakeHuman character in MHX2 format. You probably already know that you can load and save characters, and you can not "transfer" them to Blender. But some of the data appears to be lost, left out or missing when you look at the character in Blender.

However when you make use of the 'MHX2 runtime' import you will notice that it imports shape keys - however these shape keys are not "know" when you look for them in MakeHuman! There are some similar targets, but they are not the same! MHX2 runtime simply can add some predefined 'Face shape and face shape drivers' to your character, when you thick the box in before you import. (You can also chose to import the Base mesh, the Proxy or both..!)

You should try to play around with the MHX2 import options. I ended up with some very specific settings, as I want to import the character in UE4 - you may find that you need different settings depending on what your need are.

In case you think you now know enough about MakeTarget2 and MHX2 import, you can now take a look at what can be done with MakeShapes.

Using MakeShapes

You should be familiar with Makehuman, MakeTargert2, MHX2 import - that is you should be able to perform the following tasks:

  • 'Import human' for the base human character from Makehuman to Blender. (do this now)
  • You should have installed MakeTarget2 to blender and you can now install MakeShapes - notice that it will install with MakeTarget2

Now there is two manual steps to do before you can use MakeShapes:

  • find the faceshapes.mxa file, make a backup and make your faceshapes_BASE.mxa file
  • Find the community target files, that are used by Makehuman


Initial setup for faceshapes.mxa

You don't need to use MakeTarget2, but you will now need to locate some .target files, and the faceshapes.mxa that you will use soon! With your file explorer try to locate this directory, on your computer (Thh version ext may be difrent for your installation):

C:\users\<your user>\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons  <--- where all addons are when installed
C:\users\<your user>\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\import_runtime_mhx2\data\hm8 <-- the files you need, soon
C:\users\<your user>\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\import_runtime_mhx2\data\hm8\raw <-- the files you add to, soon

This is how my directory shows up:

 MakeTarget2-data.png

You will notice that the faceshapes.mxa file is not looking like yours. I recommend that you make two copies of that file and call them faceshapes_BASE.mxa and faceshapes-original.mxa.

Now make a new folder, anywhere where you want, and move the new file faceshapes_BASE.mxa, then edit this file and add one line <faceshape> at the bottom of the file, but above the two } } lines, like this:

 MakeShapes-faceshape base.png

Please note that you will not need to do this again, unless there is a new version of the MHX2 addon.

Initial setup for target files

Before you do this you should add all the targets you want to use to Makehuman. you find these under modelling/custom! And you can download even more from 'Community'/'Download assets'

MakeShapes-custom-targets.png

The .target files are located in the Makehuman directory, your setup may be different, but on my computer this looks like this:

 C:\Users\<user>\Documents\makehuman\v1py3\data\custom

You take a copy of all the files, and add them to the MHX2 raw folder:

C:\users\<your user>\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\import_runtime_mhx2\data\hm8\raw

You can simply add more .target files to the directory, as you need! To be on the safe side make a backup copy of the .target files! After this you should be good to go!

Using MakeShapes

MakeShapes-buttons.png

MakeShapes installed, you should see the above. After you have imported a character from the running Makehuman, you can now locate the shape keys, under "object data", this icon: MakeShapes-icon.png. You can now press the 'Load shapes from targets' button (if you want to you can load a single target, this happens when you uncheck the corresponding checkbox).

The target files you want to load are those you found before:

C:\Users\<user>\Documents\makehuman\v1py3\data\custom

If you do not uncheck the checkbox all .target files will be processed - now the targets should appear in Blender, as shape keys, and they should be active and working!

WARNING!! You should not use the 'Save Targets' buttons, it will save all of the .target files, but I think they are useless.

Next step is to press 'Save your faceshapes.mxa file' button, select the folder where you placed the faceshapes_BASE.mxa file. This will produce a new and bigger faceshapes.mxa file. Your final task will be to copy this file to the MHX2 directory:

C:\users\<your user>\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\import_runtime_mhx2\data\hm

Now when you import any Makehuman MHX2 file and check on the 'Face shapes' and 'Face shape drivers', all of the targets will be added to the character!

You do not need to do anything else..

MakeShapes progress

MakeShapes, done....

While MakeTargt2 can help you modify existing target it will not help you much when you what to "transfer" shape keys. My very first attempt on learning Python and making a new Blender addon involved using VSCode and and extension called 'Blender code' - whit that you can run Blender and the load and debug an existing addon... this was what I did with MakeTaget2.

Messing around with the code I found out how to change the names of the shape keys, name to the "file name". After that it was easy to read all .target files from a directory and add them all as shape keys! This took me only half the way though... as I wanted the shape keys to merge with the character, any character, that I made in MakeHuman. I did try several tools for transfer shape keys, but some did not work at all and some would transfer only party or with some issues. So I finally looked into how the original set of shape keys came to Blender. And I found that the 'MHX2 import' added "face shapes".. that were not part of the original export!

Using the MakeTarget2 print/save functions enabled me to "dump" the raw 'Shape key' data to print/files and I am now able to cut/paste the "printed" version. Say, the elf-ears, can now be add to the file that 'MHX2 import' works with, and the shape keys will be added to the imported Blender characters... for both Base/proxy mesh. Right now MakeShapes will export the selected shape key only.

MakeShapes todo

  • The addon must be packaged and put on Github
  • I need to output all of the shape keys, in one "faceshape" file.
  • I want to be able to process expressions.
  • I I what to be able to process all expression builder targets