Page 2 of 2

Re: Weighting a MakeHuman Mesh

PostPosted: Sun Sep 01, 2019 12:02 am
by MTKnife
You'll have to skip through some of the mistakes, but you should find the entire workflow here:

viewtopic.php?f=15&t=14671

Note that you'll be using MakeClothes to export the mesh, and then you'll have to rename the files.

Re: Weighting a MakeHuman Mesh

PostPosted: Thu Sep 05, 2019 6:50 pm
by bogdan666
I still don't know how to transfer the weights of my imported proxy to an average female human mesh from makeclothes as they have a different vertex count (proxy is with genitalia and makeclothes mesh comes without genitalia)...

Re: Weighting a MakeHuman Mesh

PostPosted: Fri Sep 06, 2019 2:23 am
by MTKnife
I thought proxies always had the same vertex count as the main mesh?

Re: Weighting a MakeHuman Mesh

PostPosted: Fri Sep 06, 2019 6:10 am
by bogdan666
The main mesh comes without genitalia and my imported mhx2 proxy "female genitalia healed" has more detail as the name says.

Re: Weighting a MakeHuman Mesh

PostPosted: Sat Sep 07, 2019 1:11 pm
by joepal
MTKnife wrote:I thought proxies always had the same vertex count as the main mesh?


No, quite the opposite. One of the main points of proxies is to enable low-res topologies. See for example http://www.makehumancommunity.org/proxy ... _poly.html

There shouldn't be anything stopping you from having a higher res proxy either.

Re: Weighting a MakeHuman Mesh

PostPosted: Tue Sep 10, 2019 7:28 pm
by bogdan666
Does it mean that it is not possible to make custom weights and import them into MakeHuman?

Re: Weighting a MakeHuman Mesh

PostPosted: Wed Sep 11, 2019 6:50 pm
by punkduck
Hi

Use MakeClothes and rename the .mhclo as .proxy. Not the .obj. And weight files can be made for the proxies of course. You can also do a weight file for normal clothes. The standard shoes are built like this. If you take a look into the ASCII files you can see where the line with the proxy should be added.

Here you find the weight file for the shoes01 of the standard distribution in Linux (Windows and MAC have a different path of course)

Code: Select all
/usr/share/makehuman/data/clothes/shoes01/shoes01.mhw


and the .mhclo file starts like:
Code: Select all
basemesh hm08
tag Shoes

name shoes01
obj_file shoes01.obj
x_scale 12839 12860 0.7045
z_scale 11609 12442 2.5390
y_scale 12828 12888 0.5875
z_depth 5
material shoes01.mhmat
vertexboneweights_file shoes01.mhw
verts 0
16674 16704 16778 0.26685 -0.06589 0.79904 0.03989 0.14473 0.05509
...

So the vertexboneweights must be added manually with an editor.

But there is one problem. If you use bones with different names, like when changing it to e.g. the Bento skeleton, then the names of the bones will not match and you need different weight files. The weight file associated with a skeleton works on the standard mesh. The proxy can have an own weightfile. But what will happen when you use a proxy AND a different skeleton ... I have to check it. Maybe that's a contradiction we still have, because normally you need one weight file for each different skeleton (as long as the bones are different or renamed but not simplified like in the game-skeleton) :cry:

At the moment I am working also on a new proxy and especially the crotch region is a problem (not only for genitals, also for clothes). The armpit-region is similar. Although this proxy will not be published I will do a reduced skeleton in tongue region but also add some "jiggle" bones (if it makes sense), Then I need all, new bone names and a weighting. More information at the weekend.

My newest version (last picture in gallery) for a new character works with an additional map to determine, if "keep volume" is used or not. This is Mindfront's concept and I can add such a map directly when exporting the character (it is JSON, so you can do extensions without a problem). The map I will create for all meshes I use. At the moment the buttocks do not disappear when the character sits and the she will also not become a hulk, when her arms point to the sky. No additional smoothing is used. This is part of a concept for an extra exporter. This weghting is only used, when it is available, the export will not be more complicate for the user.

Re: Weighting a MakeHuman Mesh

PostPosted: Sat Sep 14, 2019 10:49 am
by bogdan666
I was successful in importing my modified weights into MakeHuman.

Let's say you've exported a character from MakeHuman (adult_female_genitalia_healed, default rig) to Blender.

In Blender you do some weight painting.

The next step is to export the weights as .mhw (there is an addon for it, just export and don't change anything in the options)

Now you put the "new_weights.mhw" into the proxymeshes folder.
Next you open the already existing adult_female_genitalia_healed.proxy as txt (it's in the same directory: proxymeshes).

There you do the following changes:

Between the lines "z_depth 50" and "verts 0" you make a new line and write:
vertexboneweights file new_weights.mhw

And that's it!
Now you can make a MH Character of the type "adult_female_genitalia_healed" with default rig,
which has modified weights. There is no more need to manually copy the weights from one mesh to another in blender after exporting your human model from MH, because
the mhx2 has the new weight changes included already!

Now just apply a subdivision, make some shape keys (in this order) and voila: You have your perfect game character!

Re: Weighting a MakeHuman Mesh

PostPosted: Sun Sep 15, 2019 6:54 pm
by punkduck
Hi

Second version is ready. Some changes are made:

https://github.com/black-punkduck/MakeHuman-Helpers

I added two directories blender2_7 and blender2_8 .. I changed the name (sorry) to io_mhw_import_export.py. Take the correct version for your blender version and throw away the old one. I will support the 2.79 for a while because I still have some trouble with 2.8 here and there.

The new one is able to import and assign the weights as long as you use the same geometry (in your case the proxy).

Sometimes I added vertex groups and then did a new group, like one for hair or e.g. no_volume for a double use of the armature. Now try to smooth the groups :( Either the hair is shorter or the no_volume is not no_volume any longer and the bones are only doing half the work. Or I corrected a knee on one side and need the same on the other side. That's what I am working on at the moment and most is ready to go now.

At least I can now replace the groups assigned with new ones. Also my old characters can get the new proxy-weights without loosing other groups.

For the symmetry I do an export of a .mhw file, pipe it through symmetrize_weights and import it again. This also works on additional groups. The only thing you need is a mirror_table and so I improved the function create_mirror_tab.py also. A mirror-table will allow you to find the vertices on a non-symmetric character (which normally is every character exported from mhx2 btw). This table is useful for everything. Weighting, adding shape keys etc. The table should be created from proxy.obj directly. But even this geometry was not 100% symmetric ... so it is a good idea to have such a function. The table will contain -1 for all non-found vertices.
In one version I changed a few manually to get a table.

Using a mirror-table you can also use this table to create a 100% symmetric wavefront.obj (symmetrize_geom.py).

In the end most of the tools will be available inside the blender plugin as well (or different ones, I am not 100% sure).

The scripts I did are mostly used on CLI now, because for debugging the tools I work on CLI.