Page 1 of 1

Don't Take Your .mhmat Files for Granted....

PostPosted: Thu Oct 11, 2018 2:57 pm
by MargaretToigo
Like I've been doing because I'm kinda lazy about stuff like that, especially since once a human is imported into Blender, I have to edit all the materials , anyway.

I recently uploaded a pair of high-heeled shoes with lace frill socks, plus eight additional materials and I just uploaded new versions of all their .mhmat files because I've simply been taking whatever MakeClothes puts in them without bothering to fire up the ol' text editor to make adjustments.

Now, I'm not sure if it was me or MakeClothes -- both of us are quite prone to error -- but you gotta watch those bump and normal maps because there is a difference, even though they both have essentially the same purpose.

Texture files are often missing from this part of the .mhmat file, even after making all paths absolute so MakeClothes can find them.

In this instance, the diffuse and normal maps were there, but the spec wasn't.

The normalmapTexture was listed as bumpmapTexture. And down where all the boolean "built-in shader defines" are, "bump" was set to "true" and "normal" was set to "false."
The specularmapTexture was missing and the spec bool was set to "false" -- I don't know why this happens (also transparency maps never seem to work, even after editing the .mhmat file)

I think that you get the normal maps right by checking "Normal Map" under Image Sampling in texture Properties in Blender and that if that box isn't checked, MakeClothes will treat normal maps as bump maps. I don't get why the spec map wasn't included. I didn't have spec set to zero, but I may have set its Z-transparency to zero.

This is not a terribly big deal that's weighing on my mind or anything, since every material must be edited in Blender, but I am curious to know if it's some simple error I am making in my material/texture settings in Blender, or if this is just another quirk of MakeClothes.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Thu Oct 11, 2018 3:05 pm
by joepal
I doubt it's you doing something wrong in this case. The general explanation is that the MakeClothes and MakeTarget tools are pretty rough around the edges and could use some love. They were written a long time ago for an older blender version. Especially if you use them together with Cycles, things will behave a bit odd.

In all likelihood we'll have to do something radical about those tools for blender 2.8 anyway, so that might be a good opportunity to modernize them and make them somewhat more comprehensible.

In the meantime, I'm afraid that touching up the MHMAT files with a text editor might be needed in some cases. Also, there are several settings available to MHMAT which aren't supported by MakeClothes, so a text editor is the only way to get at those.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Thu Oct 11, 2018 3:16 pm
by MargaretToigo
I'm pretty sure this problem is related to what is or isn't in the .mhmat file.

Sometimes, parts of clothes, which have no transparency, disappear in the MakeHuman viewer...

Screen Shot 2018-10-10 at 3.18.20 PM.png
MakeHuman view [censor block mine]


But when the asset is imported into Blender, it looks just fine, without any adjustments at all -- other than adding a Hemi lamp so everything isn't all black...

Screen Shot 2018-10-10 at 3.17.40 PM.png
Same asset imported into Blender.


I have another asset, a dress that I made from the same skirt mesh, but with different materials, that looks just fine in MakeHuman...

Screen Shot 2018-10-11 at 11.12.59 AM.png
Dress made with same skirt mesh as above.



I know that this has gotta be one of those "so easy it's hard" things....

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Thu Oct 11, 2018 4:01 pm
by MargaretToigo
joepal wrote:I doubt it's you doing something wrong in this case. The general explanation is that the MakeClothes and MakeTarget tools are pretty rough around the edges and could use some love. They were written a long time ago for an older blender version. Especially if you use them together with Cycles, things will behave a bit odd.


They may be rough around the edges, but they are nonetheless quite handy and robust -- I often get weird results, but true errors and crashes are extremely rare.

I sure hope that they will eventually receive all the love they deserve. I'm happy to contribute assets, but I'm not a coder -- I know just enough Python to be able to hack around without breaking stuff too badly.

Although I understand the reasoning behind it, I am mighty disappointed that Blender Internal will cease to exist as of Blender 2.8 and I'm not sure what to do about that.

Cycles is pretty and its node system is nifty and everything, but I like the look of Blender Internal's Toon shader and I don't know if it can be duplicated in Cycles or the new Eevee -- Google it without "Blender" or "render" in the search string and you get results about the Pokemon of the same name -- which I've read about but not tried.

In the meantime, it's not really a whole lot of trouble to open the .mhmat files in a text editor to add a few lines and switch a few bools. I was just curious about why I was getting the results I was getting.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Thu Oct 11, 2018 8:44 pm
by joepal
MargaretToigo wrote:Sometimes, parts of clothes, which have no transparency, disappear in the MakeHuman viewer...


I think this is due to back face culling. The MHMAT property is "backfaceCull", which can be True or False. A technical explanation can be found here: https://en.wikipedia.org/wiki/Back-face_culling

In plain words, part of the surface might be invisible if it is pointing away from the user, as the primitive polygons are normally one-sided. The reason they're pointing away might be that they actually correctly do, or that you might need to go edit mode in blender and do normals -> recalculate outside.

I don't remember if backfaceCull can be controlled from MakeClothes. Otherwise, you'll have to add it manually to the file.

If you want to experiment with other settings, you can find a list of available MHMAT keys (sadly without any explanation) here https://github.com/makehumancommunity/c ... _assets.py, lines 73-102. I'm pretty sure I wrote an explanation of the keys a year or two back, but I don't remember where it is now.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Thu Oct 11, 2018 11:06 pm
by MargaretToigo
I think it may have something to do with the normals as there is no backfaceCull property in the .mhmat file. How does that property even get into a .mhmat file (I've never seen it)?

There's some useful if not terribly detailed documentation about .mhmat and other MH file formats right here in the MakeHuman online docs:

http://www.makehumancommunity.org/wiki/Documentation:File_formats_and_extensions

I've been referring to it often lately.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Fri Oct 12, 2018 6:39 am
by joepal
MargaretToigo wrote:I think it may have something to do with the normals as there is no backfaceCull property in the .mhmat file. How does that property even get into a .mhmat file (I've never seen it)?


Hm.. I think possibly you've got the historical context backwards.

MakeHuman as such and MHMAT existed first. In the beginning, the MHMAT files were written entirely by hand, using a normal text editor.

Since this was cumbersome, tools were added in order to automate parts of the process. But these tools only go some of the way. A long way yes, but not the whole way. There are still several parts of the total spectrum that they don't cover. For some of the file formats, the UI tools produce files that are partial to the extent that they're not even usable without adding important stuff by hand (this is especially true for the blender tools intended to produce new skeletons).

So to answer your question: If you want access to the full capabilities of MHMAT (and the other file formats), I'm afraid the most competent tool remain being Notepad. Some instructions (like backfaceCull), you'll have to add manually by editing the file.

As a side note, we have a plugin for makehuman intended to help modifying assets files after they've been initially produced by blender: https://github.com/makehumancommunity/c ... sseteditor. At the moment I would not recommend using this for anything other than discovering what's possible, if the plugin even starts. There is a high probability that it will crash, burn and possibly eat your material files for breakfast. With ketchup.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Fri Oct 12, 2018 12:34 pm
by MargaretToigo
joepal wrote:MakeHuman as such and MHMAT existed first. In the beginning, the MHMAT files were written entirely by hand, using a normal text editor.

Since this was cumbersome, tools were added in order to automate parts of the process. But these tools only go some of the way. A long way yes, but not the whole way.


So, MakeClothes provides more of a shell, like those Object C window function thingies in Unity (I forget what they're called, it's been a while since I messed around with Unity), that contain basic code framework, to which you have to add your own variables and conditions?

I can live with that workflow.

For my own assets that I don't share because they're not all mine and/or have proprietary textures, I just re-do everything in Blender. And I know where all my texture files are located on my home network.

But when I share assets here, I want the .mhmat files to work for those who download them. Even if it doesn't get all the shaders just right -- many users will be converting the materials so they don't look all plasticky in Cycles, anyway -- if it can just get all of the texture files to be imported into Blender, that's good enough. The foundation is that all the diff, spec, norm, etc. textures are there, inside the materials/textures properties, ready to be configured however individuals may choose. I'm not intimidated by code in a text editor, but lots of other users out there are because they're more artist than hacker.

And now I know how to do that by making a few small edits to the .mhmat files MakeClothes produces.

I don't expect or even need total automation, especially not from free, open source software. And, as you wrote upthread, the Blender API has changed somewhat since the version MakeClothes was written for.


joepal wrote:As a side note, we have a plugin for makehuman intended to help modifying assets files after they've been initially produced by blender: https://github.com/makehumancommunity/c ... sseteditor. At the moment I would not recommend using this for anything other than discovering what's possible, if the plugin even starts. There is a high probability that it will crash, burn and possibly eat your material files for breakfast. With ketchup.


Well, I have tried it and while it didn't crash or eat anything on my system, it doesn't work very well and seems rather unstable. A text editor is much more reliable.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Fri Oct 12, 2018 1:24 pm
by MargaretToigo
Okay, I loaded my tiered skirt into Blender and switched on the cyan spiky thingies that show the normals direction and some were pointing inside rather than outside.

Now, in Blender, when I selected all the vertices and clicked on "Recalculate" it merely flipped each normal to the opposite of what it was, but some normals were already pointing in the right direction, so they got messed up.

So, I selected only those faces whose normal spikes were facing inside and just flipped them and lo and behold, it looks the way it's supposed to look in MakeHuman...

Screen Shot 2018-10-12 at 9.21.12 AM.png
Normals Facing outward.

Re: Don't Take Your .mhmat Files for Granted....

PostPosted: Wed Oct 31, 2018 8:28 pm
by naflatem
Hi,
this is what I have found in the net, so even I understand now the difference of the color types.
http://blog.lexique-du-net.com/index.ph ... e-examples

naflatem