Hair with particle systems (a bit of a hack)

Discussions about MHX2 and other plugins that are developed outside the scope of MakeHuman. Note that bug reports should go to the respective code projects and might go unseen here.

Moderator: joepal

Hair with particle systems (a bit of a hack)

Postby joachip » Sat Feb 19, 2022 4:52 pm

Okay, so it's possible to specify a blender material that should be included when importing a human into blender. That's really cool. But it seems particle systems cannot be set up in the same way. So I made a crude hack to allow that. So now you can put this into the .mhmat file:

Code: Select all
blendMaterial short01_particles.blend/materials/short01_random
blendParticles short01_particles.blend/particles/short01_particles

The first line tells makehuman to use a specific blender material coming from a blender file. The Second line tells it to also get a particle system from that .blend file.

This way it's possible to have particle based hair set up in MakeHuman. You will not be able to see this inside MakeHuman itself, but once you use the "MakeHuman v1.1.0" plugin for Blender 3.0.0 and click "Import human" you will get paticle hair!

How to install:
Unpack the zip file into C:\Users\username\Documents\makehuman\v1py3\data\hair\
Then unpack the Blender_AddOn_Files_Changed_For_Particle_Support.zip file into C:\Users\username\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\ and click "yes" to overwrite existing files.

Disclaimer: I am not a python developer, so there could easily be bugs in what I did. I hope someone better at python will know how to implement this more correctly and perhaps even put it in MH's source code somehow.
Attachments
hair_short01_particles.zip
The hair and the modified files.
(698.4 KiB) Downloaded 81 times
hair_short01_particles.jpg
What the hair looks like immediately after being imported into Blender.
joachip
 
Posts: 11
Joined: Tue Jan 20, 2015 8:04 pm

Re: Hair with particle systems (a bit of a hack)

Postby punkduck » Sun Feb 20, 2022 8:12 pm

Hmm

I tested it and did a diff to find out the changes, you took the short hair and used the mesh as a basis for the emitter of the hair? The problem then is: there are faces perpendicular to the scalp itself. So from these faces the hair would start in the air and would grow "sideways". However it is possible just to do a scalp duplicate of the head itself. And use this instead of the given hairdo. Of course in MH it looks a bit odd then.

Better switch off the visibility of the emitter planes btw.

For short hairdos most would work out of the box. For more complicated hairdos it kinda works, but different. In these cases blender not only saves the particle parameters, but also the position of the strands.

However it would be limited: it is possible that the scalp resizes to a different head, but hair length then would stay the same, so for a smaller head the hair e.g. will disappear in the shoulder.

I can un-attach the hairdos from my characters and swap them, but usually a different character needs some fine-tuning with combing at least. So the principle itself is correct.

And yes, you made the material rather similar to the "blender-material" inside makeskin. So what python code concerns, my code wouldn't be better ;)

Greetings, punkduck
User avatar
punkduck
 
Posts: 1157
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Re: Hair with particle systems (a bit of a hack)

Postby joachip » Sun Feb 20, 2022 10:21 pm

I know it's a bit rough. But the main idea is to introduce the "blendParticles" keyword that lets us set up a particle system for hair, clothes and what not - the same way as "blendMaterial" already does.

So if you like the idea, it would be cool to see this become a part of MakeHuman I think.
joachip
 
Posts: 11
Joined: Tue Jan 20, 2015 8:04 pm


Return to MHX2 and other plugins developed outside MakeHuman

Who is online

Users browsing this forum: No registered users and 1 guest