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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Combining character from parts... Is it Possible?

Discussion in 'General Graphics' started by Vit3D, Jul 27, 2015.

  1. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    Hi All,

    I'm new in Unity. For long time I created character for Reallusion iClone. iClone has very good feature -- possibility to replace character's body parts (Upper, Lower etc.).
    Currently I'm working at "re-building" some of my iClone content for Unity and wondering -- Is it possible to do something like this in Unity?

    I examined some content from Store and found out that if character has several cloth set, usually all sets included in the single FBX file and user can exclude unused sets from rendering ("hide" them).
    But maybe there is some alternative way?

    For example I have nude character model and pants model. I skin both of these models at the same skeleton in the same rig pose, but exported them in separate FBX files and then imported in Unity.
    Is it possible to "merge" these 2 files and animate them as single character in Unity without modifying FBX files in the external application? Or maybe there is some Unity plug-in which can do this?
    Any information will be very helpful for me.

    Chhers,
    Vit
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Modular character customization workflows is something that has been discussed on these forums for a long time Vit.
    No this workflow isn't correct (afaik). The proper workflow is to have the nude character and the pants model as separate mesh parts, skinned to the same rig/skeleton, and export together as one fbx file. When imported into Unity they will come in together, still as separate mesh objects, then you can hide/unhide at the skin mesh renderer component.
    This is my understanding, but I could be wrong. I think you loose the skin/rig linkage if exporting as separate fbx files, as the files require the bones to be included in the export, and if the bones are included in both files there will be conflicting skinning information associated when imported into Unity.

    Disclaimer: As an artist I have worked on a couple projects with modular characters, on the art side of development so the key point of my answer is that I am not a programmer, there may be additional functionality beyond my scope of knowledge which allows for meshes to be instantiated at run-time with the ability to overwrite the skinning data of clothing pieces. I know the bone count and names are very important for this process to work properly.
    Links below may contradict information provided above.

    One of the best threads about this subject -
    http://forum.unity3d.com/threads/stitch-multiple-body-parts-into-one-character.16485/
    Some other random threads about this subject -
    http://forum.unity3d.com/threads/character-creation-system-in-unity.158413/
    http://answers.unity3d.com/questions/168723/run-time-modular-characters-and-the-locomotion-sys.html
    http://answers.unity3d.com/questions/60039/best-way-to-createdesign-modular-player.html
    UMA framework offers customizable modular/morphing characters "free"
    https://www.assetstore.unity3d.com/en/#!/content/13930
    Additional links regarding this subject -
    https://www.assetstore.unity3d.com/en/#!/content/8
    http://forum.unity3d.com/threads/custom-character-system.182287/
    Cakewalk

    Happy researching! :)
     
  3. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    Many thanks for detailed reply, theANMATOR2b!

    Would like to remark, that when I told "as separate FBX" files I meant that each file will include skinned mesh and skeleton. If I'm not mistaken, in this case, will be no conflict or loosing skin information, but Unity initially will recognize them as 2 separate independent characters.
    I know that if body and clothes (or several cloth sets) will be included in single FBX file everything will be fine in Unity after import and user will be able to manipulate by mesh render to choose which character look he need.

    But reason why I raised this question some way dealt with model prices.
    It's quite reasonable that the price of the model with multiply clothes sets will be higher that price of model with single clothes. Further more on iClone market full nude character models (so called base models) usually have higher prices that separate clothes parts. After iClone user purchased base model he has opportunity to choose which character's clothes he really need for his project and does not pay extra money for complete set included clothes models he does not need at all.
    I can presuppose that Unity community consists of more advanced users that iClone community and most of them will be able to "merge" 2 skinned models in the single character in the external application, especially if these models will be specially created to "fit" each other...
    But the question -- Is it correct to publish such "construction parts" in the Unity Asset Store if Unity has no build-in "pipeline" and user will need to make some work in the external application (even if this is minimal work) before he will have final character for Unity.
    As I told in the first post, I'm working at re-building my iClone content for Unity and it's very important for me how correctly combine these content in packs for Unity Asset Store and what will be more suitable for customers.

    Cheers,
    Vit
     
  4. PropositionOne

    PropositionOne

    Joined:
    Jul 25, 2015
    Posts:
    13
    It's easier than you think... You simply child the "Mesh" part of the "pants" to the main gameobject you want to be your skeleton. Then you assign the bones of the animated skeleton (in the same order) to the "pants" SkinnedMeshRenderer component.

    Most of the grunt work takes place out of Unity - you have to make sure every "part" of your character is animated to the same skeleton with the same vertex groups. When you import it, you simply swap out the bones references under the "skinned mesh renderer" for the bones in the active animated skeleton.
     
    theANMATOR2b likes this.
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    OK - that clears up a lot. :) Your asking how best to serve the community when creating assets for the store.
    There are several character asset pipelines within Unity.
    There are a couple artists here who create UMA clothing for the base UMA characters.
    There are also several other artists who create clothing bits for there own base character they created for the asset store.
    And most use the process @PropositionOne described. UMA is different, and you have to do some research on how the process works, but other artists on here have some threads that talk about setting up UMA clothing and accessories, and even complete characters - though that seems to be a little more difficult.
     
  6. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    Thank You very much, PropositionOne!!!

    It's great news for me!
    So I understand correctly this method looks like this on the simple example:
    For example I have skeleton with this hierarchy:
    Root :
    - Bone1
    -- Bone2

    And 2 mesh objects:
    Geo1 ;
    - Mesh1

    and
    Geo2 :
    - Mesh2

    Then I rig both mesh groups on the same skeleton in the same rig pose and export to 2 separate FBX files.
    First one will have hierarchy like this:
    Root :
    - Bone1 :
    -- Bone2
    - Geo1 :
    -- Mesh1

    And second like this:
    Root :
    - Bone1 :
    -- Bone2
    - Geo2 :
    -- Mesh2


    Then I load both FBX files in the scene and drag Mesh2 (or whole Geo2+Mesh2 group) to first model hierarchy.
    As result I will have such structure in the scene:
    Root :
    - Bone1 :
    -- Bone2
    - Geo1:
    -- Mesh1
    -- Mesh2

    or (if I dragged whole Geo2+Mesh2 group)
    Root:
    - Bone1:
    -- Bone2
    - Geo1:
    -- Mesh1
    - Geo2:
    -- Mesh2

    Of course after re-parenting I set position and rotation to 0.

    Is this enough and Mesh2 will not loose original skinning information, but just will be animated by skeleton from first model?
    I asked this because I did not understand what You meant when say -
    " ...Then you assign the bones of the animated skeleton (in the same order) to the "pants"

    Please correct me if in my step-by-step description I missed something important or made mistake.

    Cheers,
    Vit
     
  7. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    To theANMATOR2b
    Many thanks for assistance again!

    Think I should explain - In my case, I already have both complete character and clothes models and all of them rigged on the same skeleton and "synchronized" to avoid body-to-skin intersection in motions.
    Of course I need to make some changes to fit all Unity requirements.
    So this will be not UMA type models but custom models with custom skeleton.
    I just submitted first character from the series, but with single clothes set.
    Here the link to the preview -
    http://forum.unity3d.com/threads/vit3d-character-s-for-unity.343517

    Hope soon it will be published if I made no mistakes in the pack preparation...
     
    theANMATOR2b likes this.
  8. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    I tested this method, unfortunately just dragging mesh object from one hierarchy to another does not work -- mesh does not animated with new skeleton. So I missed something important.

    When I drag mesh group I have request:
    "This action will lose the prefab connection. Are you sure you wish to continue?"
    When I press "Continue" geo group child to new skeleton but mesh names in the group become black, not blue.
    When I select any of moved mesh manes and move mouse over model "Select" or "Revert" buttons in Inspector I have pop-up:
    "You have broken the prefab connection. Changes to the model will not be applied to the model before you Revert"
    If I press "Revert", whole model (skeleton + mesh group) moved into new hierarchy and become the child.
    But, of course, this does not affect -- mesh does not animated with new skeleton

    @PropositionOne, unfortunately I did not find how "assign the bones of the animated skeleton" as You recommended.
    Will be very kind of You if You could post mode detailed description of this process.
    Looking forward for Your reply.

    Cheers,
    Vit
     
  9. PropositionOne

    PropositionOne

    Joined:
    Jul 25, 2015
    Posts:
    13
    I'm not absolutely sure the bones always export in the same order, but I'm going to guess they do.

    Say I have my main skeleton object. It comes with a preattached part of my mesh - say the default "nude" or something. We'll call this "Part Main"

    Then I have an object with an identical skeleton on it that has a mesh I want to attach to "Part Main" so I can animate it with "Part Main's" skeleton. We'll call this "Part Sub".

    We're assuming both "Part Sub" and "Part Main" were modeled in the 3d modelling tool using the exact same skeleton with the exact same bone names.

    First I use a script to get the bone layout from the "SkinnedMeshRenderer" on "Part Main" by accessing "PartMain.SkinnedMeshRenderer.bones" - this returns an array of Transforms IN ORDER that they need to be assigned.

    You can check to be sure both "Part Main" and "Part Sub" have the same bone order by accessing the same array, "PartSub.SkinnedMeshRenderer.bones," on "Part Sub" and then comparing the names.

    Once you have this array from "Part Main" you simply need to assign it to the same array on "Part Sub."

    I.E. (in pseudocode)

    PartSub.SkinnedMeshRenderer.bones = PartMain.SkinnedMeshRenderer.bones

    If, for some reason, "Part Sub" has a different bone order than "Part Main" in its "bones" array, then you'll need to create a new Transform[] array and assign the bones from "Part Main" in the proper order to "Part Sub."

    This is the method that worked for me, however, I'm not doing anything super complex with my multi-part mesh (I.E. I don't need special colliders for the different mesh parts or anything), so it's possible that there are other problems that can arise from this method under some circumstances that I am unaware of.

    I don't really know why you'd have only one material for a component based mesh - but if you do only have one material, this increases the complexity quite a bit and I can't advise you: http://answers.unity3d.com/questions/625243/combining-skinned-meshes-1.html
     
    Last edited: Jul 30, 2015
  10. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    @PropositionOne, A lot of thanks for detailed description!

    Unfortunately I do not have deep knowledge in codding, but will try to test Your recommendations with my models.
    I created all my models in 3ds Max and usually export base character and clothes from the same scene, but have no idea whether bone order will be re-sorted on export and import in Unity, so this should be tested.

    There is another post on forum, which I found very useful for solving this problem -
    http://forum.unity3d.com/threads/stitch-multiple-body-parts-into-one-character.16485
    The post included example script which partly work for me, but have some issues.
    If I'll find complete solution I will report about it here.

    Cheers,
    Vit
     
    unity_2e_7kz8DqNKDjA likes this.
  11. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,511
  12. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    @aer0ace, Many thanks for information!
    You created excellent and very helpful tutorial. Great job!!!
     
  13. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    Hi All,

    Think that finally I found out how to do this :) !
    I even created short script to do this automatically.
    This script added new part to the character and created Prefab of result. You just need manually define material for just added part and Prefab will be ready to use in Your projects.

    I tested this script on my character models and for a while did not found any issues -- All animations created for source character work fine with prefab.
    I did not tested it in the "complex" situation (with collisions, additional controllers etc.) but hope it will cause no problems.

    Cheers,
    Vit
     
    Last edited: Oct 4, 2015
    theANMATOR2b likes this.