Skip to content

blender279weightplugin.md

black-punkduck edited this page Sep 29, 2019 · 5 revisions

Blender MakeHuman Weight Plugin

Hint: this Documentation is under construction

  1. Left side, right side, as used in this document is used in a different context, so from the perspective of the object (or in MakeHuman context: the character). Left is positive X in mathematical way.

  2. For a correct selection of the sides, the plugin accepts for left '.l', '.L' as postfix or "LEFT", "Left", "left" as prefix. These character strings should be part of the vertex group name or shape key name, so that a corresponding group or shape key on the other side could be created.

Creating and Exporting a Mirror Table

A mirror table should be created, when mirroring in edit mode is finished and applied. This will be used for symmetric objects in MakeHuman only, like base mesh or proxies, but could be used for other mirrored meshes as well. The table should be saved then, best is to use the same name somewhere in that name. The result is a text file containing all vertex numbers, the mirrored vertex number (which is the same in case of the x value equals to 0) and an 'l', 'r' or 'm' for left, right and middle position.

With a mesh object selected you can create this table.

creating a mirror table

You can change the epsilon value. This is the value, which is the largest deviation to the expected vertex (Euclidean distance). Reducing this value might reduce time to evaluate the mesh, but it can happen, that not all vertices are found then.

creating a mirror table, changing epsilon

Enter a name for your file. It should be similar to your object-name. This file can be used for every mesh produced by MakeHuman based on the same geometry (normally base mesh and proxies).

creating a mirror table, export button

Of course, sometimes there is a possibility that it does not work. Then you get an error message.

creating a mirror table, error message


Assigning a Mirror Table

When a mirror table is existent, it can be assigned to a mesh. Therefore a mesh must be selected in Edit mode.

selecting the mirror table

Then you have to find the table and assign it. The name will be saved in a custom property, the table is not permanently loaded.

loading the mirror table

If you want to know the name of the table, you will find it in the custom properties:

custom properties


Selection Using the Mirror Table

If you have a 100% symmetric mesh, Blender does not need a mirror table. But when you work on an object with no vertices added or deleted which are not 100% symmetric it can be useful. Especially when you export an even non-symmetric character from MakeHuman you can still rely on the same order of the vertices. So you can use a table, which was basically created on a 100% symmetric mesh.

When you have a mirror table assigned to a mesh, you can select the opposite side of the mesh.

mirror selection by table

The result should be like this of course 😊

result of selection


Mirroring Geometry

When you do changes after you created the mesh, this function can be used to repair the mesh or to copy the changes from one side to the other. It can also be used to repair an exported makehuman character mesh.

You can use this function when a mirror table is assigned.

mirroring geometry

Of course it is rather obvious, what will happen ... 😏

mirroring geometry result

Mirroring Vertex Groups

This is the main task of the tools. You changed something in the vertex groups for weighting on one side of the object and need exactly the same changes on the other side. Mostly it does not work when you re-import the character from MakeHuman. With the help of the table it now does.

Supposed you already assigned the table it is simple to execute the mirror function (either from left side to right side or the other way round)

mirroring vertex groups


Mirroring Shape Keys

Especially for meshes with corrective shape keys supporting an armature this function could be helpful. If you create a shape key on one side on an already exported character, you will have the same problem. Blender will not find all of the appropriate vertices on the other side of the x-axis. So in this case the mirror table could be used also.

The procedure mirroring the shape keys is similar to the vertex groups. Let's explain it using an example. The image below is a fake showing vertices with and without usage of the shape keys. Supposed you mirror the left side to the right, a key with the name Cheek.L will be mirrored by creating a new shape key Cheek.R (if there is an existing Cheek.R, it would be deleted). A key not indicating a side (in this example MouthThin) will be symmetrised internally.

mirror a shape key, before

You can start mirroring of the shape keys when you select the method, either from left to right or vice versa.

mirror a shape key, menu

The result is shown in the demo picture. MouthThin now changes both sides of the mouth. There is also a new shape key, which can be used for the right cheek.

mirror a shape key, after


Exporting Weights (Vertex Groups)

The weights are exported in the form MakeHuman uses, it is a so-called .mhw file. It is JSON based textfile.

If you assigned weights to an object, then use the export function:

exporting weights

You can enter or change parameters. For the precision of the weights: Lower values than the precision are not saved. For better readability the weights are stored in a number of columns in one line.

exporting weights, enter parameters

To export the file press the Export MHW button.

exporting weights, export button


Importing Weights (Vertex Groups)

It is possible to load the weights and assign them again to the object. This often helps, when you e.g. uses groups for weighting bones, others for smoothing, hair etc. on an object. When you normalize values (all vertex groups of a vertex sum up to 1) you can easily destroy with a vertex group for smoothing the weighting of the bones. So it is possible to load the groups again. You can even do that without destroying all others.

importing weights

If you want to keep groups, deselect the replace check box. Be aware that the new group then is something like group.001 and this will of course have no effect unless the group is renamed or assigned.

importing weights, replace

Import and create the weights (vertex groups) on the object by pressing the Import MHW button.

importing weights, load