Documentation:MHBlenderTools: MakeShapes

From MakeHuman Community Wiki
Revision as of 11:56, 18 April 2020 by Assetdk (Talk | contribs) (MakeShapes progress)

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

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