Search Unity

Making swappable armor/clothing for RPG game

Discussion in 'Formats & External Tools' started by Cheburek, Mar 3, 2012.

  1. Cheburek

    Cheburek

    Joined:
    Jan 30, 2012
    Posts:
    384
    Hi guys,

    I am looking into making an rpg where you can create different character (male/female), and there are various armor/clothing pieces that need to be animated along with character animations. If character does some animation, armor/cloth should correctly deform with character's body.

    I still can't figure out a way to do this. Do I have to rig the armor separately, and then just hope character doesn't perform anything crazy and the skin would show through the armor? I don't think this is a good idea..

    I also looked into Unity's dressing room sample, where they use separate models for top/bottom/head bodyparts that are already dressed. That would probably be the best solution (definately the cleanest one), but I don't know how to rig the head/top/bottom so they always align perfectly when connected together, i.e. so the skinning weights on the intersecting verticies are exactly the same.

    Could you give some hints please?

    Thanks.
     
  2. Minalien

    Minalien

    Joined:
    Feb 10, 2010
    Posts:
    8
    I'm not really sure what the best practice is as far as Unity goes (and even less so where the creation of the art assets is involved), but I wouldn't fret overly much about clipping between the character mesh and the armor/clothing - even Skyrim has the issue in plenty of instances.
     
  3. Berenger

    Berenger

    Joined:
    Jul 11, 2012
    Posts:
    78
    I'm bringing that quest back up. What is the best way to have multiple animated pieces on the player ? I also asked it on Unity answwer here.
     
  4. Mr.T

    Mr.T

    Joined:
    Jan 1, 2011
    Posts:
    546
  5. Berenger

    Berenger

    Joined:
    Jul 11, 2012
    Posts:
    78
    Yep, that's it, check the other post :)
     
  6. Mr.T

    Mr.T

    Joined:
    Jan 1, 2011
    Posts:
    546
    Thanks a lot Berenger :)
     
  7. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    I'm working with this now, I've built a system where you target a root joint with a given rigged object - then it recursively "snaps" each joint of the given object to similarly named joints of the target. In the past this worked great for rigid to semi-rigid gear, doing the acid test now with gloves.

    The alternative I see is to still rig each wearable piece, but instead of placing it over top of the character you just swap it into place of a body part, so swap the default hand for a gloved hand for instance.

    In theory, if you make a glove that envelopes the hand entirely and matches both the hands rig and weighting - there should be no cases of z-fighting/clipping through. Of course in practice it's probably non-trivial to do this since curvature/shape of each object may vary ... anyhow, the old approach of overlaying meshes worked just fine for semi-rigid items, i'll post a web player demo when my character controller/gear tests gain a bit more traction and you can decide what you think from there.

    What I'd like to know is if you could somehow "merge" the glove mesh and the rest of the body, I've seen CombineMesh in the API, will have to investigate ... somehow I'm not optimistic that'll be an easy path to walk :) - especially considering that it would probably lose weighting for both at that point wouldn't it? Is there a way to indicate occluded polies underneath are hidden? Not sure yet, lots of poking around to do as of yet.
     
    Last edited: Nov 13, 2012
  8. Billy Jean

    Billy Jean

    Joined:
    Jan 31, 2014
    Posts:
    1
    I'm new user of unity myself, but I already have my project of the game I'm designing (almost) completed.
    This a major issue for me too.
    I didn't made a lot to this so far, but I think a solution it is...
    "alpha transparency texturizing on a prefab/clothing and using it as an attachement on a character.
    This attachment have to be scripted, with extra/additional properties of every kind (boosting protection/damage/magic/crafting e.t.c.)
    Just my humble opinion to a possible solution, coming through those I already know about "3D making things". :)
    But I'm very interested to this issue and reading all kind of ideas and practices.
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Alpha transparency texturing sounds like a way to customize some of the colors of a texture used to paint a mesh (e.g., customizable sash that can be red, green, yellow, etc.).

    But, unless it's rigid like a breastplate or a helmet, you need to rig the mesh to the skeleton. This allows cloth and other materials to move correctly as the character moves. Even rigid equipment sometimes looks better with some attachment to the skeleton.

    A common technique, as mentioned above, is to create a master model with every single piece of equipment and/or body part, all hand-rigged to look correct on the skeleton even when animated. You can attach scripts (such as stat bonuses) to each equipment mesh. Disable all equipment meshes except the ones that the character is currently wearing. Since Unity doesn't process inactive objects, they just take up memory but don't really affect performance.

    For some case studies using this technique, check out Arteria 3D's One Base Male and One Base Female sets.
     
  10. JMab

    JMab

    Joined:
    Nov 29, 2013
    Posts:
    24
    I'm no 3D artist, but I've solved this problem in my in-dev RPG by using the Unity Multipurpose Avatar (UMA):

    http://forum.unity3d.com/threads/219175-UMA-Unity-Multipurpose-Avatar-on-the-Asset-Store!

    and the latest version of Blender.

    UMA is a free add-on to Unity that gives you male and female base models that you can add clothing and armour pieces to that get added as "slots" to the model. The pieces can be textured with "overlays". UMA does some processing to combine the base model and all the slots into one big mesh, and also generates two texture atlases - for the diffuse, normal and specular components of the texture maps. Slots are scaled to the same size as the character (i.e. if you make a character half as big, or twice as big, as normal, the pieces scale along with the base model). The performance is great, even for characters with lots of clothing and armour, with different textures.

    Have a look at the UMA manual for a better description of the above, and watch the creator's YouTube videos. In one, he shows how to use the new Blender "transfer weights" functionality, to transfer vertex weights from the base model to your armour and clothing pieces.

    You make basic armour pieces really easily by copying the underlying base model faces in Blender, separating them from the base model, then pushing and pulling them around a bit, before texturing them. UMA will handle their swappability via slots and overlays...
     
    OldTrain likes this.
  11. D1v1d3m4n

    D1v1d3m4n

    Joined:
    Jul 19, 2014
    Posts:
    2
    Dude... This is what I'm looking for.