[Closed] Automatic Weighting Tools?
Hi guys and gals,
I’m about to create an automatic tool for weighting vertices in MXS.
It’s not perfect at the moment, but before I make the same mistake twice creating a script that already exists I wanted to question here, if anyone knows a script that automatically weights vertices according to their position or distances to their bones???
Anyways, I’d be really interested in getting some hints if anybody knows how a “typical” loop selection algorithm works. Couldn’t find anything in the great wide web. Maybe I used the wrong keywords?
Cheers “ko’gen”.
I made a script a few months ago that does exactly this. It is still a wip, but is working well at the moment. I just want to add in extra functionality like exponential falloffs and maybe figure out a better method of calculating the weighting percentages.
I am currently defining a maximum sampling radius, cycling through all verts in the mesh and for each vert am collecting any bones whose center position falls within the max sampling distance from the vert as well as their distance from the vert. From there I use the distance values to determine percentages for each bone.
The problem I’ve been running into with this method is that obviously the sampling distance will change throughout the mesh, so certain areas hold up extremely well while others are really messy. I am thinking of trying another approach where maybe the sampling distance is determined dynamically by getting the distance of the closest bone to the vert and then sampling within another 50% of that distance for other bones. Might give better results.
Anyways, I’d like to hear others’ ideas on this too.
EDIT: Should also add that I added functionality for it to only calculate selected verts and to take into account vertex normals to help go back and rework those areas that had problems on the first pass. It is still a bit of a pain going back and reworking those areas though.
Hei Mathieson
thanks for your reply. Seems like we have the same thoughts of how a script like this should work. I’ve figured out this method when I started scripting, but kicked it, because of the issues you’ve pointed out. I guess there are minor problems with bones in areas like legs or arms. But I guess it get’s really horrible if it comes to automatically weight shoulder areas or even the belly, right?
The method I’m using right now needs a closed point loop to start. The script expands this selection in the direction in which the bone is pointing, deletes the old selection and weights the new loop according to the average position of the currently selected vertices according to the length of the bone.
The problem with this method is: The algorithm stops if the average position of the currently selected vertices is out of the range of the currently used bone. So it can happen that there are vertices missing or not weighted well. It’s okay for linear meshes with very clean edgeloops but it becomes a mess with more defined edgeloops.
Implementing an algorithm that pays attention to the topology of the underlying mesh structure may solves a bunch of problems (e.g. topology masking in ZBrush). But I’m really having no idea of how to start something like that.
Any ideas?
I wrote something like this years ago, I think it was Max 5 maybe. I never completed it as I found that I was doing just as much work cleaning up the mistakes as it was to just size envelopes and then weight. Maybe some one has some better ideas on it then I do but it always worked great in simple examples and then fell apart in real world ones.
I’ve been finding the same thing Paul. I have been getting better results on high-res meshes though, I guess because there is more information for it to work with. Either way, still lots of cleanup to be done. Not sure I am going to spend much more time on the script, its going to have to give better results to really be worthwhile.
Mirko, I added a “use normals” toggle to try to take care of some of these trouble areas. If the vertex’s normal points away from the bone, that bone will be calculated, otherwise it will be ignored. This helped a bit, but it created some other problems as well (think clothing, for example, where there can be lots of extreme folds). It might be good to make give an angle threshold option rather than always a 180 degree check.
I started playing around yesterday with that percentage of distance idea I mentioned. I was getting some unexpected results, so I think something in my code must be messed up. I’ll have to take another look at whats going on. I’m not even sure at this point that it will give much better results once I get it working. Worth a try though.
I’ve done this with LODs, but not the whole character – how do you define the characters volume? Also id be wary that this is just another form of the already existing skinWrap? or just a adding a standard skin mod?
I saw a paper recently that just marked edge loops of joints and did a volume skin on it. It was pretty nice but didnt handle any sort of elements, armor, skirts etc etc.
Hei,
so obviously everyone started scripting something like this, but never finished it
eek: You’re extremly right. To me this makes thinking about this script a lot more difficult cause whenever you think: “Hei, might be a good idea.” There comes a thought to my mind like: “But, wait, isn’t it similar to the existing envelope-weighting or Skin Morph Modifier? Argh…”
The problem is, that both methods are not very accurate, that’s why I thought something like in ZBrush might be a cool idea to work with. Is there any chance you find this paper again, that you were talking about?
Mathieson: I had the same problems with the vertex angles. When I calculated the angle everything was right. But when I tried to work with this angle and create a dependency from it gave me always very strange results. I couldn’t explain why.
PEN: As I said, there might be a script like this. But is there no automatic way of doing things like that in the industry? I can’t imagine this is still done manually, whereas automatization has flooded every other part of the business?!
What about checking the edgeloops per bone and creating as many cross sections as edgeloops with the average size of that specific edgeloop?
Hey guys, I was reading this post and found it really interesting.
I’m curious to know if anybody ever wrote a script that would normalize a character’s skin according to a given value.
Let’s say I’ve skinned my character using the paint weight tool, but in the engine i know the skin will be optimized with weight steps of 0.1
If i want to see the same result in Max, i would have to go through the skin and make sure i’m following that same rule, that way when i animate, i can see the exact same deformation of my character than it would be in the game.
I’m not looking for an actual script here, but i was wondering if anybody ever did that and if so what angle did you start from?
Thanks
There might be solutions for auto Skin weighting out there but It doesnt mean that it works really well. Also in Max we have envelopes and they can be setup very quickly to get you started. In Maya you have to do some sort of auto weight setup to get close to what you can do with envelopes in a very short amount of time. This isn’t saying there is a good solution out there, I just have not found it as of yet and over the years I have given it much thought.
Hey Guibou,
interesting idea.
I guess this shouldn’t be too hard to achieve.
All you’d have to do is checking your skinned vertices and determine if they are closer to an upper value or a lower value (like 0.13 is closer to 0.1).
After that you’d set the old value to the new value and that’s it. For animating purpose I’d store the old values of all vertices in an external file so they can be easily replaced.
Well actually I’m a bit interested in trying this. Let me know if you need any help
Cheers “ko’gen”.