Search Unity

Will unity support more than 4 weight(bone) influences per vertex at some point?

Discussion in 'General Discussion' started by JovanD, Aug 18, 2014.

  1. JovanD

    JovanD

    Joined:
    Jan 5, 2014
    Posts:
    205
    Im curious about why is there such a limitation in the first place and are there any plans to increase it?
     
  2. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,186
    I think the main reason the limitation exists is because it's hardware-friendly: 4 bone IDs pack neatly into a 4-component vector (e.g. like a colour).

    In theory it should already be possible to blow past that limit under D3D11.
     
  3. ChaosWWW

    ChaosWWW

    Joined:
    Nov 25, 2009
    Posts:
    469
    I'm genuinely wondering under what situation 4 influences isn't enough. Although it might make sense to have no limit, the way it is now sort of forces you to think a little bit about optimization and best practices. Culling a bone that has .005 of an influence probably isn't going to completely destroy your deformation.
     
  4. akash920

    akash920

    Joined:
    Aug 19, 2014
    Posts:
    2
    It is possible, UE4 has it. I don't see why unity can not do it. The main take here is, performance and point mentioned by superpig.
     
  5. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    111
    Does anyone know if this limitation still exists? It would be quite useful to us to be able to use more than 4 (we actually 8 would be ideal for us). Cryengine can do it. Why not Unity?
     
  6. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,186
    Yes, the limitation still exists and AFAIK there are no plans to remove it.

    Could you explain the details of your use case?
     
  7. rosor

    rosor

    Joined:
    Nov 15, 2009
    Posts:
    3,578
    What I would like to see is dual quaternion support both in export to FBX and supported by Unity... It would be so great...
     
  8. clesage

    clesage

    Joined:
    Sep 29, 2015
    Posts:
    1
    "Could you explain the details of your use case?"

    Smoother meshes.

    Particularly short, squat cartoony meshes where many of the body parts are interacting with each other. I'm rigging a very round character right now with a face rig. Since he is so round and short, his mouth is basically down in his spine. With 3 mouth joints, I only have the budget to include one spine influence, rather than a smooth blend between his neck and spine + mouth.

    Max-4 presents a very tricky balancing act. It would be nice to sacrifice performance for a higher quality rig in some circumstances.
     
    dogzerx2 likes this.
  9. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,186
    I don't suppose that rigging with blendshapes/morph targets would help you, instead of using bones for it?
     
  10. thxfoo

    thxfoo

    Joined:
    Apr 4, 2014
    Posts:
    515
    Can this not be done with a custom shader? I don't see the problem why not.
     
  11. antislash

    antislash

    Joined:
    Apr 23, 2015
    Posts:
    646
    facial anims for example, although i made some with 4 bones only settings
     
    Teravisor and dogzerx2 like this.
  12. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    111
    It's facial anims for us too.
     
  13. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    673
  14. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    Seconded. Unity clearly is trying to be an engine used by AAA titles now, so they should update the outdated bone weight limit in accordance.

    The game we are currently making has 40-75k poly characters (without clothing) and we have to put up with a lot of deformation quality issues due to this skinning limit.

    Unity already provides quality options for limiting it down to 2 or 1 influence, so I don't see how it would be an issue to bump the limit up to 8 and just default that option to 4 so the engine would perform as usual for the average user.
     
    Last edited: Jan 6, 2017
    landon912 and SunnySunshine like this.
  15. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    @superpig With the news that DX9 support will be phased out in 2017.3, does the team have plans to finally support 6 or even 8 influences? It's becoming a point of contention when comparing to other notable game engines now.

    And not to mention now the news of collaboration with OTOY and pushing Unity for filmmaking, more than 4 influences is an absolute must in the film industry for achieving the high fidelity of facial deformation required and deformation smoothing in general along large distance.
     
    Last edited: Aug 6, 2017
    SunnySunshine and Pawige like this.
  16. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,544
    I have a bone driven digital wave (ocean type, breaking surf wave) that would benefit from having this ceiling raised. Looks great in modelling app, terrible in Unity.

    Will have to re-rig at this point but a greater number of bones influencing would solve this
     
  17. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    483
    Remember though that it's also the #1 mobile engine, so it shouldn't rush into making any changes to core functionality or data formats if it risks reducing mobile performance.
     
  18. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,474
    I have to point out a little bit of sanity, blizzard use between 1-4 bones and blendshapes for everything else. If the larger companies in the world are mostly happy with 4 bone solutions + blendshape, why is using blendshapes out of the question? It's "unlimited bone influences" and FBX file format does record the blend amount as keys so it would all just work playing back an animation normally.

    The fact is... and this is a fact, most AAA games will use between 1 and 4 + blendshapes. 8+ is a luxury and the majority of games don't do it.

    The exception would be some PS2 games where every vert was essentially a bone. I don't mean to dismiss what is said, just I asked around for the purpose of this thread and that's the answers I got back (blendshape being unlimited freedom, essentially).

    Without causing offence, I wonder if anyone knows why they cannot use blendshapes, given that they just work perfectly without code and offer unlimited deformation?
     
  19. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,773
    IIRC, when I tried to use blendshapes in some dynamic use case it was impossible to get the desired results with them vs freely moving and rotating bones. It was long ago so don't remember if it was an Unity limitation or just blendshape mixing in general.
     
  20. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    Blendshapes only solve the issue when it comes to non-dynamic deformation changes, like making the character smile. It does not solve janky deformations in situations where you don't have much choice but to rely on bone influences, like rotating an arm around, there's no solid way to generate a bunch of blendshapes to handle the various angles the arm can be to solve deformation issues. There's a reason the default for bone influence in film is generally at least 5.

    Using Blizzard as the shining example is a bit disingenuous. They don't exactly make super realistic games, their most realistic endeavor so far is Overwatch, and that has quite a lot of janky deformations on characters actually, but it's not a big deal because it's not a game about interacting with characters up close in a cinematic way, it's a fast paced shooter where performance and style is what's most important, not cinematic quality. Also, you would be quite wrong if you were talking about their cinematic shorts, which will for sure be using more than 4 influences.

    It's not like Unreal provides 8 influences just for sh*ts & giggles ya'know. And let's say I need to use bone-based deformation (we do), because I need to use information about those bone-locations to make a character accurately interact with other objects, clothes, etc... I can't use blendshapes there, because blendshapes give me no feasible way to grab that surface distance/scale, and obviously we can't do skinned-colliders so can't use a raycast for that either.
    For something like clothes, your solution would be to have to make blendshapes on every article of clothing that adjusts the clothing the same way the blendshapes do on the character... This is a HUGE workload increase what would simply be solved by having more influence so all we have to do is match the bone scale through script and be done (but even if did do blendshapes like that we still need surface distance for external interactions).

    Also, it should be mentioned that blendshapes are hardly free. We already use blendshapes for some stuff where it's reasonable, but we are making a high quality game with characters in the 40-70k poly range (just counting their base body). Adding lots of blendshapes is going to bog down performance with the numerous vertices there are going to have to be iterated over, so the blendshapes aren't exactly making for a more efficient solution either. And we use a full-body IK setup on our characters, and we animate our characters inside of Unity now to improve our workflow.

    And like I mentioned in my last comment... Unity is now trying to push their engine as a "Cinematic Tool", adding a dang raytracer now and all kinds of filmic utilities. If that is something they truly want to push, then film-level bone influences should be included in those new features, and I'm sure you'll be hearing more complaints about it if people do actually start picking it up for film-making.
     
    Last edited: Aug 7, 2017
    KWaldt, Ostwind and hippocoder like this.
  21. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,474
  22. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    6,434
    I think before worrying about 4+ bone weights you guys should worry about Dual Quaternion skinning support. For someone aiming for realism this should probably be much higher on their priority list.
     
    Invertex likes this.
  23. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    Thanks, I have seen this before when we were investigating ways to handle fluids, but I'm not sure how it would help with our deformation issues? Also, we animate inside of Unity now with an IK based setup to keep our animations efficient and see exactly how it will look as we make it, especially since we have dynamics scripts on characters that are important to see while animating.
    We aren't making movies though, we are making a game with in-depth character customization on high quality characters that are the up-close focus of most of the gameplay, so deformation quality issues become very noticeable.

    Oh no, believe me I'd love that, but I didn't bother to even try asking for that because if there's this much friction against 4+ influences... Well, I don't have much hope in a more complicated request like that haha. Plus, you can get around the issues dual-quat solves by using volume-preservation bones, but to use those well, we need the 4+ influences...
     
  24. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    6,434
    It is worth mentioning that it should be possible to implement custom skinning solution, especially if using only CPU skinning is fine with you. GPU skinning should be possible as well, but in this case you'll be most likely restricted to custom shaders only.
     
  25. nli2_work

    nli2_work

    Joined:
    Jun 15, 2014
    Posts:
    5
    Currently working on face rig for Unity's Blacksmith. I would love to see 8 influences per vert. Sure, if I had the dev team and budget of Naughty Dog I could make a few thousand blendshapes to get near infinite expressions. But I don't, joint based face rig is the next best option. For a mesh like this, you definitely need more than 4 influences if you plan on anything more than a med/long shot. Untitled-1 copy.jpg
     
    Peter77 and Invertex like this.
  26. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    4,218
    Cant you do it into your modeling soft and bake the rig into the blendshape? I know That's how some do it in blender.
     
  27. nli2_work

    nli2_work

    Joined:
    Jun 15, 2014
    Posts:
    5
    Yeah Alembic cache is an option, probably the only one that's workable with reasonable time investment. But there's no telling how it works in combination with Mechanim etc. For cutscenes it might be workable.

    the other option is create the blendshape library using the joint rig. but circles back to time consumption.

    at the end of the day though, maximum of 4 bones per vert will be obsolete very soon, if not already.
     
  28. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,474
    Well you can bake theoretically endless bones to blendshapes still with a small script (3d package side). These issues are able to be worked around while you wait for 8+
     
  29. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,013
    Alternatively, if the product is build around high quality facial animations, perhaps other technology than Unity is better suited for it.
     
  30. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    4,218
    I wasn't talking about alembic cache at all, just making a rig with bone, animate, then use the rig to bake blendshape, then export the blendshape to unity. If your rig isn't limited to 4 bones in the modeling software, it becomes a non issue. I'm not sure what's time consuming about this process ...
     
  31. nli2_work

    nli2_work

    Joined:
    Jun 15, 2014
    Posts:
    5
    we probably have different definition for Blendshapes then.

    Baking entire animation to "blendshape" is vertex animation, not blendshape proper. alembic cache is one path for vertex animation. Maybe some 3d apps call vertex animation blendshapes, while not entirely wrong, it's not how most animators and rigging artists understand the term. Maybe you mean baking each frame of the animation into a blendshape, that seems to me like a massively inefficient way of using blendshapes.

    Blendshapes proper is library geometry shapes. these blendshapes are keyed for a complete animation. The library can be generated in different ways, manually sculpting them or posing the face with joints then "baking down" to blendshapes. It's time consuming because you have to make blendshapes for parts of the face, not the entire face at once.

    All the suggestions you folks made are good, but at the end of the day they are work arounds, not proper solution for higher fidelity realtime assets, something Unity seems to be pushing for with demos like Black Smith and Adam, which is having more influences per vert. Sure we can wait for it, but I expect the wait will be long without users agitating.
     
  32. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    4,218
    That's not what I'm saying at all. I say you rig the face, pose your rig, bake it into blendshape, nothing to do with animation.
    I don't understand this at all, the process is the same, and it can be automated (it's transform movement). I don't know how there is another way to do. The thing is that blendshape basically emulate more arbitrary bone, the result are literally the same. I'll tackle character soon I'll try a demo.
     
  33. serena_alta

    serena_alta

    Joined:
    May 29, 2019
    Posts:
    1
    The problem with blendshapes is they are topology/mesh specific?? When it comes to having a character with hundreds of clothing options, the amount of blendshapes needed is crazy. Unreal have supported 8 influences per vertex since 2014...
     
  34. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    I thought I replied to this thread recently but I guess not. Unity 2019 can do up to 32? influences per vertex now.
     
    Peter77 and joshcamas like this.
  35. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    788
    Correct, Unity 2019.1 can do 32 influences per vertex :))
     
  36. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,544
    Wow that's good timing, I have just began revisiting this stalled project.Excellent!
     
  37. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,544
    Any idea how to enable that on the skinned mesh renderer component?
    I can see the slider to bump up to 32 bones in inspector when selecting the object in project view
    But how to set it to that in the scene?

    Thanks!
     
  38. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    You have to set the max available weights on the object's import settings first so that the blendshape data is there. Leave it to "auto" on the skinned mesh renderer so it will use the max weights you set on the import settings for the object.
     
  39. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,544
    You mention blendshapes.
    I'm meaning bone driven vertex deformation. Are we on the same page?
     
  40. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    895
    Yes the per-vertex max-influence count, I'm not sure why I mentioned blendshape data there, I think what I meant to say is that you can't set it on a per-scene basis, because it affects how the imported data is pre-computed for the mesh. So you have to set it to the max weights you want.
    You can still reduce it down to the 1, 2 or 4 weights option on a per-scene basis though.
     
    Last edited: Jul 15, 2019
    AaronC likes this.