Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: increase the skinning weight limit per vertex from 4 to 8 #12127

Closed
looeee opened this issue Sep 5, 2017 · 8 comments
Closed

Suggestion: increase the skinning weight limit per vertex from 4 to 8 #12127

looeee opened this issue Sep 5, 2017 · 8 comments

Comments

@looeee
Copy link
Collaborator

looeee commented Sep 5, 2017

I'm opening this as a point of discussion - I have not been able to find any technical reason for this limit aside from performance and the ease of using single Vec4s for weights and indices. Going through the code base here it seems like the limit was set many years ago when skinning was first introduced to three.js, so perhaps it's time to revisit it.

I've run into issues with several models that I am not able to edit which have more than 4 weights per vertex (specifically, all models downloaded from Mixamo). When loading them in three.js the extra weights are deleted, resulting in errors in the animation. Loading the same models in Sketchfab results in the animation playing correctly, so it must be possible to support more than 4 vertex weights in WebGL.

For reference here is the difference in the animation (note the position of the fingers). In Sketchfab (correct)
sketchfab

and the same model loaded in three.js (incorrect)
three

Here is the model. The error is especially obvious with this example, however most Mixamo models show similar minor errors (head wobbling, splayed fingers, minor jitter etc).
victory_2_30fps.zip

With regards to editing the model to remove the extra vertex weights manually - I'm not sure this would be possible without a lot of work on the animation, but even so I have tried loading the models into 3DS Max and Blender and re-exporting for use in three.js using a few different methods (FBX, Collada, JSON). In all cases the model gets completely corrupted and is unusable so that is not an option.

@RemusMar
Copy link
Contributor

RemusMar commented Sep 5, 2017

For reference here is the difference in the animation (note the position of the fingers)

The vertices of every finger (phalange) are controlled by 3 bones at max.
So in that case the skin modifier was not applied properly (a common mistake).

@looeee
Copy link
Collaborator Author

looeee commented Sep 5, 2017

@RemusMar the model is from Mixamo, and as I mentioned it does play correctly when loaded in other systems that don't have the vertex limit (SketchFab, 3D Max). Improperly applied skin modifier is not the issue.

And in case, that's not what I'm trying to discuss here - I'm just using this model as an example for why increasing the vertex limit might be worth considering.

@RemusMar
Copy link
Contributor

RemusMar commented Sep 5, 2017

Improperly applied skin modifier is not the issue.

It is a big issue.
To "fix" it you need to waste processing power increasing the "bones / vertex" limit.

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 5, 2017

For the sake of completeness: https://discourse.threejs.org/t/is-the-limit-of-4-skinning-weights-per-vertex-a-hard-limit-of-webgl/801

@Usnul
Copy link
Contributor

Usnul commented Sep 11, 2017

My 2[insert your currency].
4 bones is a decent number for most types of skeleton, except maybe for facial rigs and here is why:

  • simple biped skeleton will have a branching factor of at most 4 (arm-spine-arm-neck, spine-hip-hip)
  • good skinning is quite important for a good animation result, so usually just throwing more bones doesn't yield a better result unless you skin well.
  • if skinning is done for 8 bones and you try to control it with 4 - you will get inaccurate results, but the degree of inaccuracy is actually controllable if you re-adjust weights for 4 bones, because losing 4 other bones will mean less overall influence on vertices unless the remaining 4 bones compensate.
  • Another problem with dropping bones is that you have to be smart about which ones you drop. Say you have 8 bones influencing finder joint: 3 phalanges, palm, and through bad skinning another 4 phalanges of unrelated fingers with influence of 0. Say when we reduce number of bones from 8 to 4, we happen to pick those 4 unrelated phalanges - we end up with no motion at all. Selection of bones during reduction process matters, most influencing bones need to be selected.

I would suggest looking into re-weighing the skin instead of adding more influencing bones as a first solution.

@looeee
Copy link
Collaborator Author

looeee commented Sep 12, 2017

I would suggest looking into re-weighing the skin instead of adding more influencing bones as a first solution.

Thank you for the feedback. Unfortunately as I mentioned this isn't an option, even though it's the obvious solution. I haven't found any way of importing Mixamo models into Max or Blender and re-exporting them for use in three.js without causing massive corruption. They end up looking like they stepped out of Beetlejuice

beetlejuice

@looeee
Copy link
Collaborator Author

looeee commented Sep 12, 2017

However, what you are saying about about 4 weights per phalange makes sense. So I'm coming round to the idea that this is either bad weighting from Mixamo (which I think is unlikely, since I have searched quite a bit on this topic and haven't found anyone else complaining), or an unrelated bug in the FBXLoader.

Neither of which are related to the issue of raising the vertex weight limit so I'l do some more research and if I come up with anything I'll open a separate issue.

But I'll leave this open since it doesn't look like this limit has been reconsidered since it was first introduced. I think it's valid to discuss it a little further.

If other people think the limit should remain at 4 though I won't complain if this gets closed.

@looeee looeee closed this as completed Oct 28, 2017
@looeee
Copy link
Collaborator Author

looeee commented Oct 28, 2017

I no longer think my issues are caused by the vertex weighting, it's more likely related to undefined pose node IDs as in #12398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants