Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

Discussion in 'Assets and Asset Store' started by FernandoRibeiro, Dec 24, 2013.

  1. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    205
    gman, kenamis, hopeful and 1 other person like this.
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You'll have to re-cache the DNA after the character is actually built, and the new umaData is created/assigned.
    I'm not seeing any issues when loading/saving from the menu items - I wrote some sample load/save using the editor dialogs, and it worked OK, even changing sex.

    If you call it like this, do you still see the problem?

    Code (CSharp):
    1.        
    2. public void SaveClick()
    3.         {
    4.             #if UNITY_EDITOR
    5.  
    6.             string Path = UnityEditor.EditorUtility.SaveFilePanel("Save Character as text","","MyCharacterRecipe.txt","txt");
    7.             if (Path.Length != 0)
    8.             {
    9.                 string s = Avatar.GetCurrentRecipe(false);
    10.                 System.IO.File.WriteAllText(Path,s);
    11.             }
    12.             #endif
    13.         }
    14.  
    15.         public void LoadClick()
    16.         {
    17.             #if UNITY_EDITOR
    18.  
    19.             string Path = UnityEditor.EditorUtility.OpenFilePanelWithFilters("Load Character from text file","",new string[] {"TextFiles","txt"});
    20.             if (Path.Length != 0)
    21.             {
    22.                 string s = System.IO.File.ReadAllText(Path);
    23.                 Avatar.LoadFromRecipeString(s); // if this were new, would use SetLoadString instead, so it loads it after the avatar is initialized.
    24.             }
    25.             #endif
    26.         }

     
    malkere likes this.
  3. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    It's probably best to try to get it working on a regular Model non-UMA model first.

    The problem is somewhere in your animator graph, something is not exiting or changing the animation right. You should look into the transitions, maybe a blendtree if it has one.
     
    hopeful likes this.
  4. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    @Jaimi will try it when I get home! Thanks for looking at it.
     
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    As Jaimi noted above, it's best to get your animations working properly with a non-UMA model, then transfer it over. Whatever is working on a humanoid model like Ethan should also work on a standard humanoid UMA.
     
  6. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    After upgrading uma to 2.6 I receive a "Overlay 'MaleEyes' doesn't have the expected UMA Material: 'UMA_Diffuse_Normal_Metallic'" error when generating my uma (it's the first slot). I already tried to recreate my slot/overlay, but the error still shows up. I'm on unity 5.4.

    The overlay is using the UMA_Diffuse_Normal_Metallic material.

    Debugs:

    Code (CSharp):
    1. Debug.Log(asset.material);
    2.  
    3.             Debug.Log(targetMaterial.material);
    4.  
    5.             Debug.Log(asset.material.name);
    6.  
    7.             Debug.Log(targetMaterial.material.name);
    8.  
    9.             Debug.Log(asset.material != targetMaterial);
    10.  
    11.             Debug.Log(asset.material.Equals(targetMaterial));
    Code (CSharp):
    1.  
    2. UMA_Diffuse_Normal_Metallic (UMA.UMAMaterial)
    3. UnityEngine.Debug:Log(Object)
    4.  
    5. UMA_Mat_Diffuse_Normal_Metallic (UnityEngine.Material)
    6. UnityEngine.Debug:Log(Object)
    7.  
    8. UMA_Diffuse_Normal_Metallic
    9. UnityEngine.Debug:Log(Object)
    10.  
    11. UMA_Mat_Diffuse_Normal_Metallic
    12. UnityEngine.Debug:Log(Object)
    13.  
    14. True
    15.  
    16. False
    17.  
    So it seems like the validate function tries to compare a UMA.UMAMaterial with UnityEngine.Material. The slot & overlay comes from an asset bundle created by our internal build pipeline.
     
  7. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    @Jaimi that is working! I will try and fix my DNA breaks now

    add: working now, thanks again! Just have to make sure to wait a frame after the load to refresh the DNA. it won't latch on in the same frame.

    I still get the hair bugging every 7th rebuild, and then every 9th rebuild, then 7th, then 9th, repeatedly...?? weird

    also, is there a way to save the current wardrobe library?
     
    Last edited: Aug 2, 2017
  8. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Are you including the material in the asset bundle? My guess is then that you have two materials with the same name, and the slot or base overlay have one, and the new one has another. Can you check to see if this is the case?



     
  9. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Not sure on the hair - sounds like some compile issue, but I'm at a loss. I can't duplicate it here. I actually switched shaders for the hair myself, and use this one now:

    https://forum.unity3d.com/threads/olanders-genesis-hair-shader-free-and-or-donate.410372/

    It's not quite as fancy as the one in lux, but that's a bit heavier: ( https://www.assetstore.unity3d.com/en/#!/content/16000 )

    for the wardrobe library - what are you looking for? There is a WardrobeCollection that might be applicable if you are looking for a container you can store wardrobe items in.
     
    malkere likes this.
  10. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    @malkere regards the materials in assetbundles thing, its not a problem to have UMAMaterials in your assetbundles, but what you will find is that, if you are targeting Android or iOS materials loaded from asset bundles wont show exactly right in the editor, because they use the shaders for that platform that get included in the asset bundle. In my experience this usually means that normal maps and reflections dont work right when you are previewing in the editor. They will look fine in actual android/ios builds though.

    The other gotcha as with all uma assets is that you need to use unique names for everything, so if you have assetbundleA that has 'MyGreatMaterial' in and assetBundleB that also has 'MyGreatMaterial' in it will use the first one it finds, which may not be the one you intended.

    The other thing to know is that when you build your assetBundles, if assets in those assetBundles, are dependent on other assets and they are not referenced directly by any scenes, and are not in the Resources folder (or UMA Global Library) and not in any assetbundle (they wont be in the build basically) those assets will get bundled into that asset bundle. This is just how Unity asset bundles work.

    What I do to ensure the materials that are used are always coming from where I want them to, is make a 'materials' asset bundle, that way anything that uses a given material will get it from that bundle.

    Unity has a great recent tool, that lets you see what exactly will happen to your bundles when you build them, what their dependencies are etc that I find really useful:
    https://www.assetstore.unity3d.com/en/#!/content/93571

    Hope that is helpful :)
     
    malkere, hopeful and Jaimi like this.
  11. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    it is very odd.. especially since I moved the whole "character studio" bit of my game into a new project with minimal assets and I still get it? I'll keep playing with it though, fine as a "known bug" for now.

    As for the global wardrobe, I've just had to remove a lot of stuff after it builds itself because I don't want the default shirts, etc... I suppose I could just delete them from the project, or other workarounds, I was just curious if there was an easy output of the global wardrobe in its current state. Not at all necessity if that's not something readily available.
     
  12. phosphorous_

    phosphorous_

    Joined:
    Jul 25, 2016
    Posts:
    30
    So I have been trying to create an UMA race from my own models, but no success so far. I followed this tutorial from Secret Anorak where he takes an monster model from asset store and converts it to UMA:



    I have added the Root -> Global -> Position bones, created RaceData, BaseRecipe and Slots, but then I get this error when trying to play the scene:
    I have no idea what is wrong, would be nice if someone knew how to help!

    Couple questions:
    1. What are the required rotations for the Root -> Global -> Position -> Hips bones? Is there any example model somewhere?
    2. Has anyone been able to create your own race succesfully and do you have any insight regarding this?
     
  13. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    @phosphorous_ Did you extract the T pose? is your Hips bone called "Hips"? If not, you could try that. The avatar in this context is for the animator and mecanim and it's saying it's failing to find the link of the avatar hips bone to your hip bone in your model. From your model's fbx, go to "configure avatar" and does it associate the correct bone in your model to the "Hip"?

    The human male and female are examples. If you want the model in various modeling program formats: https://github.com/umasteeringgroup/content-pack
     
    hopeful and ecurtz like this.
  14. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    They're in the Global Library, which is at \Assets\UMA\InternalDataStore\InGame\Resources\AssetIndexer.prefab
    However, no easy way to separate them. You might try adding the ones you don't want to a bogus AssetBundle, then the add will ignore them.
     
    boysenberry likes this.
  15. phosphorous_

    phosphorous_

    Joined:
    Jul 25, 2016
    Posts:
    30
    Yes, all of this seems to be as it should. I was able to get past this problem. It seems that is was related to me not having a slot assigned to all of the bones and not having any overlays? (seems weird)

    Now I am getting an UMA from my race, but I am having problems with the rotations. The character is laying horizontally on the ground when supposed to be standing and the arms in wrong side of the body as well...

    I think this is related to the root bone rotations? Or how sensitive UMA generally is to different kind of skeletons (some bones rotated differently)? My rig is normally compatible with Mecanim.
     
  16. Collywobbles

    Collywobbles

    Joined:
    Nov 10, 2014
    Posts:
    14
    Okay, I have a question. If I want to create a loose-fitting t-shirt and also hide the parts of the underlying body mesh (so that it doesn't poke through), do I need to create a whole new body slot? If so, how do I make sure my new skin parts match the rest of the body skin parts?
     
  17. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    The character laying horizontally sounds like you're missing a 90 degree rotation on either the global or position bone, refer to the human races as an example. The built in rotations are due to an old unity bug I believe. The arms on the wrong side I've seen before, it's due to an up axis 180 degree rotation that needs to be cleared. If you can't seem to fix it, send me a PM and, if you don't mind, I can take a look at your project.
     
  18. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Currently, you can hide the base mesh slots (head, torso, legs, etc) in a wardrobe recipe. If you need to show only parts of that mesh slot, currently, you'll have to create a copy of that mesh slot and edit it and create a new slot out of it, then include it on your wardrobe recipe.

    This is somewhat a common issue and there is a use case where the current solution breaks down so we've created a new feature for the next release.

    If you want to try it now, it's in the "AdvancedMeshHiding" branch on github, but's it's not fully tested yet.

    EDIT:
    Also, if creating a new slot, to match the skin, you'll just need to set your shared color to the same as the skin. I believe it's called "Skin".
     
    Moerk75, hopeful and cwmanley like this.
  19. Collywobbles

    Collywobbles

    Joined:
    Nov 10, 2014
    Posts:
    14
    That looks great! Should solve my problem :)
     
  20. phosphorous_

    phosphorous_

    Joined:
    Jul 25, 2016
    Posts:
    30
    Thanks for your help! I managed to get everything working now. I spent the whole day yesterday trying to get the bone structure (root->global->position) and rotations right in Blender (thats what the character artist used to create the models in), but just could not get it right. Then a friend of mine suggested trying it in 3ds Max we got everything working just by parenting the hips under the rig from "Male_Unified.fbx" in the content pack.

    So personally I can't recommend using Blender with this process...
     
  21. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    UMA was created on blender originally.
     
    hopeful likes this.
  22. zephlord21

    zephlord21

    Joined:
    Jun 9, 2016
    Posts:
    4
    Hello,
    I am now sending my umatextrecipe directly as a JSON, but the DNA is still not changing. I even tried Doing partial saves for the wardrobe, colors, and DNA and sending those, but the DNA is still set to the race default. Any idea what may be causing this?
     
  23. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Ordering issue maybe? How are you loading the character? Are you doing any processing in any of the events on the DCA?
     
  24. Pomelo874

    Pomelo874

    Joined:
    May 31, 2017
    Posts:
    22
    @Jaimi Thanks for your advice about glasses, here we go:), Only looks weird when eyes rotation 788.gif
     
    Jaimi and kenamis like this.
  25. zephlord21

    zephlord21

    Joined:
    Jun 9, 2016
    Posts:
    4
    I am not quite sure what you mean by processing. I am loading the character with
    _avatar.LoadFromRecipeString(_recipeString)
    When I try doing the partials, the order is DNA, Colors, Wardrobe.
     
  26. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I'm meaning, how are you applying this? Do you create a new prefab, then use LoadFromRecipeString() before ever generating it? Are you loading the avatar, and then doing anything else to the avatar (setting colors, changing DNA manually, etc) as well?

    If you create a new prefab then you have to use SetLoadString() to set the recipe on the avatar - LoadFromRecipe string works on generated avatars.
     
  27. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    I see a new version of UMA is up: 2.6.1.

    Always happy to see new releases! :)
     
  28. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    neoshaman, ecurtz and kenamis like this.
  29. m0rr0ws0n

    m0rr0ws0n

    Joined:
    Sep 18, 2014
    Posts:
    65
    Hello I need more help on how to get this to work to its full potential. I want to make an rpg and I followed secret anoraks tutorials, loaded a model in by creating my own race. I messed around and made a basic character customization thing with the stock UMA models but how do I save the models out. It's like this:

    1. Make a base model (i think I figured out how to do this by creating my own race.)
    2. Create clothes for my model (I haven't done this yet but aren't secret anoraks tutorials cover this with slots?)
    3. Add clothes (slots) to the base model (not sure how to connect it all up to add slots to a race I created)
    4. Save out the base mesh and its clothes slots as the current character
    5. Play game
    6. Pick up armor in game and put on new armor (Going back to number 3. Creating new slots and rebuilding the current character mesh right? how do you do this?)

    How do I do 3 4 and 6?
     
  30. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Take a look at the demo scenes that come with UMA. They show you how to add or remove clothing items.

    Conceptually, you need a basic full character model, then a version of that model that has been broken into segments we call slots. UMA provides you with a human male and female, but you can make your own.

    Clothing is created in a 3D modeling program like Blender. The clothing is weighted to the body mesh, and when the character is assembled at runtime, the clothing and body parts you specify in a recipe are stitched together.

    So first you add your body and clothing slots (meshes) and overlays (textures) to the global library, then you create recipes, which are lists of which slots and overlays should be used to make a specific character. When you feed one of these recipes to the proper field on the proper UMA component on your character, the recipe will be built.

    If you want to change the look of a character during the game, basically you edit the recipe and rebuild the character. Onscreen the change will happen instantly. Look at the demo scenes for tips on how to do character modification.
     
    Last edited: Aug 13, 2017
    Jaimi and kenamis like this.
  31. Collywobbles

    Collywobbles

    Joined:
    Nov 10, 2014
    Posts:
    14
    Is there some better way to check if an Avatar has fully loaded? I have to use a small delay before trying to load the DNA. If I don't do this, the Avatar.GetAllDNA() returns an array of zero length.

    Code (CSharp):
    1.         void Start()
    2.         {
    3.             StartCoroutine(CreateCustomiser());
    4.         }
    5.  
    6.         IEnumerator CreateCustomiser()
    7.         {
    8.             yield return new WaitForSeconds(1.0f);
    9.  
    10.             Debug.Log("Initialising face editor...");
    11.             faceEditor.Initialize(avatar);
    12.         }
    Code (CSharp):
    1.         public void Initialize(DynamicCharacterAvatar Avatar)
    2.         {
    3.             Debug.Log("Fetching all DNA");
    4.  
    5.             UMADnaBase[] DNA = Avatar.GetAllDNA();
    6.         }
     
  32. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    There are some events raised that you can use. CharacterCreated, CharacterDestroyed, CharacterDnaUpdated, and RecipeUpdated. You'd probably want to use the CharacterCreated event. If you want to hook it up in the editor they can be found under "Character Events" on the DynamicCharacterAvatar.
     
  33. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Just playing around with some of Will's clothing in a sample level. Nice how you can change the colors and make things look more like leather:

    Wanderer.jpg
     
    Pomelo874, Teila, runningbird and 4 others like this.
  34. m0rr0ws0n

    m0rr0ws0n

    Joined:
    Sep 18, 2014
    Posts:
    65

    Hi I looked in the sample project particularly the UMA DCS Demo - simple setup scene. I wrote something like in the sample where I try to change the hair. It works on the standard human male model but it says "the given key was not present in the dictionary". This line

    List<UMATextRecipe> SlotRecipe = Avatar.AvailableRecipes["Hair"];

    is the dictionary key thats not working. I looked on the race data under wardrobe slots and it says "Hair" for my custom model. What else do I need to do to get the hair to show? o_O

    I'm still not understanding how the whole thing works....is there a video or something you can point me to that explains it?
     
  35. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Quick question: is there an easy way to remove the rigidbody + collider from my DCS avatar without doing it from script at runtime? Is it attached to a prefab or recipe somewhere in the core content?
     
  36. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    There may be a Capsule Collider being added in Advanced Options -> Uma Additional Recipes. If you copied the Dynamic Character Avatar component from one of the example scenes, it's probably there.
     
    Jaimi likes this.
  37. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Awesome! Thanks.
     
  38. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Another thing: I saw way earlier in the thread that you could attach things to the skeleton by attaching them to the prefab that gets used for the rig, in the latest version thats in uma content -> uma core -> humanmale -> racedata, there's a prefab that contains the entire skeleton, but when i parent an attach point for weapons to the hand bone to that prefab and re-save it, its not appearing on the uma avatar I get generated by DCS... clearly I'm missing a step but I'm not sure what?
     
  39. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You have to write a script to find the generated bone and attach it at runtime. Easiest thing to do is to do it on the created event. We're looking at ways to make this process better.
     
  40. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Interesting... that post I'm referring to must've been an older post then? What exactly does that prefab with the skeleton attach get used for then?
     
  41. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Not sure - can you post a link to the post in question?
     
  42. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
  43. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Yeah, that's from version 1.0 - from before I was involved. The functionality seems pretty cool, so I'm not sure why it was removed. I'll ask around, we need to have some sort of similar functionality, but I'm not sure how well this would work in the current code base.
     
  44. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    I think what you're looking for is in WardrobeHandler.cs, specifcally
    Code (csharp):
    1.  
    2.             // We have a recipe.
    3.             // The wardrobe slot is defined in the recipe itself, so setting a recipe is all
    4.             // that is needed to "put on" a wardrobe item.
    5.             // Any recipe that already exists at that slot will be removed - so, for example,
    6.             // putting on a shirt will replace the existing shirt if one exists.
    7.             Avatar.SetSlot(Recipe);
    8.             // Rebuild the character so its wearing the new wardrobe item.
    9.             Avatar.BuildCharacter();
    10.             Avatar.ForceUpdate(true, true, true);
    11.  
    Here's a good newer series
    https://www.youtube.com/playlist?list=PL2R4tvBs-r1nn5Oyt6oLGJCOEJo0Txavu
     
    hopeful likes this.
  45. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Most likely thing here is that there are no wardrobe recipes for "Hair" defined for the avatars race. If your avatar is based on one of the existing races, it needs to be marked compatible with that race.
     
  46. m0rr0ws0n

    m0rr0ws0n

    Joined:
    Sep 18, 2014
    Posts:
    65
    How do I set which slot goes where? Right now my character is just one mesh. I've been looking all over for some options or something but I don't see them. Also when I add a default wardrobe item such as MaleHair2, it doesn't animate and it's not exactly on the head. :eek:
     
  47. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    When you create a wardrobe recipe, you can specify what "wardrobe slot" it is (like "Hair"), and what race it applies to. The recipe lets you specify the slots and overlays for the wardrobe item. There's a help file thats included that has more information. If you create your own race with your own mesh, you'll need to create your own slots for the hair (etc). Basically, it's just loading the mesh up into Blender (or whatever), and fitting it to your model, then exporting it and building the slot with the slot builder. SecretAnorak has a good tutorial for 3dsmax here:



    If you use Blender, wigifer has a good tutorial here:



    These both concentrate on clothing, but hair is the exact same.
     
    runningbird likes this.
  48. m0rr0ws0n

    m0rr0ws0n

    Joined:
    Sep 18, 2014
    Posts:
    65
    wierd so i made a shirt to test it out. I exported the bones and the shirt mesh into unity but now I can't drag the mesh into the slot mesh slot in the slot builder. It's pretty easy I've done it before but its not working now. I opened the shirt file and got the one on the inside.


    -edit- Im not getting a skinned mesh renderer on my model when I put it into unity...any idea why?

    -edit- got the shirt in...but its all messed up. Not sure why :eek: I made it like a shirt in maya but it looks like he has wings or something...it's completely destroyed.
     
    Last edited: Aug 17, 2017
  49. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Sounds like the shirt isn't weighted or exported correctly. If you're using Blender, look at the fbx export options, make sure they are set to forward axis=Z forward, up axis = Y up. if that doesn't help, check all the bone weights.
     
  50. Gervais60

    Gervais60

    Joined:
    Apr 7, 2016
    Posts:
    37
    Hi Jaimi

    I did ask a few page back about if it was possible to integrate with the Invector TPC and you did say that you would look into it

    I was wandering if you did have any chance to get to a point where this will be possible. Can you give me any status on this request and when it could be available.

    Thanks I know that you are very busy