Change Character Cloths in Unity


https://forum.reallusion.com/Topic353434.aspx
Print Topic | Close Window

By carlosmelo1991 - 6 Years Ago
Hi there,

I am new using Iclone and Character Creator, I bought the pipeline licenses. I would like to know if it is possible to export characters with multiple clothing and accessories so that they can be swape in Unity at runtime.  If so, Does anyone know
 of a tutorial or instructions on how to do it?
Thank you so much!
By jaxensstore - 6 Years Ago
the easy way would to export the character out just make sure when you export character out that the mesh is not set to hide mesh when underclothing this way you can export  it all out and take to maya or blender  and put the clothing on a defrent layer  and export the  first layer by its self with out the clothing then export the clothing out next with out the character mesh given the clothing a skelton   that would let you change  the characters or change clothing it the custom character creator your making for your game  heres a link  how  one does it in unreal would be same  concept in unity but code would be done in c# or java  https://www.youtube.com/watch?v=DpMP9rnuHXU&list=PLasxJJxmNTQNmnPYYxc7y_OhG8BxCpflf&index=17
By drewdough - 5 Years Ago
bump.

Has anyone figured this out?
Is C3 even valid for this purpose?

Seems like a basic feature, to be able to decorate your own avatar, but I can't find any tutorials or guides on how to do this using C3.

Anyone have any clues?

Thanks a ton.

Drew
By Rampa - 5 Years Ago
See if this sends you in the right direction.

By lollosone - 5 Years Ago
It is fundamentally a lot of work.

You may create variants of the character with different clothes (which is suggested, since you increase the size of the asset folder, duplicating the main mesh, but you can delete anything that is below the clothing, saving a lot on the file size and memory when loading it into unity)

The other way is to export the figure naked to unity; then you export the figure with clothes on; to a 3d app;delete the character mesh leaving the bones and clothing only, so you have an invisible figure moving below the clothing; and export to unity. At that point, it is just a matter to add the clothing in the gameobject containing the naked figure, and they should match with your animation.
By dpage - 5 Years Ago
I'm running into a similiar issue. 
I've been able to dres a character in stacked clothing, export the avatar and enable and disable clothing item game objects within Unity. 

To do this you need to get around the in CC3 tagging system that generally limits one shirt or shoes or pants at a time, by assigning the item and resetting the tag using "Transfer Skin Weights" and using the setting "Other". That way I've been able to stack a bunch of outfits. For Hair, I've generally had to "Convert to an Accessory".
https://forum.reallusion.com/uploads/images/7182b161-1ade-476c-b059-86f5.jpg

However, there seems to be an arbitrary and not always consistent Limit to how many items you can get with this approach. I realized after an hour of frustration that at a certain point, adding a new layer would delete an existing item to "make room" in the hierarchy of clothes.

If anybody from RL could speak to what the limit on simultaneous items might be that would be glorious.
By Rampa - 5 Years Ago
There are 20 clothing layers. If you look in the bottom-left corner of the clothing icons, there is a number showing what layer they are on. In the Conform panel there is a layer adjustment button at the bottom of the panel. So just make sure that you have set a piece of clothing to an unused layer before loading a new piece of clothing into that same layer.

But there is also another option that may work for you. See these videos for exporting just clothing or parts of the body mesh, while keeping it rigged to the skeleton.


By glugsolro - 5 Years Ago
I've not had much success with either approach using the Beta 2 version of the import script into Unity.  

If I use Dpage's method of converting clothing to other with Transfer Skin Weights, then it removes the mesh.  I.E. if I stack pants and shorts, when I remove the pants the lower part of the character's legs are missing when the shorts are visible.  This happens even after going to each cloth layer settings and hitting the Reset Content Settings button which the docs indicate should cause it no longer auto hide the mesh.  I think the problem is actually with InstaLOD which checks the delete hidden meshes checkbox in the export window and doesn't allow you to change it.

I have a little more success with Rampa's method, though I can't opt to embed textures, doing so always causes the model to loose textures no matter what options I select on the model for textures in Unity.  If I instead export it like the tutorial for exporting characters then I get a proper looking article of clothing.  However, it's offset in position and has to be adjusted which isn't a big deal.  But it does have it's own bone structure, own animator, own animations and is still adding significantly to the file size.

Are there any other methods or suggestions on how to handle this, so that you can have LODs and have multiple clothing sets? 






By Jfrog - 5 Years Ago
Hi Rampa,

Thanks for the tutorials!   I see you are always there to help. This is appreciated!

I am just wondering... This is a great option for CC3 Characters because you are fitting the clothes to the character before exporting so they match in unity later on. But I bought a whole bunch of clothes with export licenses from Reallusion and would love to use these clothes on 
Unity humanoid characters .  Is there a way to do this? 

Thanks again.






By Rampa - 5 Years Ago
Jfrog (7/23/2019)
Hi Rampa,

Thanks for the tutorials!   I see you are always there to help. This is appreciated!

I am just wondering... This is a great option for CC3 Characters because you are fitting the clothes to the character before exporting so they match in unity later on. But I bought a whole bunch of clothes with export licenses from Reallusion and would love to use these clothes on 
Unity humanoid characters .  Is there a way to do this? 

Thanks again.

Hi Jfrog,
You can use this procedure for any clothing you have an export license for. So any CC clothing you have bought with the export. It can also work for any clothing you import and rig yourself, or transform from DAZ.

Glugsolro,
Make sure to un-check the "Delete Hidden Mesh" button in the export panel.
https://forum.reallusion.com/uploads/images/547c6ffb-e4c1-4527-886d-164b.jpg
By Jfrog - 5 Years Ago
Thanks for the quick reply Rampa.   Smile

The problem is that  I would like to apply some CC3 clothing to Unity Animal Characters such as an elephant, a girafe, an hyppopotamus etc.. (bipeds).   I just tried to import an helmet and it is a pita to try to fit it in unity.  The transform tool doesn't work too well with the imported helmet.
When trying to use the transform tools, the gost of the removed skinned body is always in the way so it is really hard to conform the helmet to the Unity head character. I don't think it will work really well trying to fit the clothes on those characters.   Wink

There is always something that doesn't work in a new pipeline. you go forward 3 steps, than you go backward 2 steps.     Smile

But thanks anyway!
By Jbowdoin - 3 Years Ago
at Rampa   https://www.youtube.com/watch?v=0ZWH7X3lvMM
this helps but how do you set the clothing to sync up in unity? the video stops before that part.

on one hand I have the extra out fit not animating or it has a copy animator thathttps://forum.reallusion.com/uploads/images/db5f6d25-04a0-4257-a927-05e5.png is out of sync  
By Jbowdoin - 3 Years Ago
another way to ward it is how can I give them a unified avatar / animator in the same way you can get the LOD's when exporting 
By felgryn - 2 Years Ago
Hi Folks,
 First off, big shout out to Rampa - always with great insights and recommendations on the Forum.
 I'm also trying to navigate the Change Character Cloths in Unity path - have tried a few different approaches.
 Although i was able to create the stand alone FBX for clothing per Rampa's earlier post and import into Unity - i'm stumped as to how to align the skin mesh renderer from the clothing with the base character.
 I either have the clothing staying in T-pose following the character but not the animation. And when i try and map the bones via scripting (per https://www.youtube.com/watch?v=ZBLvKR2E62Q&t=445s in the Brackey's RPG training) - the clothes, although animated and following the character, are mixed up in their mapping to the bone structure.
Basically, i'm trying to solve - given a CC4 generated base character with animation - and a set of clothing, let's say also ported via FBX from CC4 a la Rampa method - how can the clothing pieces be attached via skin mesh renderers to the CC4 base character in Unity - consistent with animation. 
I think there are a few paths to modular clothing solution given the above - but i am stumped on the above! Smile
Any guidance would be great appreciated - been stumped a few weeks now.
-Felgryn
 
By felgryn - 2 Years Ago
Hi Folks,

  Found an answer....
  I started down a path based upon a helpful post:
https://noahbannister.blog/2018/01/23/skinning-multiple-meshes-to-a-single-rig-in-unity/
 However, found that the keys in the associative array approach on the source bones from the CC4 clothing FBX asset were all set to zero - so, couldn't map between the arrays.
 Was about to go down a path of mapping each bone location off a t-pose to reverse engineer the keys, then a colleague pointed me to a superb free asset from BLINK in the Unity Asset Store that performs a transfer of skinned mesh renderers (i'm guessing with a similar algorithm).
https://assetstore.unity.com/packages/tools/utilities/skinned-mesh-transfer-219764
With this tool, i was able to export a body mesh and multiple pieces of clothing from CC4 via FBX into unity as separate files - and this tool enabled me to map them all to the body, and swap them on and off the character at run-time during animation scenes.  For grins - i even mapped an entire body mesh onto a base body mesh - the mapping was pretty seamless. 

 Now i'm off to building a modular gear swapping solution for my CC4 characters and clothing ported into Unity! Woohoo!

Cheers!

  -Felgryn



By Jbowdoin - 2 Years Ago
yes that video is what you want ,

I have been doing this for a awhile. what i do is expert the clothing separate from the character. 
then in unity I ad a script with the fallowing code to the clothing game objects with skin mesh renderers    
______________________________________________________________________________________________________________________________________________________________________________
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Equipmentizer : MonoBehaviour
{
    public SkinnedMeshRenderer TargetMeshRenderer;
 
    void Awake()
    {
        Dictionary<string, Transform> boneMap = new Dictionary<string, Transform>();
        foreach (Transform bone in TargetMeshRenderer.bones)
            boneMap[bone.gameObject.name] = bone;
 
 
        SkinnedMeshRenderer myRenderer = gameObject.GetComponent<SkinnedMeshRenderer>();
 
        Transform[] newBones = new Transform[myRenderer.bones.Length];
        for (int i = 0; i < myRenderer.bones.Length; ++i)
        {
            GameObject bone = myRenderer.bones[i].gameObject;
            if (!boneMap.TryGetValue(bone.name, out newBones[i]))
            {
                Debug.Log("Unable to map bone \"" + bone.name + "\" to target skeleton.");
                break;
            }
        }
        myRenderer.bones = newBones;
 
    }
}
______________________________________________________________________________________________________________________________________________________________________________
 note this dose not work for accessories.

  1. expert your character necked .
  2. expert clothing with character hiden and delete hiden mesh   
  3. in unity set clothing to be child of the necked character 
  4. add script to clothing objects 
  5. set the parameters in the inspector for the (adding the avatars body to  TargetMeshRenderer )
    and good to go.
  6. and good to go.