Profile Picture

Change Character Cloths in Unity

Posted By carlosmelo1991 4 Years Ago
You don't have permission to rate!
Author
Message
Jfrog
Jfrog
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)

Group: Forum Members
Last Active: Last Week
Posts: 608, Visits: 4.3K
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!

Ryzen R9 5950x, RTX 3090, 128Gb Ram ,2 x 2 TB Samsung 980 Pro M.2 SSD

Immersive Sound VR on Oculus TV
Jbowdoin
Jbowdoin
Posted Last Year
View Quick Profile
Veteran Member

Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 87, Visits: 523
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  
Jbowdoin
Jbowdoin
Posted Last Year
View Quick Profile
Veteran Member

Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 87, Visits: 523
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 
felgryn
felgryn
Posted 3 Months Ago
View Quick Profile
Senior Member

Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)

Group: Forum Members
Last Active: 2 days ago
Posts: 9, Visits: 217
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
 
Edited
3 Months Ago by felgryn
felgryn
felgryn
Posted 3 Months Ago
View Quick Profile
Senior Member

Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)Senior Member (283 reputation)

Group: Forum Members
Last Active: 2 days ago
Posts: 9, Visits: 217
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



Edited
3 Months Ago by felgryn
Jbowdoin
Jbowdoin
Posted 2 Months Ago
View Quick Profile
Veteran Member

Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)Veteran Member (802 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 87, Visits: 523
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.



Reading This Topic