Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. Kst001

    Kst001

    Joined:
    Sep 14, 2021
    Posts:
    16
    Got it, thanks for the reply.

    Let's say I have a t-shirt, pants, long shoes and a coat. Currently, to solve clipping I need 3 Mesh Hide assets for coat alone. I might have hundreds of clothes which means number of Mesh Hide assets might get very big. What I would prefer is to have one Mesh Hide asset, which t-shirt, pants, and shoes would use. Is something like that possible?
     
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Mesh hide assets are specific to the triangles being hidden. So if the same triangles are hidden, you can reuse the mesh hide asset. You may also want to consider the following:

    1. Splitting you meshes up into more slots, so you can hide slots instead of using Mesh Hide Assets where possible.
    2. Designing your clothing so that the outer layers float above the lower layers.
    3. Suppressing slots that don't need to be used (example, when putting on an overcoat that completely hides the shirt and legs, simply suppressing the shirt and legs slots).

    In addition, there is a new feature coming in the next version that works for hats & hair (a particularly problematic area for this). This feature "smooshes" the hair down against the head when it is under a hat. It relies on creating a hair clipping plane that can be reused. Overhead seems to be about 3ms. As well, there is a "equip this slot when this other slot is equipped, and hide the other slot" mechanism coming. So you can in essence, turn off certain slots and replace them when specific slots are equipped -- example, you may want to replace a shirt with a simple "collar" slot, when equipping a coat, or a hat-specific hair (but only when long hair is already on the model).
     
    hopeful likes this.
  3. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    Hey Jaimi, may I ask what you would prefer to use to fix cloth clipping when combining multiple layers of clothes in a mobile app with a lot of cloth?

    I've already tried using raycasting at runtime to hide the meshes, but unfortunately, it's quite slow on mobile devices.

    I also attempted to set the render order for the cloth layers and use a shader that discards fragments beyond a certain depth from the layers. It works when the cloth segments match, but it fails when the clothes poke out to the side.

    Adding more slots, as you suggested in a previous chat, would probably fix most of the cases, but it seems like a lot of work for artists to divide the clothes into slots.

    Maybe you have any other ideas or suggestions that I could try?

    Thank you in advance.
     
    Last edited: Jun 7, 2023
  4. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    For the hair, I am using the physics raycasting. I'll be releasing this in a week or two (famous last words), and the speed seems pretty quick, if you want to try something similar. (after the character is built, I generate an empty physics scene, then using the physics raycast for each vertex to the mesh). For the hair, this is fine, because I'm basically raycasting a subset of the vertexes (the hair) to a subset of the mesh (the head). But for a more robust system, it might need quite a bit of optimization.

    Another way to do this might be with blendshapes - make a "smooshed" version of a slot, and then whenever you put anything over it, setting the smooshed version blendshape on.

    But personally, I handle almost all of this in the modelling app. Most of the problems come up with pants/shirts, so I test every pants vs every shirt, and make sure the pants don't stick out.
     
  5. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Hello. Everytime I go to build my addressables I get this problem:
    upload_2023-6-9_14-56-33.png
    If I remove everything and add it to global again then I don't have a problem. Is there a way to avoid having to do this everytime?
     
  6. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Are you manually managing the addressables, or letting UMA do it using the "Generate single group (fast)" option?
     
  7. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    I followed the addressables instructions for UMA. It would be "Generate single group (fast)". upload_2023-6-11_7-45-51.png
     
  8. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    OK - I think that's warning you that some items are in resources, and some in asset bundles. You need to clear the references in the library as part of your build script. Here is the code from our build script

    This should be called BEFORE BuildPlayerContent:

    Code (CSharp):
    1.         /// <summary>
    2.         /// UMA assets must have addressable labels that specify what recipe they load with. In addition,
    3.         /// the materials need to be stripped from the items so we do not have duplicate shaders and duplicate
    4.         /// template materials loaded into the bundles (and into memory).
    5.         /// </summary>
    6.         public static void GenerateUMAAddressables()
    7.         {
    8.             // Clear the index, rebuild the type arrays, and then query to project for the indexed types, and
    9.             // add everything to the index. Do not add the text assets (only needed if loading characters from resources)
    10.             UMAAssetIndexer assetIndex = UMAAssetIndexer.Instance;
    11.             try
    12.             {
    13.                 assetIndex.PrepareBuild();
    14.             }
    15.             catch (Exception ex)
    16.             {
    17.                 Debug.LogException(ex);
    18.             }
    19.  
    20.             // Generate all UMA addressable labels by recipe. Every recipe gets a unique label, so when that
    21.             // recipe needs to be loaded, all bundles that contain that item are demand loaded into memory.
    22.             // they are unloaded when there is no active character using any of the assets.
    23.             UMAAddressablesSupport.Instance.GenerateAddressables(new SingleGroupGenerator { ClearMaterials = true });
    24.  
    25.             // Make sure that the global library has a reference to every item that is not addressable.
    26.             // This ensures that they item is included in resources. (Since the items are built dynamically,
    27.             // they must be able to be loaded at runtime either through addressable bundles or resources).
    28.             assetIndex.AddReferences();
    29.         }
    after you call BuildPlayerContent, you should then run this function to fix the materials:


    Code (CSharp):
    1.         /// <summary>
    2.         /// This will reset the materials on the assets by looking up the materials in the library.
    3.         /// This needs to happen after the bundles are built.
    4.         /// </summary>
    5.         public static void UMAPostBuildMaterialUpdate()
    6.         {
    7.             try
    8.             {
    9.                 UMAAssetIndexer.Instance.PostBuildMaterialFixup();
    10.             }
    11.             catch (Exception ex)
    12.             {
    13.                 Debug.Log($"Adding UMA resource references failed with exception {ex.Message}");
    14.             }
    15.         }

    Or you can do this manually from the GlobalLibrary window -
    1. File/Clear References
    2. Addressables/Generators/Single Group (Final Build Only)
    3. Build your app
    4. Addressables/Generators/Postbuild Material Fixup
     
  9. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Great thanks for the help!
     
  10. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    I am having a strange problem that only happens when the game is built,
    What appears to be the eyes causing a huge amount of bloom.
    It doesn't happen when playing it in the editor only in the built game.
    Any ideas?
     
  11. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Not really, but you might try modifying the alpha channel on the eyes texture(s) - if it's 0, fill it with one, or vice versa.
     
  12. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Is UMA 2.12 the latest version?
     
  13. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    It's the latest release version. But on Github, there is much later and more improved version that is currently in it's 3rd alpha here:

    https://github.com/umasteeringgroup/UMA/releases/tag/v2.13a3

    There is a SQL debugging script in the folder that you may need to delete. It will be easy to find.
     
  14. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Ok thanks.
    In the scene where I am getting the bloom problem(from the eyes) I see these errors.
    upload_2023-6-12_9-29-8.png
    Looks like something to do with the UMAPackedRecipeBase.
    Let me know if you have any ideas.
     
  15. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    I figured out that it is coming from the eyebrows(not the eyes). I don't see anything strange with the textures/materials.
    I have reflections/emission/specular highlights all off.
    upload_2023-6-12_10-19-4.png
     
  16. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Another strange thing is it only happens in one scene. Can't figure it out for the life of me.
     
  17. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Have you tried rebuilding the lighting data for the scene? Or adjusting the properties of the generated material on the SMR to see if there is something setup incorrectly?
     
  18. happu2

    happu2

    Joined:
    Jul 15, 2019
    Posts:
    3
    Hi,
    I am trying to create UMA model with some cards in hand which will animate through model animation. Without UMA it can be done by enabling those cards transform in avatar-mask and apply this avatar mask in animation clip. How can I create UMA model with cards in hand and achieve this implementation with UMA model.
     
  19. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA creates a regular skinned mesh, so you can use the same method. However, the hierarchy is different if you are animating using generic animations, so be sure to either use an exported UMA Model (the Unlogick exporter is the only known fbx exporter that works) or use the animation retarget tool in UMA to make sure the hierarchy is the same as your animation.
     
    happu2 likes this.
  20. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    Hi, when I set and clear slots, the main thread freezes for several seconds. Is there any way to do it asynchronously? Also, maybe you have any suggestions for optimizing to reduce freeze time?

    Thank you in advance.

    upload_2023-6-21_12-52-46.png
     
  21. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Something is wrong there - I wouldn't expect Merging overlays to be any kind of time consumer. What do your recipes look like? Do you have hundreds or thousands of colors?
     
    happu2 likes this.
  22. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    I'm not sure how to calculate the colors exactly, but if they combine from each slot, then yes, I'll have over a hundred.

    My character is divided into 96 parts and dressed in four layers of clothing, each of which is also divided into parts. I use this division to fix clipping problems.

    Here's an example of one piece of clothing:
    upload_2023-6-22_0-25-57.png

    May help:
    upload_2023-6-22_0-24-32.png
     

    Attached Files:

  23. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    Here are a few more places that are causing the main thread to freeze:
    upload_2023-6-22_9-24-58.png
     
  24. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Accessing and setting Blendshapes using the existing API is very slow in Unity. There's nothing that can be done about this until Unity addresses the issue. The more slots you have, the slower it is. The more blendshapes you have, the slower it is. The large number of slots that you are using is having a compounding effect. For example, if you had 10 slots in the merge above, you would be accessing all slots 100 times in the merge. But if you have 96 parts, the you are accessing them 9216 times. For Blendshapes, there are things you can do to limit the number of blendshapes that need to be added - by providing only the blendshapes you need using the "additional blendshapes slots".

    But to be honest, my gut feel is that this method of mesh hiding is not going to work well. I would suggest that using a much smaller number of base slots (like hands/legs/arms/torso/head) for the "big hitters", and then using "Mesh Hide Assets" to hide any additional geometry that might be needed, would be seriously more performant.
     
  25. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    In my project I focus on character customization, so a large variety of clothing options is planned.

    I have already tried the option with a small number of "Base Slots" and using "Mesh Hide Assets," but unfortunately, it requires too much work when adding new clothing. For example, if I add a jacket with a non-standard cut, I have to check each piece of clothing in the lower layer, and in the worst case, create "Mesh Hide Assets" for each of them.

    If I limit myself to just slots, I won't need to check each piece of clothing since the layout will be the same for each layer. A similar division is used in Star Citizen, but with fewer parts: https://half4.xyz/index.php/2020/10/22/character-clothing-zone-culling/

    BTW, is it possible to disable merging and enable it only when I finish dressing the character? In that case, I would perform the merging only when exiting the menu, once the character is fully dressed.
     
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,683
    Can you do more of the clothing under layers - like shirts, sweater vests, etc. - with overlays that use height maps to simulate depth? Then the outer layer items are your main slots using mesh hide.

    IDK if that would work, just spitballing.
     
  27. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I would also think that having mesh hide assets to mimic the regions (instead of specific mesh hide assets for everything) would work as well.

    @jurijc - Have you tried in a release build? A lot of the NativeArray code is doing a lot of bounds checking (etc) that makes them slower in the editor than in a release build.
     
    hopeful likes this.
  28. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,683
    I can see that, though I suppose it depends on the clothing.
     
  29. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    Yes, I tried something similar and it works when only depth checking is needed. However, a problem arises when the lower layer poke out to the side and the upper layer doesn't have any segments behind it.
    Code (CSharp):
    1.             half4 frag(Varyings IN) : SV_Target
    2.             {
    3.                 float2 UV = IN.positionHCS.xy / _ScaledScreenParams.xy;
    4.  
    5.                 float depth = SampleSceneDepth(UV);
    6.                 float depthDifference = depth - IN.positionHCS.z;
    7.                 if (depth > IN.positionHCS.z && depthDifference > _Threshold)
    8.                     discard;
    9.  
    10.                 return half4(0,0,0,1);
    11.             }
    upload_2023-6-23_11-22-24.png
     
  30. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    Yes, I tried building the release version, and it runs faster, but unfortunately, there's still a noticeable freezing.
     
  31. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I have a beta of the next version coming up this weekend that will be posted to Github for testing prior to updating on the asset store. If you are on 2.12, it has some more speed improvements. But otherwise, my suggestion is to turn off blendshapes that are not needed.
     
  32. jurijc

    jurijc

    Joined:
    Jul 17, 2019
    Posts:
    13
    Thanks for the info and help, Jaimi. I'll definitely try the new version.
     
  33. happu2

    happu2

    Joined:
    Jul 15, 2019
    Posts:
    3
    Hi,
    When I make a change in the race slot and update it with the BuildCharacter method my loop animation is resetting. How can I update the recipe without affecting the animator?
     
  34. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    New version is delayed a few days - hoping to have it up later tonight
     
    hopeful likes this.
  35. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    If you change the race, then it reloads the animator. This is because the skeleton and mecanim avatar change.
     
  36. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    I'm get some errors when my game first loads. It seems to run and work fine afterwards. Any idea what these errors are and how to fix?

    Note: I am not even using UMA when the errors happen.
    upload_2023-6-27_15-1-32.png
     
  37. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You have a recipe selected, and the editor is trying to show it in the inspector. If you are using addressables, the slots/overlays are not available at runtime until loaded, so the recipe editor will throw errors.
    The simple fix is to select something other than a recipe so the editor is not displaying.
     
    hopeful likes this.
  38. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Thank you that fixed it.
    Having a different problem now.

    Can't seem to edit a mesh hide asset.
    I am using Unity 2022.3.2f1

    I create a new Mesh Hide Asset, set the slot and hit Begin editing. The screen flashes for a quick second then nothing happens.
     
  39. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I believe there were changes for R2022 in the latest alpha. Sometimes Unity gets confused about what windows are open. So first thing you might try to do is reset your layout to get rid of any junk windows. (Top right Layout/Reset all layouts). That will close all windows (even the invisible ones).
     
  40. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA 2.13a4 is released.

    This has numerous fixes, and plenty of new features - including the hair conformer, the conditional slot replacements, ability to pass parameters to the compositing shaders for all layers, and numerous other features that I've likely just forgot in addition to bug fixes. It's not a beta yet, because I am still working on one major feature -- Blend Modes. This is in active development, and you will see references to it in the code currently, but the shaders aren't ready, so they're not exposed. Sorry! Once that is done, the Beta will be released (I'm estimating 2-3 weeks), and I will ask everyone to please help test in prep for release on the asset store. And I will likely humbly beg everyone who has been working on skins if they can supply any updated textures to help UMA get to the next level.

    Get it while it's hot here: https://github.com/umasteeringgroup/UMA/releases/tag/v2.13a4

    A release to the asset store will follow after the beta. I'm predicting mid-august for a full release.
     
    hopeful likes this.
  41. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Ouch! A bug has already been found when having UMA Addressables support enabled (not on by default). The compile will fail on charbaseeditor.cs.

    To solve this issue add the following to the "using" statements at the top of the charbaseeditor.cs.

    Code (CSharp):
    1. using UMA.Controls;
    This will be fixed in the next update!



     
  42. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    We use UMA 2.12 and Addressables 1.21.12 in unity 2022.3.4f1

    I notice a lot of unintended assets in our builds memory via Resources/ because of the AssetIndexer being under Resources (UMA\InternalDataStore\InGame\Resources\AssetIndexer.asset) and it has entries for literally all RuntimeAnimationControllers in our project, with it having direct links to the assets ("Serialized Item" field)

    So we have some confusion about what is intended here and it looks like there are multiple issues in our setup.
    1. Is UMAs global AssetIndexer file meant to always be using "Resources"?
    2. The AssetIndexer file includes ALL our project files, because of "Rebuild from project". I assume we are supposed to manually audit every single file instead?
    3. The AssetIndexer file has hard links to included assets (RuntimeAnimationController & AnimationClips ALL referenced), loading everything in memory at all times, is this intended?
     
    Last edited: Jul 5, 2023
  43. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    1. Because UMA has to access items at runtime, they have to be loaded into memory. To find items, UMA looks in the global library. If you have addressables enabled, Items are either in the global library - and included in resources - or they are in addressable bundles and demand loaded (and unloaded when no longer in use)

    2. The later versions of UMA (Alpha 4 of 2.13 is available on Github) have a feature to limit what folders that UMA searches for the various items. But in 2.12, your option is to either not use the Rebuild From Project option and individually manage what is in the library, or to delete the unused items from your project.

    3. It is only intended that the animator that UMA is using is in the library. This is easier to manager in 2.13 with the folder filter feature (ie, you put your UMA animator controller there, and leave the rest out). UMA doesn't know about when you want animators loaded, so it doesn't manage them They are either loaded as resources at the beginning, or you can manually load/unload them using the various functions on the Global library.

    I know "Alpha 4" sounds scary as it's an alpha version. But this is actually in use in production at multiple sites in shipping applications.

     
    MikeHergaarden likes this.
  44. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Thank you for the swift and extensive reply!
    We'll give that 2.13.4 a try, sounds like that improves the memory usage(/asset mangement) enough for our current production state!
     
  45. firejerm

    firejerm

    Joined:
    Dec 28, 2012
    Posts:
    43
    Hey, so is there an Uma-built-in way to get lists of all wardrobe items from the uma character?
    Gather all hair, shirts, pants, etc... from the active race

    like for a pseudocode example :
    public DynamicCharacterAvatar avatar;

    public List<string> ChestSlotMale = new List<string>();

    ChestSlotMale = avatar. *Uma Chest slot reference* ?

    And then cycle through the clothes at runtime on button press, or slider
     
  46. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Yes - you can call AvailableRecipes() on the avatar to get a dictionary (by wardrobe slot) of all the recipes that can be equipped.

    var AllRecipes = avatar.AvailableRecipes();

    var ChestRecipes = AllRecipes["Chest"];

    ChestRecipes is now a list of all chest items that fit the character.
     
    firejerm and hopeful like this.
  47. firejerm

    firejerm

    Joined:
    Dec 28, 2012
    Posts:
    43
    OOOok. so that gets me all the shirts the race CAN wear.

    I should have specified...sorry, fairly new to UMA. I wanting a list of the recipes in the current race's wardrobe.

    Making a char selection screen. Anorak has a tut where you have to build your own list, then manually type the names of each wardrobe recipe, for each race.

    Trying to see if there is a way to autopopulate my list with the current race's wardrobe recipes.

    tried avatar.wardrobeRecipies["Chest"] that only gets the current recipe.

    feel like i'm close.
     
  48. frostdani

    frostdani

    Joined:
    Aug 14, 2015
    Posts:
    7
    Hello Guys,
    So i have this big problem wich is not letting me create recipes for new clothes. Everytime i try i get the same error attached in the screenshot. Cannot even create the slot, let alone get into the recipe...
    I followed the tutorials by letter and still can't get it into working. I TRansfered the weights frtom the UMA model as per in the video, added the armature, still the same error. I don't know what else to do.
    Can you please help me out?
     

    Attached Files:

  49. frostdani

    frostdani

    Joined:
    Aug 14, 2015
    Posts:
    7
    SO i got a fix oh how to load my models as clothes, but i add the recipe to the character it looks crazy.... ANyone knows why?
     

    Attached Files:

  50. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I'm not really understanding what recipes you are looking for. You can get the recipes you are wearing from avatar.Wardrobe recipes, and available recipes for the race from avatar.AvailableRecipes();

    Are you looking for the Slot Names for all the available recipes? You can get those from avatar.AvailableRecipes().Keys (it just returns a dictionary). If you can be a bit more specific, it would be helpful.