Creating Tighter Vertex Groups Per Body Part

Discussions about MakeHuman, Blender and MPFB. It is ok to ask for general Blender support here, even if it isn't directly related to MakeHuman

Creating Tighter Vertex Groups Per Body Part

Postby DudeCuda » Sun Jul 07, 2024 5:48 pm

So to sum up simply at the top:

Desired outcome:
I'm trying to export a rig with very tightened up vertex groups for each body part.
When MakeHuman exports, it makes vertex groups, which for the purposes of my project, would be really helpful in automating a script to generate several isolated images of say, the head only, the upper arm only, etc.. I could export several different bodies to fbx, and write a script in blender that would hide/show each respective body part one at a time, and create a render from several directions of just that body part (for example with cameras setup on 3 planes, 8 directions each).

Problem:
However it seems to export with vertex groups that overlap a lot (i know, expected outcome for most projects but not the specific niche way I'm looking for).


Attempted solutions:
So I'm not very familiar with MakeHuman, and I'm not sure how it actually decides where to place these vertex groups. I tried grabbing the Accad skeleton, tightening up the weights to span less into other body parts, but it doesn't look like this overlap is determined by weights from my experimenting (unless the custom weights in my saved mhw file didn't apply, the skeleton debug in MakeHuman for mine seems identical to the skeleton i modified, i might not be applying the weights properly. I was kinda pulling my hair out figuring out this much, so im not sure if i successfully got my custom weights properly applied to the skeleton)

Question:
How would I be able to get more specific vertex groups from the makehuman export?


Context and Background:
Just so you know kinda what Im getting at. My hope is to automate sprite creation a bit for different body types. If I can get MakeHuman able to export with vertex groups that better isolate each body part (such as head, upper arm, lower arm, with no overlaps that would be problematic in rigging a 2d sprite), I could largely create an automated process of generating these body parts as 2d sprites from several angles (like 8 directional movement). The way MakeHuman generally exports seems novel for this, as I could create a blender script that uses these vertex groups to create seperate objects, then have it hide/show each of these body parts with a batch render to give an isolated 8 directional view of each isolated part. But doing this manually with each model seems incredibly labor intensive, and would not be worth the effort to do so many times (aiming for a character creator with selecteable body shapes for each body part). MakeHuman seemed like a novel way to do this easily in bulk, if I could simply get this one little hitch of cleanly chopped parts instead of having so much overlap that I'd have to manually trim (which for 8 directions, potentially on 3 axis, for dozens of body types, seems like an overwhelming amount of editting and trimming). The novelty of the concept essentially rests on where I could actually get these clean-cut vertex groups for each body part, which if I can't, the idea is kind of out the window

Thanks,
DudeCuda
 
Posts: 4
Joined: Sun Jul 07, 2024 4:15 pm

Re: Creating Tighter Vertex Groups Per Body Part

Postby tomcat » Sun Jul 07, 2024 6:45 pm

DudeCuda wrote:My hope is to automate sprite creation a bit for different body types.

I'm sorry, but I can't answer that question. But I would like to say that this is a very interesting approach. It was because of such difficulties, and not finding a way to solve them, that I immediately switched to 3D.

Maybe someone can answer that…
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 476
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stun), The Aggressive Evil Empire

Re: Creating Tighter Vertex Groups Per Body Part

Postby DudeCuda » Sun Jul 07, 2024 8:31 pm

I seem to have figured out the custom weights issue, which might have me on the right track.

I knda followed the lead of existing skeletons seeing that many included skeletons had an included default_weights.mhw in their directory.
I search through the skeleton code and couldn't find reference to the weights, so i figured it would automagically pickup my custom mesh (with tightened up slicing of the various parts) if I followed the same naming convention.
After searching around I found out the skeleton did have to explicitly name the weights file. It was a bit of a search around as I couldn't find much documentation on it.

So adding the following line to the end of the skeleton code ended up bringing my custom weights into makehuman, which allowed the vertex groups to export as more cleanly cut body parts in blender:


"weights_file": "custom.mhw"

Its taking a lot of back and forth to refine the weights, but it seemed to get me on a roll again. It seems to work best when im defining weights on a fbx with no topology, but I seem to be able to apply those weights on models with any topology after it's defined (which is fine, weighting the advanced topologies seems to be a bit archaic with so many vertices).
I'm still just working with my first few parts and experimenting how different topographies might help make it a lil less choppy, but it seems to be working well so far. If it works out I might post the modified skeleton and weights so that others can use it for some advanced bulk creation of simple pixel-art 2d sprites. If all my magic works well I should have a product that can give all the required images for fairly comprehensive 360 of every body part in a few clicks. Fingers crossed, but so far so good
DudeCuda
 
Posts: 4
Joined: Sun Jul 07, 2024 4:15 pm

Re: Creating Tighter Vertex Groups Per Body Part

Postby tomcat » Sun Jul 07, 2024 9:16 pm

DudeCuda wrote:when im defining weights on a fbx

It's not really clear why .fbx would be used. You can load the model into Blender directly via socket.
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 476
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stun), The Aggressive Evil Empire

Re: Creating Tighter Vertex Groups Per Body Part

Postby DudeCuda » Sun Jul 07, 2024 10:20 pm

tomcat wrote:
DudeCuda wrote:when im defining weights on a fbx

It's not really clear why .fbx would be used. You can load the model into Blender directly via socket.

Mostly from being new, I only found MakeHuman a few days ago, and even the 3d graphics piece has been since I last did any major work in it (so even formats were with a bit of research,. Iwas using 3ds or c4d files mostly back in the day).
I did bump into the proxy feature eventually, used it once or twice, but wasn't finding the export to be much of an issue as I have finished with much of the back and forth between programs (and kinda had a groove for it by then). It also allowed me to save several files to compare different results in trying to get it to work.
It was nice to learn how the proxy worked through this process though, might end up using it more later when I'm actually making the various bodies.
After working on it today I have over half of the weight maps done and a good part done in my separate file for my camera rig to test that it was actually doable in concept.
DudeCuda
 
Posts: 4
Joined: Sun Jul 07, 2024 4:15 pm

Re: Creating Tighter Vertex Groups Per Body Part

Postby tomcat » Mon Jul 08, 2024 2:32 am

DudeCuda wrote:After working on it today I have over half of the weight maps done and a good part done in my separate file for my camera rig to test that it was actually doable in concept.

I would be extremely interested in seeing what you accomplish. If that's possible, of course.
Foreigners' reactions to Russian "Bird's Milk" candies
— Are your birds being milked?
— In Russia everyone is milked. Here even the zucchini is used to make caviar.
User avatar
tomcat
 
Posts: 476
Joined: Sun Sep 27, 2015 7:53 pm
Location: Moscow (Orcish Stun), The Aggressive Evil Empire

Re: Creating Tighter Vertex Groups Per Body Part

Postby joepal » Mon Jul 08, 2024 4:32 pm

If you're comfortable with blender, you could do the rigging in MPFB instead and then write a simple python script which removes the vertices with a low weight from the vertex group they belong to. This way you could at least drastically reduce the overlapping. Using MakeHuman only my guess is you'll have spend quite a lot of effort doing something with the exports.

If you are unfamiliar with the difference, see: https://static.makehumancommunity.org/m ... human.html

In MPFB you have helper sevices you can call from python to get vertices belonging to vertex groups etc. See for example https://github.com/makehumancommunity/m ... ice.py#L84
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4622
Joined: Wed Jun 04, 2008 11:20 am

Re: Creating Tighter Vertex Groups Per Body Part

Postby DudeCuda » Tue Jul 09, 2024 12:35 am

It wasn't too bad actually, took about a day to get my first draft of the new weights (much of that digging unintentional weighting out of the poor fella's nose and mouth). Plus the manual method I was able to plan exactly where I wanted each sprite part to line up, which some were a bit further than the original skeletons.
Looks a bit choppy in spots but actually kinda looks like pixel art which will be it's main use. I'll post the modified skeleton and weights when I'm done (with full credits of course) but right now I'm at a first draft. Since I'm having to think like I do with 2d sprite work in terms of how these parts will interlock and move without having weird corners pop out in certain poses, there's still a bit of trail-and-error tweaking ahead. Script is almost done too to mass export a slew of sprites out of it, which I might post as a nice little add-on for the modified skeleton. I'll post some of the results when I finish up, kinda fun now that I got the bulk of it out of the way
DudeCuda
 
Posts: 4
Joined: Sun Jul 07, 2024 4:15 pm


Return to Blender and MPFB

Who is online

Users browsing this forum: No registered users and 2 guests