SMD Import Zero-Weight bone problem

Started by friagram, July 10, 2014, 02:32:29 PM

Previous topic - Next topic

friagram

I'm using max 2015, but I believe it does it in other versions.

When importing a model that has bones with no vertex weights, the importer will  auto assign weight to the nearest vertex (as max would normally do when adding a bone to the skin modifier). However, these vertexes that it's assigning weight to already have weight properly assigned to those verts.

This commonly happens for stuff like weapon bones, hat bones, and other stuff that gets $bonemerge'd in for player models. Would it be possible to make the exporter simply drop zero-weighted bones from the skin modifier (but still import them into the scene) ? This would likely be an easy fix for the problem.

This is somewhat unrelated:
Another thing that I've noticed is that the importer splits the mesh and smoothing groups wherever there are UV map seams. It's not a huge problem, but both the cannonfodder and wunderboy importers handled this fairly well using explicit normals or by rebuilding smoothing groups. Even when using your weld option, it still seems to occur. This is probably due mostly to models being decompiled, but it does still happen on exported/imported SMDs. It's not a huge problem anyways.

Attached is decompiled model that imports OK with the 2012 compiled max importers, but has trouble with the wall worm maxscript importer (due to 0 weighted bones). Stuff like prp_pouch, prp_hat, weapon_bone, etc should not ever have weight assignment.

wallworm


wallworm

#2
I looked into the issue and it is a little bit more complex than it might seem. And here is why:

This is info taken directly from the SMD file you loaded

Quote21 "prp_hat" 6

This line says that prp_hat is node 21.

Later in the SMD:
Quotetwilight_sniper_red
  21 -1.054646 0.000003 -2.752167 0.000000 -1.000000 0.000000 1.000000 0.000000 1 21 1.000000
  21 -1.063246 0.000003 -2.789436 0.000000 -1.000000 0.000000 1.000000 0.000000 1 21 1.000000
  21 -1.029800 0.000003 -2.775101 0.000000 -1.000000 0.000000 1.000000 0.000000 1 21 1.000000

This says explicitly gives 100% weight to three vertices to the designated bone prp_hat.

Another example:

Quote26 "weapon_bone" 14
...
Quotetwilight_sniper_red
  26 -0.837444 -0.000018 -2.639885 0.000000 -1.000000 0.000000 1.000000 0.000000 1 26 1.000000
  26 -0.846045 -0.000017 -2.677147 0.000000 -1.000000 0.000000 1.000000 0.000000 1 26 1.000000
  26 -0.812597 -0.000017 -2.662819 0.000000 -1.000000 0.000000 1.000000 0.000000 1 26 1.000000

So even when I started testing options to remove the bones that had no weights, the problem persists because the SMD is clearly weighting those vertices to those bones.

In this case, the user is simply going to have to manually remove the bones from the skin modifier and do some cleanup. I may write some helper functions to make this easier and faster... but I cannot really automate it based on any logic that I can come up with.

friagram

#3
That would be right in this case. I'm pretty sure that I've seen this happen in the past with zero-weighted bones. After looking through several models, I think I see what the problem is. It happens fairly often with models that use painted weights too (so mabye' it's a rounding issue, but I really don't know). I just loaded up that model and if you look at prp_pouch there is a problem with the surrounding weights. It should just be weighted to the attached pack only. When I use cannonfodder's importer, it imports it weighted just to the pouch. When I use wall worm, it also weights it to nearby areas. For example, the vertex right above it attached to the vest has a weight of 0.919 to pelvis but 0.081 to pouch. Also, the vertex behind the pouch has a weight of 0.5 to pouch , 0.25 to hip r, and .25 to pelvis (in cannonfodder it's all 1.0 to pouch).

I don't see anywhere in the SMD where it's assigning the verts those weights, mostly it's all 1.000000, so I think this is probably the source of the problem I'm seeing.

Also, thanks for the work on these tools (and supporting them), they're great

I'm using max 2012 x64 on the left and 2015 on the right

wallworm

I'll add an option for removing zero-weight bones.

I've not noticed any problems with zero-weight bones. I think it is probably related to an SMD where the weight list for a vertex doesn't add up to 1.0 and then Max is just guessing where to put the extra weights. I'll look into this.

friagram

perhaps, in  this case the pouch has weights, but it's weighing it wrong, like to the hand and the leg, etc.

wallworm

I've found a fix for this now. I'll be loading this update sometime today (hopefully).

wallworm

You should find that the error is now gone in the latest version: http://www.wallworm.net/index.php/topic,1088.0.html

I added the option to remove zero-weight bones... unfortunately, it was easiest for me to stick this function as an afterthought to not change the global logic... and the method is slow because of a quirk in the skinop.removeBone() method.

I also noticed while testing that your example SMD has 10 detached faces just below the world origin that are weighted to various bones. These are in the SMD itself... so I am assuming there is a quirk related to the decompiled model. You may want to show that to the developer of Crowbar.

For reference, this kind of model is best with ALL options in the General options off (except the Extended Material Search and Remove Unweighted Bones, if necessary). Tip: to turn off all options quickly, toggle the Animated Model checkbox on then off.

friagram

Thanks! It works great now. I'm aware that the model imports with some missing faces, sometimes crowbar does that (the other decompilers do too). I'm not a fan of decompiling models, but sometimes the authors stop supporting/developing them, or it's required to mod the game. Anyway, it's usually not a big deal and easy to fix, unless I'm trying to work with VTA data.. which is a huge pain because the vertex numbers then become different and I have to do stuff like skin wraps and stuff to try to get it to line up (I don't really know how else to fix that).

Importing VTA in max is kind of pain anyways, and as far as I know, there are no importers. What I've done in the past, is extracted all of the SMDs from the VTA by splitting the file and then imported each frame individually and added them all to a morpher, which is huge hassle.

Removing unused bones is a nice feature for importing or even exporting models (like bodygrouped models), mostly because all of that extra stuff really shouldn't be in the file as it is not used.

wallworm

Glad it works for you now.

Regarding VTA importer... it might come at some point. No promises, though.

wallworm

Just a heads up. I've finished a set of updates that address all the weighting issues in the SMD Importer. This will be in the next update.

SMF spam blocked by CleanTalk