Page 1 of 1

Load human in blender without first exporting to file

PostPosted: Mon Oct 22, 2018 12:11 pm
by joepal
I'm currently working with extending the blender/socket plugin pair to enable loading a full human from MH without the need to export. The work flow will simply be:

  • Open MH and model toon as you see fit
  • Enable the socket server in MH
  • Set options for import in blender
  • Click "import human"

Status as of this afternoon:

Just some random toon modeled in MH

This is how it looks after the "import human" button has been clicked

The toon rendered, without any changes in modifiers or materials

This is very much a work in progress, but as you can see it already correctly imports the body, all proxies (eyes, clothes...) and sets decent materials.

Several things are still missing, most notably:

  • Nothing whatsoever is done yet regarding rigging/skeletons, face shapes, expressions etc
  • Delete groups are not handled
  • Only a very limited set of material settings are handled. For example only diffuse textures work, not normal maps etc

The toon above took a sum total of about two seconds to load from click on the import button to being displayed in the blender viewport.

I wouldn't recommend anyone using these things yet, but if you happen to want to test, this is what you'll need:

... or you can wait until these things stabilize a bit and get included in the next py3 build.

Re: Load human in blender without first exporting to file

PostPosted: Thu Oct 25, 2018 3:52 pm
by jcpalmer
I am very pleased with this. It will simplify my workflow even more & eliminate dependence on MHX2. I do not know if you are planning to handle expressions & face shapes as part of the create operation, but other parts of this plugin already handle expression transfer, as long as the Default skeleton is used. You might prioritize skeletons & materials given that.

As you probably remember, I have a workflow which goes all the way from my own custom .mhpose files to fully expressive, speech capable webgl.

In a separate Blender plug-in, I was going from the pose library of transferred expressions to mesh shapekeys. I am currently working on that plugin to be able to export nodes based materials without having to resort to baking. Just looked at the code, and it is only about a 1 hour job to refactor it so a single class in a single file could go from the current pose directly to a shapekey on all applicable meshes using the skeleton.

Could then just copy the file to this plugin too, and then be able to directly go to shapekeys, skipping the pose library. Just put a little Destination drop down to either go pose lib or shapekey:


For some poses, you might get some keys on the hair & other meshes, but a quick review of keys on each mesh & use of the delete button fixes this. The other caveat is to get really good expressions you need to be in the same scale as MH, decimeters. If not, then I cannot allow Location Translation, the checkbox just above.

Re: Load human in blender without first exporting to file

PostPosted: Thu Oct 25, 2018 5:19 pm
by joepal
My priorities right now are getting the delete groups transfered, and then get IK working for the default rig (and default no toes). I tested the pose stuff on the Bone / IK tab on the toons I had imported via socket, and it worked smoothly. So I see no particular reason to touch that now, although at some point in the future we might consider doing binary transfers for the pose thingy too, to avoid the pretty high overhead of serializing to/from json.

After that I plan on implementing re-clothing. I.e, dressing an already imported toon in additional clothes.

For expressions, maybe it'd be possible to scale those either MH side or blender side during the transfer? I haven't really looked at the mechanics there, so this might be a daft suggestion.

Anyway, I'm pretty pleased with the functionality so far too. It makes the round-trip between MH and blender a lot shorter, bordering on immediate.

Re: Load human in blender without first exporting to file

PostPosted: Thu Oct 25, 2018 8:27 pm
by jcpalmer
Well, I have completed my refactoring of a pose to shapes into a stand alone file. Tested in the other plugin. Should be able to just pop into this plugin & direct face shapes for expressions. This is very cpu intensive, since every vertex is checked for each pose, if at least one dimension changed at least 0.00015, or it does not get added as a change to the key. If none are changed, the key gets deleted. Stats are written to info section, like:

info stats.PNG

You can see tongue still has 2 verts different enough for the CHEEKS-HIGH pose, and low-poly has 1 vert for the EYEBROWS-RAISED-LEFT. This little report can inform what is a worthless key. If not merging meshes, you probably want to delete them.

FYI, I tried to adjust for the location translation in expressions when not in meters in Blender & failed. Just put a check in to not allow for now. Rather not do than do poorly.

Perhaps I can speed up the expression transfer a little by only doing a Blender update once per pose, by removing a tab to this line. With going directly to shape keys, perhaps doing something at the transfer level would be good, but only when there is nothing else to do.

Re: Load human in blender without first exporting to file

PostPosted: Mon Nov 12, 2018 2:34 pm
by joepal
The socket importer now has a preset to ask for a MakeClothes type of toon. When set to that, the following will happen:

* Types correctly set to identify meshes as human or clothes
* Vertex groups mid/left/right created on body and clothes
* Vertex groups for helper vertices on the body (skirt, hair, tights...) are set up
* A mask modifier is set up to easily toggle which verts to display on the body
* Delete group set to non-destructive on body
* Correct scale for MakeClothes is used

This should make it a lot easier to develop clothes for an intended body type, not just the general base mesh templates available for when loading a body mesh via makeclothes.


The importing of clothes is not perfect though. The delete group should be mostly correct, although there will only be one delete group for *all* imported extra meshes (clothes, eyes, eyebrows...). But rigid vertex groups (or actually any vert group) other than mid/left/right) can not be deduced via the socket transport, at least not yet. Thus, using MakeClothes to export to MH and then importing back via the socket will result in a slightly different setup than what was initially exported.

Re: Load human in blender without first exporting to file

PostPosted: Wed Dec 12, 2018 1:15 pm
by joepal
I've posted a demonstration video with instructions on how to get started with this feature:

Re: Load human in blender without first exporting to file

PostPosted: Thu Dec 20, 2018 2:57 pm
by joepal
There's now some initial support for blender 2.8. It's far from finished, but is at least able to import a mesh using default settings: ... stribution

Re: Load human in blender without first exporting to file

PostPosted: Wed Jan 02, 2019 12:47 pm
by joepal
I've posted a video about how to get the integration up and running in blender 2.80: