Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    1. The asset store version should work fine. it won't have all the new features that are in GIT, but they will be there soon.
    2. Shouldn't need to. The atlas building works at runtime only, so it will automatically regenerate correctly.
    3. Did you check the metallic/gloss color, make sure the alpha was 0?
    4. Couple items - my guess is that the filename is too long. Some of the .Net functions have a maximum path length, and that could cause the error that you see. For the "duplicate asset ignored" message - it indexes the slots and overlays based on the "slot name" and "overlay name" (not the asset name). So you might validate that those are unique. If you can't find the other one, you should be able to open the global library, filter to item in question, and then "inspect" it using the "i" button. (if you're using an earlier version without the "i" (inspect) button, then you can click on the name to bring it up in the default inspector.
     
    hopeful likes this.
  2. PolytopeStudio

    PolytopeStudio

    Joined:
    Aug 22, 2017
    Posts:
    200
    Thanks, I'll have to check that!
     
  3. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67

    Hello Jaimie,

    I will try once again since yesterday the string problem occurred (paths being too long).

    As for 3) I am aware of the problems with the textures don't worry, I just haven't gotten to Designer and Substance to make the proper maps out of the ones I got from the licensed model.

    Possibility:

    I realized late at night yesterday that the UVs on the model might actually be the problem - I will address this too today.

    The UVs of the Daz3D model that I'm using are arranged in a single UV set and not all of them are at the "center" (their origins are not necessarily at (0,0) ).

    They have been tiled accordingly in such a way that the head is the only one that is at the right position, as every other slot of the mesh has its UVs origin coordinate at (X * 4096, 0).

    I have the impression the reason why the meshes are not getting the proper overlays might be that the reconstruction process for the UVS of the actual UMA character is not taking the displacement of the UVs into consideration. I have no idea why Daz artists decided to place the UVs of their "slots" in such a fashion, but I am almost sure once I fix this and return the UVs to where they should be, it should work.

    I will be back with some images of the problem and whether it fixed the issue after being addressed or not.

    Thank you so much for the help.
     
  4. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    It sounds like they already had atlassed the used textures which is normal. They can still be used by UMA easily. It just means all the uv islands will always be used even if one of the submeshes is hidden. If the uv islands were separated then that uv island can be removed when the UMA generates. But besides that, that's all "normal". you'll just need the same overlay on each slot that uses a portion of that texture. Besides that bug in 2.6, duplicate overlays across multiple slots will only ever be used once during generation.

    Something else to conside when working with daz textures is what the texture map are actaully for. Daz uses an uber shader that I believe mixes specular and metallic (I may be wrong, it's been awhile). Maybe you should tell use which textures names you're using and what parameter they were being used with in Daz. Also, in Unity, are you using the default UMA Material which is the Unity Standard Shader metallic workflow with only, albedo, normal, and metallic/smoothness maps?
     
    hopeful likes this.
  5. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67



    1) Duh, you're right. I hadn't thought about that as I went into the model and chopped it based on the texture files provided hahaha. Ultimately I just opened Blender now that I'm at home and I after looking at the uv map of the UNIFIED Mesh it is obvious they had atlassed the whole model.

    Unified Mesh UV - SC.png

    2) Ultimately, I have done a lot of work on this model, I've created new "slots" by separating vertices from the model directly and etc, so the new "slots" do not have the vertex information of the other parts: their UVs do not contain those vertices.

    For example: we have separated the torso into two slots, here's the upper part's UVs:

    Torso UV - SC.png

    As you can see since this is a separate object in Blender, it no longer has information about the other vertices that conform the Unified Mesh. Can you confirm this wouldn't be an issue when importing? Shouldn't I make sure that the slots' meshes have their UVs placed inside of the "clearer" area as shown on the captures above? Perhaps UMA looks at the Unified's UV Maps too in order to determine whether to take this displacement into consideration?

    3) I came up to this possibility since while moving the textures around into overlays they shouldn't be in, in one of the "broken models", I was almost able to get it "fixed".

    As to WHY I had to place the torso texture on the legs overlay, the legs texture on the arms overlay, and etc... I have no idea. It seems as if there was a displacement of the UVs on the UMA character that is driven by the Texture's width relation to the UVs on the meshes of the slots.


    Question:

    If you can guarantee there's no point in me trying this out, I won't - but at the moment it's the only thing I've got going on in my mind that "might" help at all. I really can't see any other faults in the process:
    I've done it several times over the past 3 days and I've used UMA back when it was in 1.6 - so I already understand the less streamlined version of how to do all of this and I had not had this issue in the past when the model used to create the race was one I had created myself from scratch. My model DID NOT have such UV arrangement as it wasn't atlassed - so it's technically the only difference between the Daz 3d model that does not work properly, and the model I created that did work properly in UMA 1.6.

    4) Yes, we are AT THE MOMENT, using the standard Unity Standard Shader. In the future we will address this with custom shaders however.

    We will not be using the Daz Textures in Unity directly. I really don't care if the textures look right at this moment, I just want the placing of the textures to be displayed correctly on the model so that I can THEN move on into actually texturing the model in a different software and simply replacing the Overlays' textures in the future. Once I can make sure this part of the process will work smoothly, I don't mind playing with utilizing custom shaders that I will be doing with Amplify (the plugin), however right now whether the textures look "good" or not is not really something I care too much about, since I am only trying to make sure the model gets processed correctly when turning it into a Race.

    I am not importing the materials from Daz nor from Blender. Ultimately we work recreating our materials in Unity with the use of Substance Designer and Painter - and Daz only provides an albedo map and a normal map If I remember correctly. The last map, used as a specular, is just a placeholder i did quickly in photoshop by utilizing a black & white filter - but I am completely aware it looks terrible and will only fix it in Designer/Painter once this part of the process is figured out.
     
    Last edited: Aug 2, 2018
  6. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    @EnriquePage91
    You probably can't post the texture, but can you describe how the texture is arranged? Is it one long rectangular texture similar to the uv layout you showed, or is it more like a grid?
     
  7. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    406
    I don't think any of the UV's above would work. Most of the mesh pieces have UVs out of the UV space which is lighter area on the screenshots. The ones out of it are probably the pieces that looked black in the unity. Try to scale the UVs to fit in the square. Then export the fbx again and create slots from it. That should get rid of the black texturing issue.

    If you want a certain texture to work with that you might want to place islands accordingly.
     
    Jaimi and EnriquePage91 like this.
  8. LexOdin

    LexOdin

    Joined:
    Sep 11, 2017
    Posts:
    7
    Hey, I'm having a specific issue:

    I'm loading recipes built from an earlier version of UMA into a DCS , saved as a loadable recipe file.

    I can either load the recipe under the Dynamic Character Avatar UMA Recipe slot, or the UMA Additional Recipes slot(s).

    In the case of the first choice, loading them this way unequips all wardrobe items and prevents wardrobe items from being equipped. When I try to equip a wardrobe item by dragging it into the default wardrobe section, it undoes the UMA character recipe but equips the item.

    In the case of the second choice, the UMA character recipe is loaded properly but the base character recipe pops out from beneath the loaded recipe. This method allows the armor to properly display but causes some graphical glitches.

    I need to find a way to be able to load my UMA Character recipe as the base recipe whilst still allowing the Dynamic Character Avatar to use wardrobe recipes.
     
  9. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    @EnriquePage91
    @umutozkan
    Correct me if i'm wrong, but I thought blender (and other modeling programs) wrap uv coords outside the 0-1 range. If so, then in that uv layout, everything outside the initial darker grid has their uv's wrapped back to the 0-1 range. So essentially, those uv islands are all on top of each other. If the albedo texture is a bunch of separate square textures, then that confirms it. If the albedo texture is a biggest rectangular atlas, then its not.
     
  10. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67

    Yes that is indeed what I will try to do when I get home as I figured that's might be the problem! Thanks and I will let you guys know later tonight if it does indeed work out.





    Although you might be right about this - I already moved the UVs around on Blender and imported to Unity and textures seem fine for now - will process the slots later tonight and let you guys know however I have the impression that you might be right about Blender wrapping the uvs outside 0-1; I would imagine it does since textures looked ok in Blender....


    If that is the case then I guess I will still have the same issue tonight.

    I will keep you guys informed - thanks for all the help.
     
  11. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    406
    I am not 100% sure but I remember having issues when I had stuff outside 0-1 range.

    Try to drag the fbx you are creating the slots from into the scene first. If you see the textures fine then slots generated from that should be fine too. If it's not than it must be something other than the UV coords.
     
  12. LexOdin

    LexOdin

    Joined:
    Sep 11, 2017
    Posts:
    7
    OK, I've found that the Dynamic Character Avatar script changes the base recipe at runtime. When I replace it back to normal with my imported (new) base recipe, everything works just fine.

    I'm trying to find out where the script is making this change. No luck so far.
     
  13. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    The purpose of the DynamicCharacterAvatar is to construct a recipe from a base recipe, and a set of Wardrobe Recipes.

    The build process does this in a nutshell:

    Starts with the Base Race Recipe (on the racedata), merges in all wardrobe items and mesh-hide assets, removing any slots and or wardrobe items that aren't needed, sets the colors, and builds a new uma Recipe, and then generates it.

    If you just want to load and set an old style recipe, then I recommend to use the legacy DynamicAvatar.

    If you're wanting to use your recipe as the base recipe, and add wardrobe items to it, then the way to do that is to add the base recipe to the Race - not the DynamicCharacterAvatar. You can either duplicate one of the existing racedatas, and set your own on it, or just replace the "base race recipe" on the race.

    If I'm not understanding what you're wanting to do, I would need more information.
     
    LexOdin likes this.
  14. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Yes, you are correct. this is absolutely a problem. When the atlas is built, coordinates outside of 0..1 become completely invalid. This is not supported
     
  15. LexOdin

    LexOdin

    Joined:
    Sep 11, 2017
    Posts:
    7
    This explanation is perfect. Thank you.
     
    Jaimi likes this.
  16. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67

    Unfortunately I did that already and slots look fine before being processed. Still haven't tried moving the UVs so I will give it a shot but it might not be that then - we will see.




    But wait....



    Oh! Well then this IS surely the problem. Regardless, I will try it and comment on it when I have results!


    Thank you so much guys!
     
  17. LockedInside

    LockedInside

    Joined:
    Jul 28, 2010
    Posts:
    16
    Hi guys !
    I think some AI packages use the animator controller of a character in order to work. But what I do not understood is how I can setup this if the animator controller is only created on the fly ?
    I mean, on the editor -> AI package asks for a character -> select one but no animator controller detected so can't go on.
    Do you have any clues ?

    Thank you !
     
  18. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You can use the bone builder to pregenerate the skeleton. SecretAnorak has a recent video on his channel that shows the process. Look here : https://www.youtube.com/playlist?list=PLkDHFObfS19xSJOykw0yURd5naCRw4hYd
     
    Last edited: Aug 3, 2018
  19. LockedInside

    LockedInside

    Joined:
    Jul 28, 2010
    Posts:
    16
    it looks promising ! Thank you Jaimi.
     
  20. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    Quick Question: I made a build of my project and the UMA player is invisible. Did I miss a step or something?
     
  21. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Most likely you forgot to click the button on the global library that said "Add build references"
     
    hopeful likes this.
  22. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    That was it. Thank you!
     
  23. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67
    Hello guys, just here to confirm the hypothesis.

    The problem I was having was related to the UVs that the model imported from Daz3D to Blender had.

    Once I removed the tiling of the UVs and translated them to the UV space the slots started importing properly -
    so it would be great to be aware of this whether it is a limitation of UMA's import workflow that artists should adjust to, or whether some internal fixing has to occur in the future. Thankfully Blender makes this fix really easy with a little bit of maths so it wasn't much of a problem.

    I did this for every slot AND also for the unified mesh's UVs.
    I am NOT sure whether the UVs of the unified mesh need to be "fixed" too honestly, I just didn't want to "risk it" and have to reprocess all the slots as it does take a while. thankfully doing this worked, however I suspect you might not need to change the unified mesh's UVs, only the slot's. Unless UMA utilizes the UV info of the unified mesh somehow, but I don't think it would since certain slots do not require a unified mesh so that would seem weird to me.

    Anyway...:

    Upper torso:

    WRONG:
    Torso UV - SC.png

    RIGHT:
    Torso UV FIX - SC.png


    Unified Mesh:


    WRONG:
    Unified Mesh UV - SC.png

    RIGHT:
    Unified Mesh UV FIX - SC.png



    Regardless, the model now seems to work properly.

    Thank you so much for your help guys I really appreciate it !!
     
    umutozkan, kenamis and hopeful like this.
  24. JohnnyDang3r

    JohnnyDang3r

    Joined:
    Mar 5, 2013
    Posts:
    12
    Hi! I'm getting started with UMA and for my current project I wish to use an animation set I got but it doesn't play well on my UMA. It does work perfectly fine on Unity's Ethan and funnily enough, it also works very well on my UMA once I've integrated Invector's TPC (as in Secret Anorak's video). I'd rather not use TPC though.

    In the clip below it shows how to fix the problem (my UMA moves like the character on the right) by aligning the target's avatar pose to closely fit the animation's original avatar. The only avatar I could find is Female_UnifiedAvatar and it doesn't seem to change anything in-game. Where does the avatar used at runtime come from?

    I hope this hasn't been asked a thousand times already, I couldn't find anything about it in the doc nor on this forum.



    Thanks!
     
  25. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Yea, there is an asset called an UMATPose asset that you assign to your race data, that contains your t pose. So, if you adjust your t pose on your unified mesh, you need to re-extract the t pose and assign it to your race data.


    There is also an updated (closer t pose to what most animations on the asset store are set to) T pose called "Male_Unified_TPose_Mecanim" and likewise for female too. It isn't assign by default because a lot of people are used to the original T pose, but you can try assigned that to your race data and the animation will probably be a lot better.
     
  26. JohnnyDang3r

    JohnnyDang3r

    Joined:
    Mar 5, 2013
    Posts:
    12
    Yes! Assigning Female_Unified_TPose_Mecanim to the HumanFemaleDCS race's TPose fixed it! Thank you so much for your help!
     
    Last edited: Aug 5, 2018
    EnriquePage91, hopeful and kenamis like this.
  27. JMOStudios

    JMOStudios

    Joined:
    Nov 14, 2016
    Posts:
    4
    Hello! I am trying to highlight parts of my uma to be selected for editing in character creation. I am having a few issues here because I want to add colliders to the adjustment bones so that when they are clicked on or hovered over there will be a change in color. I wanted to create slots for each part of the model that can be clicked on and edited but I dont know how to access the slot in code. This is a short method I wrote so far..
    Code (CSharp):
    1. public void AddColliders() {
    2.  
    3.         renderers = GameObject.Find("Character").GetComponentInChildren<SkinnedMeshRenderer>();
    4.         foreach (var b in renderers.bones)
    5.         {
    6.             if (b.name.Contains("Adjust"))
    7.             {
    8.                 //Add collider on adjustment bone or find uma slot to change color
    9.              //I tried this below and it didnt work my mouse manager which sees what I hover over reads the colliders but it is changing the entire mesh color instead of just the area where the bone is
    10.  GameObject bone = b.gameObject;
    11.                 bone.AddComponent<SphereCollider>();
    12.             }
    13.  
    14.         }
    15.     }
    So is there a way I can click on my uma and access what slot that area is connected to? Then I think I could change the color that way using avatar.SetColor[slotname,highlightcolor] I tried watching a few videos but I couldnt find exactly what I was looking for if you can direct me to any resources that would be great.
     
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    SetColor will change the value of color of the entire overlay. You will need to come up with a different way of doing this.

    Some thoughts are:

    1. Create a specific overlay for each adjustment bone that you want to highlight that only contains the texture part you want highlighted. Then colorize that. This is probably the easiest to code, but also the most tedious.

    2. Use a shader that supports vertex coloring. Then, find all the vertexes that are affected by the bone, and set the vertex color on those (I would weight the color based on the amount of effect it had). You'll need to mass set all the colors to 1,1,1,1 - and then colorize the affected vertexes each time you changed bones. This is probably the best looking method, but will also be way more code. You'll want your shader to be able to handle both light and dark skin colors, so you can't just do a simple multiply.






     
  29. IanAtherton

    IanAtherton

    Joined:
    Jul 5, 2014
    Posts:
    5
    Hey everyone. Thanks for the hard work and support on UMA, it's pretty great.

    My issue: I'm having a problem where I made alternate limbs for a character and 3/5 work fine, the other 2 were parented in a different way in blender. (Basically I separated them from the mesh and then combined them with a separate mesh but in the wrong order, so it got parented to a new mesh instead of part of the original body, and now some setting within this new mesh, a weird material property or something is affecting the import into UMA.) The material on the two alternate limbs in question look like a mesh would look if you didn't set a normal map as a normal map in Unity. Sorry if this has been asked and answered a bunch, I didn't have much luck looking for it.

    Thanks in advanced for any and all help.
     
  30. JMOStudios

    JMOStudios

    Joined:
    Nov 14, 2016
    Posts:
    4
    Thanks for your guidance on this. I am going to try to see if I can do option 2. I'll post an update when I finish. It is a lot of work but I really enjoy having a character creator with a ton of options.
     
  31. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    This is actually a Unity issue.
    What is happening is that unity precompiles the shaders for a material, and since the atlas materials are generated on the fly, it doesn't know about the normal map.
    So if you want to use your own material (with different settings for the standard shader), then you have to put placeholder textures in the material so it uses the correct shader variant.

    (If you haven't seen them, We've included a bunch of standard shader variants though - do a search for "t:UMAMaterial")


     
  32. IanAtherton

    IanAtherton

    Joined:
    Jul 5, 2014
    Posts:
    5
    I'm using a standard uma material, the diffuse normal metallic one. I put the textures into the directory with the slot and overlay and recipe, added the textures to the overlay and added the overlay to the recipe, so any idea why this is happening? Doesn't it have to have something to do with the import from blender?
     
  33. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    If that same material is working for others, then I would check your normal map import settings. Is the texture type set to "Normal map"? You might also want to check the "UMA_Mat_Diffuse_Normal_Metallic" material, and make sure that the "normal map" slot is filled out. It looks like it is using the "elven ear" normal map as the place holder. If that's missing, it could cause the shader to be compiled incorrectly.

    I wouldn't think the blender setting would have anything to do with it. But I'm definitely not a Blender expert.
     
  34. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67
    Hello guys!

    So here I am again, with another question.

    I want to use Mega-Fiers' wrap system for the clothing on my UMAs. This would allow the Clothing on my UMAs to adapt to the blendshapes of the main character (since my character has blendshapes for muscles, fat, etc). As you can imagine, doing blendshapes of such types for each clothing asset would be a pain and I would rather much prefer to simply be able to figure out a way of using the wrapping system included with Mega-Fiers

    Here's a video demonstration of Mega-Fiers' wrap:


    Unfortunately, Mega-Fiers does not update its tutorials or instructional material too often so the video is severly outdated. Because of this, do not expect to get the full picture out of watching the video since much has changed. For starters, you no longer need to utilize Mega-Fiers' blendshape system to influence a Mesh with a "Wrap Modifier". the "Wrap Modifier" works with Unity's blendshapes by default (as far as I understand according to the developer).

    1) HOWEVER... the issue is, this would require me to have a separate skinned mesh renderer for the clothing - at least I believe it would. Is there any way I could assign scripts to certain clothing slots? Or perhaps better, is there anyway I could instruct UMA to generate two meshes instead of one? One for the clothing and one for the character ideally? I would prefer to only utilize one skeleton, so simply creating a race that hides the character mesh so that I can have "2 UMAs" (one being the naked character, the other being the clothing) would not be the best option for me.

    2) If being able to assign scripts to specific slots is possible, or if there's anyway I can generate a clothing skinned mesh renderer and a character skinned mesh renderer out of UMA, then the next question I'd have would be a rather simple one.... If I utilize a mesh-hide asset, I am only "hiding" the faces by not rendering them right? So, the faces WILL still be there regardless right? I am asking as the Mega-Fiers wrap system utilizes the vertices of a Mesh to displace the other mesh wrapped onto it so technically I'd need to have the character's mesh active all the time for the clothing to work properly with the blendshapes. I don't think it will be an issue if the faces are "hidden" as long as they are still there.


    Thank you so much for all the help and support! UMA is amazing !!
     
  35. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Yep, if you create a new UMAMaterial and there is a check box for "Require Separate Renderer". Any slots using that material will be put on a new renderer. So you could have all your body on one uma material and all your cloth on another one and you'd end up with two skinned mesh renderers.

    Yes, you can assign scripts to a slot. If you look at the "additional recipes" they have examples. It's a bit tricky though and the api isn't clear for them, so you'll need to probably work with experts over slack.
    The mesh hide assets are only not rendering the triangle indices, so yes the vertices are still there.
     
    EnriquePage91 and hopeful like this.
  36. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    67


    Perfect information! Thank you so much!

    Just a few clarifications if possible....:

    1) An UMAMaterial is essentially just a material asset I imagine right? I can still use a custom shader built with Amplify by doing so right?

    2) since I can separate the Mesh into two Skinned meshes I should be able to simply add the scripts through monobehaviour in realtime once the clothing Skinned Mesh is generated, right? Does not seem to be necessary to use the slots' functionality to have the scripts pre-attached, if this is indeed possible.

    I will look into these options over the weekend, thank you so much for all the help!
     
  37. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    An UMAMaterial is essentially a wrapper around a Unity Material with more meta data.
    http://umadocs.secretanorak.com/doku.php?id=knowledgebase:uma_material
    So, yes, you can use any shader with it.
    Yea, you can use one of the events to control when to fire your script. So, I would have the megafier control script on the uma gameobject from the start, subscribe to the OnCharacterUpdated event, and then do you necessary function when that event fires. No need to mess with slot specific callbacks.

    Goodluck and you're welcome.
     
  38. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello,

    is there any News about UMA on UWP platform?

    thanks and have a nice weekend :)
     
  39. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I've got a problem, where head must be hidden for the first person camera to work (this is done via wardrobe recipe), but it lacks shadows. I've also got a shadows only material, that works just fine on it's own.
    But I can't figure out how to replace an actual UMA material with the invisible one.

    I wonder, is there a proper way to swap materials on the wardrobe at runtime?
    Do I need to create additional slot and then switch it?
     
  40. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    I had the same Problem, I am using a camera which can switch between 1st and 3rd Person view.
    When in 1st Person view I set camera position direct in front of the eyes, not perfect but it works for me.
     
  41. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Not an option for me, since my camera is partially based around IK, and vice versa.
    But the ShadowCaster shader + additional slot + different UMA material + wardrobe recipe seems to be working.
    I just needed to use "replaces" on the wardrobe recipe to replace an actual hair.

    There's some errors about missmatching channels, but it's fixable.
    Need to research on how to switch the wardrobe recipies in runtime and it's all set.
    (and also create same setup for head, eyebrows, eyes and mouth)

    Half answered my own question.
    Anyway, it's way better than simply hiding the head via wardrobe recipe.
    It no longer looks like my character is headless when looking at the shadows.
     
  42. CTE

    CTE

    Joined:
    Mar 24, 2013
    Posts:
    7
    Good Afternoon All,,

    I had a couple of questions regarding dynamic building of UMA characters.

    I have been following UMA since 1.0 and recently gotten back into coding some RPG elements that I had been working on previously. UMA has come a long way and I wanted to take full advantage of it and all the Will.B assets I had previously purchased. The new "DynamicCharacterAvatar" is extremely nice along with the wardrobe system

    The problem I run into is finding the best way to dynamically apply DNA changes to a "UMADynamicCharacterAvatar" prefab that I instantiate. I need to instantiate it as I apply a number of scripts to it to get the "Ootii" motion controller" working properly with it. This all works great now but when I instantiate I cannot easily change the DNA values as they are not readily available until you get certain events like the "CharacterCreated" event. I would prefer not to have to rely on events versus being able to pass in what I want to DNA and then applying it during instantiation.

    The other reason I have to do this is I wrote a Multiplayer framework that uses Lidgren and stores character information on a server that is connected to for this game. The client receives the DNA values, what items are in what slots etc and then needs to instantiate that version of a character.

    Is there an easy way to create a "DynamicCharacterAvatar" at run-time through instantiation (aka instantiate a base character) and then apply appropriate DNA values immediately after instantiation. I know it cannot be done in the events as the system will ignore buildcharacter() calls while in these events it seems.

    In essence I want to

    - Instantiate my UMACharacter class
    - The class constructor instantiates the "DynamicCharacterAvatar" Prefab
    - Apply DNA (I suppose I could pass in a recipe but the JSON does not easily serialize as portions of it are packed)
    - Add all the Ootii MotionController scripts
    - Move the character to it's position in the world and go

    Any help would be greatly appreciated.

    Thanks,

    Chris Eisnaugle
     
  43. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You should just be able to just call "SetLoadString()" and pass the JSON for the character when you first instatiate it. There are other methods as well, but in the end they all boil down to the same thing - you have to provide the json for the character somehow. (if the json is saved as a file, you can load it from that instead)

    Code (CSharp):
    1.         public void DynamicCreateClick()
    2.         {
    3.             string[] files = { "Fram", "Bob", "Gobs" };
    4.             float x = Random.Range(-8.0f, 8.0f);
    5.             float z = Random.Range(1.0f, 12.0f);
    6.             GameObject go = GameObject.Instantiate(AvatarPrefab);
    7.             DynamicCharacterAvatar dca = go.GetComponent<DynamicCharacterAvatar>();
    8.     #if LoadingFromString
    9.             // this shows how to load it from a string at initialization
    10.             TextAsset t = Resources.Load<TextAsset>("CharacterRecipes/Bob");
    11.             dca.SetLoadString(t.text);
    12.     #else
    13.             // this shows how to load it from a resource file at initialization
    14.             dca.loadPathType = DynamicCharacterAvatar.loadPathTypes.CharacterSystem;
    15.             dca.loadFilename = files[Random.Range(0, 3)];
    16.     #endif
    17.             go.transform.localPosition = new Vector3(x, 0, z);
    18.             go.SetActive(true);
    19.         }

    You could do it in an event, but because the events are called from the build process, we don't allow you to build it from an event (possibly causing an infinite loop). You could start a coroutine to set the DNA but that would actuallly just end up building the character twice (the first time with the default DNA, and the second time with the updated DNA).





     
  44. CTE

    CTE

    Joined:
    Mar 24, 2013
    Posts:
    7
    Hi Jaimi,

    Thanks for the info. It is similar to what I had been reading and experimenting with.

    The challenge is the recipe itself. I have been able to load a recipe from a .txt file and apply it and that works as stated. The challenge is modifying the values in the recipe. The DNA values, colors etc. I need to set are custom values I store based on people going through a character created and adjusting their look, hair styles, color, etc. So ever individual is for the most part unique.

    This was why I need to be able to instantiate the avatar and then apply the values I have received from the server for this character. I agree I don't want to do double processing and doing it with events is not really advantageous due to having to manage states on the character creation etc.

    After I experimented more I was just going to use the JSON as the base recipe and then change the values within the JSON itself before passing it to the SetLoadString() function. I grabbed the JSON and ran it through a parser that created C# classes for me. All worked great when I serialized except the DNA itself is packed and still remained in a standard string with section looking like {\"name\":\"skinGreenness\",\"value\":128}. These look like name value pairs for the most part, but was trying to avoid a parser for this in case things change.

    Is there an easy way to set these values after de-serializing the JSON, or will I need to break this out and then put it back together before passing it to the SetLoadString function?

    Thanks

    Chris
     
  45. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I don't know of an easy way. The recipe string should be a JSON of a DCSPackRecipe. You can use JsonUtility to load it from a recipe. Modify the values, and then save it back to JSON for preloading. The DNA is PackedDNA, so it's 0..255 instead of 0..1 -- so you'll need to divide or multiply by 255 to convert the number back and forth.

    I'm assuming you're working on an MMO, and have to have an extremely tight encoding of the character. If not, I would recommend just serializing the character to JSON on the Character Editor, and just passing that around.
     
  46. CTE

    CTE

    Joined:
    Mar 24, 2013
    Posts:
    7
    Hi Jaimi,

    Thanks again. No not an MMO, more of an online game that let's you play AD&D style pre-generated modules. So more like 64 players max. Running the server on Linux so developed my own networking package that does appropriate syncing etc., but character information still needs to be very tight for characters that pop in and out based on interest management or entering the game.

    As to the Recipe String, I can easily run it through the JsonUtility and that works fine but in the classes I have the "packedDna" section remains a string instead of breaking out the name/value pairs. Does the DCSPackRecipe break these out? If not I may just de-serialize and then parse the value pairs and modify the values and then recreate the packedDna Section since it is not very complex.

    Thanks again

    Chris
     
  47. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I'm not where i can look at the code, but if i recall correctly, everything is unpacked, and you end up with an array of packed dna.

     
  48. CTE

    CTE

    Joined:
    Mar 24, 2013
    Posts:
    7
    Possible I am missing something, but when I load the text recipe and then use:

    DCSPackRecipe dcsRecipe = JsonUtility.FromJson<DCSPackRecipe>(recipe);

    The JSON is deserialized into:

    upload_2018-8-12_20-44-32.png

    Looks like DNA[0] has a packedDNA field but it is still the entire string of values.

    Will look around and see if I am missing something.
     
  49. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Hmm - sorry, i cant dig into it right now. But there are functions to pack and unpack the dna itself. Look at UMAPackedDna.
     
  50. CTE

    CTE

    Joined:
    Mar 24, 2013
    Posts:
    7
    I'll take a look.

    Let me know when you have a chance what the correct methods and order should be when you have a chance.

    Thanks

    Chris