Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Any interest in rigging within Unity?

Discussion in 'Formats & External Tools' started by JoeStrout, Feb 17, 2016.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    I've spent a couple of days working with some models from the Asset Store that are really great, but don't have all the bones I need. For example, one character has no finger bones, but I want to do some close-up animations that correctly position the fingers. And, several characters have very limited face rigging, greatly limiting the facial expressions I can apply.

    So I've been working with these in Cheetah3D, trying to add a few bones to the rig. But that's a pain because, apparently, as soon as you add even a single bone, you have to re-map the entire mesh to the rig, which (in my hands at least) doesn't produce nearly as good a result as the artist's original mapping. I might be able to do it with Blender, but every time I try to use Blender, it makes my head hurt.

    I've written 3D modeling tools before (years ago!), and have occasionally thought about making a 3D modeling tool within Unity. But that's a major endeavor, and I just don't have the time. However, a rigging tool might be doable. This would let you take a rigged model, and:
    • shift/rotate bones without screwing up the mesh
    • add/remove bones without affecting the existing vertex-bone weights
    • see and "paint" weights on the model for any bone, again without screwing up the mesh or other weights
    And then, of course, save these changes to disk. Relatively simple stuff, but oh-so-handy, especially if you're an indie without an artist staff, and are trying to get purchased assets to all play nice together and work with animations you got elsewhere.

    So. Does something like this exist already? And if not, does this sound like something people would pay a few bucks for?
     
    Ony likes this.
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's potentially an interesting thing if it can be done at runtime, because procedural creatures of course :p

    ie weight influence volumes, blending between volumes.
     
    Ony likes this.
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Hmm, interesting. I was thinking of an editor tool that would modify the files Unity imports — so, not runtime. The whole point being to have a human deciding which parts of the mesh should be attached to the bone, since any automatic mapping is likely to be suboptimal. So if you did that at runtime, you'd have to stop and ask the player to paint weights for all the bones... not likely to be popular. :)

    I would tackle procedural creatures differently, with swappable parts and/or simple scaling, in addition to procedural textures of course.
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,381
    I'd be into it if it were a simple enough interface. Not having to go back and forth between programs is always a plus and I rarely need any advanced features.
     
    theANMATOR2b likes this.
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's why I mentioned volumes and blending between volumes. The player never rigs or sees this, the programmer does. The player just makes creature x. Or the programmer adds a new snake like mutant thing.

    It's very situational, I wouldn't have a use for it either way, just seeing if there's other ways to add value to it.
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Yeah, it would need to be easy to use for sure. But I think that's doable.

    Probably the big fly in the ointment of this plan is updating the model file. Unity doesn't provide any support for writing model files, even in the editor, so I'd have to limit it to some format the extension code can write. So, the first time you use the tool, it might have to first duplicate it and write out a copy in 3DS format or whatever.

    Somewhat ironically, dealing with the file format is probably the hardest part of the whole idea.
     
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah it would be pretty cool if Unity made FBX parsing part of the runtime, perhaps on bitbucket so people can move to loading and saving FBX easily editor and in game.
     
    JoeStrout likes this.
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    It would really be a cool tool if it wasn't a pain in the butt to use. :)
    I think adding/removing bones "without affecting the existing bone weights" might be troublesome.
    Removing a bone from a skinned mesh - requires the weighting of the vertices that was assigned to that bone to be reassigned to another bone. Also removing a bone that has partial influence on vertices will require the weighting of those vertices to be affected. The existing weights on those vertices would need to be somehow reassigned, preferably controlled by the user to be linearly reweighted to the closest bone - somehow.
    And adding bones to an already authored mesh - seems to be a difficult issue also, but I think would be easier than removing a bone.

    @JoeStrout - which character model were you working with? If your willing I can take a look and fiddle with it a little bit in Max - to see if I can add some finger and face bones to the hierarchy.
    I've added fingers on a couple assets, but the success seems to depend on some unknowns about the model/skinning.
    If you want to PM me - I can take a look.
     
  9. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    I don't think it's all that hard. If you remove a bone from a skinned mesh, we could just renormalize the remaining weights. And if you remove all the bones that a vertex was attached to, then it's just not attached to any bone — I'm not sure we should try to automatically attach it to something else, provided the "paint vertex weights" tool is easy and quick enough to touch it up yourself.

    Similarly, when you add a bone, I would expect it to not have any vertices attached. Use the vertex weights tool to paint some weights for whatever section of the mesh you want it to control.

    Thank you for the offer to help, but I've got enough cases of things like this, that I'd rather learn how to fish than ask someone else to fish for me. I think I know how to do this in Cheetah3d — it's just a pain because I'm going to have to repaint ALL the vertex weights, even though I only want to affect just the hand (or face or whatever it is). But, still doable.
     
    theANMATOR2b likes this.
  10. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    How you explained that - seems like a workable solution. Can't wait to test it out!

    In Cheetah (I'm not familiar) if there is a way to save out the skinning information - you may consider using that feature as a workflow.
    In Max - when adding a bone onto the end of a hierarchy when the skin weights have already been set - saving out the skin data helps to keep the weights in tact when adding a bone. This is my workflow in Max - which might be transferable.
    - Save skin data
    - Delete skin modifier from the character mesh
    - Add bones to the rig
    - Apply a new skin modifier to the character
    - Assign bones to the skin, and load the saved skin data.
    - Match the bone names that were saved in the skin data to the same bones in the original rig. The new bones will also be in the hierarchy list, but will not have a match.
    - Now the skin data should still be as it was before - but with the new bone in the hierarchy available to assign weighting to.
    - Sometimes by just turning off the skin modifier in Max and adding bones to the hierarchy and then associating the new bone with the skin - it works without any loss to the weighting.
     
    JoeStrout likes this.
  11. vidi

    vidi

    Joined:
    Oct 14, 2012
    Posts:
    175


    That all can be done in akeytsu, also in a very user friendly manner .Also reparent Bones any time without damage the whole rig.
    Unfortunately it is window only .
     
    Ony and theANMATOR2b like this.
  12. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Pity. Well, perhaps it's something to learn from if I do decide to make this editor plugin.
     
  13. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Not sure how you add or remove bones without needing to re-weight. If it auto calculated you'd be assured of winding up with a frustrating weighting situation I would expect.

    But innovation is awesome and if you have the time, do it!