Search Unity

[FREE] o3n Male and Female UMA Races

Discussion in 'Assets and Asset Store' started by umutozkan, Oct 8, 2017.

  1. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    child_slider.png
    This screenshot is from demo scene. I just created a new project with Asset Store version. Are you sure you have the latest versions from the store?
     
    Mark_01 and twobob like this.
  2. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    An LOD package for the o3n Male and Female UMA Races will be on the Asset Store soon.

    Poly Counts(Numbers are for female, male numbers are comparable)

    LOD0 : 19278 verts, 35888 tris
    LOD1 : 5118 verts, 8876 tris (Default LOD for base o3n Races)
    LOD2 : 1762 verts, 2732 tris
    LOD3 : 665 verts, 816 tris

    LOD_store.png



     
    Mark_01 and twobob like this.
  3. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    24
    Yes, I just imported from Asset Store. In the DemoScene, there is a male and a female. In Body DNA, there is no child slider.
     
  4. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    I've just imported UMA and o3n Races into a new project on another computer. Child slider is there.

    Can you just clean Unity's package folder and redownload the latest version in a new project?

    child_slider_screenshot.png
     
  5. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    24
    Just did and the same. I see 4 characters in the DemoScene scene window, but when I run it, I can only see the 2 grownup male and females, and no child slider. The kids in front are gone. And I see the following messages in the console.

    screen.png
    screen 2.png
    I am using Mac and running Unity 2018.1.7f1. And the UMA demo scenes are all running fine.

    Thanks!
     
  6. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Ah looks like you only have the original UMAs on that scene. They don't have child sliders. The two avatars in the front are the o3n models (the ones in the back are for comparison to base UMA).

    The error message makes me think you don't have the o3n races' slots and overlays in the library (global or in the scene).

    What you can do is select the Global Library window from the UMA menu at the top. Then drag the o3n folder in that window. That will import all o3n stuff into UMA global library.

    When you run the scene you should see one male & female in the back and one male & female in front. The front ones are o3n races and they should have child sliders.
     
    Mark_01 and hopeful like this.
  7. eggtart

    eggtart

    Joined:
    Feb 4, 2013
    Posts:
    24
    You nailed it. It is working perfectly now. Thank you so much for your patience!
     
    hopeful likes this.
  8. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    No problem, glad it worked for you! Enjoy.
     
  9. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    With the next version, afro textures for male and female will be in the package. These textures are on the avatar by default but has alpha of 0, hence invisible.

    If you change the shared color named "SkinDark" on the avatar and increase the alpha value, afro skin textures get visible.

    You can blend the base textures and afro textures by the alpha value.

    (You could change the skin color to a darker tone before this but that is not quite good like having separate textures.)

    Here is a screenshot.

    afro_skin.png
     
    neoshaman likes this.
  10. Toymaker

    Toymaker

    Joined:
    Apr 7, 2012
    Posts:
    10
    I've run into a problem that I'm hoping that you can help me with.

    It appears that the skin shader doesn't play well with deferred rendering. I'm hoping that you can suggest a fix for this, or will I need to find some other shader solution? Any advice that you can offer would be greatly appreciated. Thanks for your attention.
     
  11. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Hi,

    I've changed the project settings to deferred, but haven't seen any significant change in avatars visuals. I tried to override it with camera setting too just to be sure. Tried both deferred and legacy deferred.

    Could you describe your problem and tell me the steps to recreate the issue for a simple project that has just UMA and o3n races in it?

    Here is a screenshot of what I have:
    defferedrendering.png
     
  12. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    This is 300 o3n UMA in the scene with LOD in the works.

    crowd.png
     
    Mark_01 and hopeful like this.
  13. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    And this is 1000 o3n UMAs on the scene. Yes, the frame rate is down to 12, but hey it's a thousand avatars :)

    crowd.png

     
    Last edited: Aug 29, 2018
    Mark_01 and hopeful like this.
  14. etheryee

    etheryee

    Joined:
    Feb 3, 2017
    Posts:
    4
    Hello umutozkan:

    Do you have the base model for blender, the fbx file in the package is ascii, which can not be loaded by blender. I am trying to make some outfits for the character. The only way I know to do this is by transfering weights in blender. Are there any other ways to transfer weights to my outfit models.

    Thanks.
     
  15. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Blend file is available at prduct page here. (Updated whenever a change is made on the base models. Usually changes are subtle but soon I'll make a slightly bigger change to female model.)
     
    hopeful likes this.
  16. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Dear umut
    nice to see that you are so active with UMA right now. Loved your Morph3d tutorials in the past.
    Right now I did not use UMA so sorry for the "noob" questions:

    - What is exactly the benefit of your project? I suppose with it it's possible to create Morphs like with Morph3d? Meaning big, small, fat npcs?
    - Is it also possible to create young / old avartars with texture change (wrinkles etc)?
    - Vampire like with Morph3d (teeth, eyes, face etc) is also possible or do I need another of your assets like the Elf / Orc pack?
    - I saw that you are also offering cloth packages. What about Hair / Facial Hair? Do they come with UMA or what can I use to make the avartar more unique?
    - You are using a better body shader (FFS) than the normal UMA right? To make the avartar look better / realistic which comes with the Free Pack already? If yes for what is your FFS Skin Races pack exactly?

    I am really thinking of switching to UMA soon and your project really seems to get UMA near the the features that made Morph3d interesting in the past.

    Cheers
    Ronny
     
  17. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Hi Ronny,

    I know UMA can be confusing at the start so I'll try to tackle your question in parts.

    WHAT IS UMA AND WHAT CAN UMA DO?
    UMA is a framework for customizable avatars. And even that sentence is not fully expressing what it can do. Basically, you can create "races" with UMA that has bone morphings, blendshape morphings etc. And it can be a sword that can get longer by a slider or change the hilt when you "equip" a wardrobe recipe. It's that flexible.

    Of course main and the most used feature is a human avatar for a race. UMA has it's own base races (a female / male and an example toony female race).

    * Following part is my opinion on UMA, (up to the start of next part ) *
    UMA is a fantastic framework and improving day by day (can't wait for UMA3). But the base models of UMA aren't as pretty as Morph3D's models (this is a very subjective statement). The morphs are not as good as Morph3d partly because they are bone based and partly underlying weight painting of the model doesn't lend itself, and partly the DNA in the race is not really good set-up. Whatever the reason is Morph 3d is superior to "UMA Base Races" creating highly customizable characters.

    But Morph3d has it's set-backs too. Since it's mostly blendshape based the clothing and such must be generated by the tool morph3d provides. And content creation is more tricky because of that. Content creation for UMA, on the other hand, is as easy as copying the skin weights from the base model to your new content and do a minor cleanup. That's it.

    I find the blendshape solution cumbersome especially on the body where clothing covers. On the other hand, I find base UMA race not customizable enough.

    WHAT IS O3N RACE FREE PACKAGE AND WHAT CAN IT DO?
    o3n Male and Female Races Package is my "best of both worlds". The aim is to create an avatar solution that utilizes bone morphings instead of blendshapes. And skin weighting and adjustment bones are designed to accommodate that. Its morphs may not be as pretty as morph3d's but it's comparable where it counts IMO.

    And again that's subjective but, I believe it's morphing capability is far beyond base UMA models. And it leverages everything UMA framework supports. The content creation process is easy, unlike Morph3D. It has fewer polygons (LOD pack available though) than Morph3d and far less impact on performance since it has no blendshapes at all.

    Free pack covers LOD1 detail level base male and female races and some example wardrobe items. You don't need any other packs if you are creating your own content and not interested in higher / lower poly count as LODs.

    (o3n races uses a little bit modified Fast Fake Skin - FFS shader as skin shader.)

    WHAT IS O3N UMA PAID ASSETS FOR?
    Paid assets are mostly content packs like wardrobe items and such. There is also LOD packs for base o3n male & female. And also there are the race packs (like elf and orc).

    The race packs are using the same slots (base mesh) with bone modification DNA (UMA language here) to look like elf and orc etc. That means the content that fits base male will fit the orc male without any work.

    And lastly, there is one FFS pack for base UMA that uses shader and textures of o3n Races on base UMA models.

    FINAL WORDS
    Don't take my word for it check them yourself.

    o3n Male and Female UMA Races DEMO (All clothing content packs are in this demo you can try them all.)

    FFS shader on base UMA DEMO (The ones in the back are base UMA, the ones in the front are FFS shader on base UMA)

    You can compare the morphing ability between two demos by playing with the sliders of the Body / Face DNA menu.

    *Note: There is a performance issue with the current demo which will be fixed really soon. (Edit: should be fixed now)
     
    Last edited: Sep 13, 2018
    Mark_01 and kenamis like this.
  18. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Ok, I guess I missed a few questions there;

    - It's possible to make old / young avatars by texture change but it's not in any free or paid pack. You can definitely create something like that though. Maybe I can create a pack for it in the future (no promises)

    - Hair facial hair can be created as custom content, as wrinkle textures I may create some in the future or maybe someone will realese their own packs for o3n Races. Blender .blend file is available for anyone who wants to create for o3n Races at http://www.o3n.org/o3n-male-and-female-uma-races-2/

    - For vampire one should probably create a new innermouth slot since current one doesn't really lends itself for single teeth modification (I have seperate orc teeth slot in orc races for example). Again it's all possible I just don't have enough time to do it all at once :)

    A Final note. o3n Races are not compatible with base UMA slotwise, as in mesh shape and skin weighting is too different for any content to be used as is without some modification in a 3d program. The textures, on the other hand, have the same UV space. This means you can create similar overlay only wardrobe items you have for base UMA, with the only difference being use of o3n slots and o3n Skin material.
     
    Mark_01 likes this.
  19. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Thanks so much for the really detailed answers. Makes it so much clearer now.
    I am gonna take a closer look to your demo and the free assets the weekend and check also on normal UMA.

    Best regards and keep the good work!
    Ronny
     
    umutozkan likes this.
  20. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Shawn67 likes this.
  21. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Hi, o3n UMA race is a fantastic addon to UMA, characters look neutural and very suitable to my game!
    But I've met an issue when trying to render a render texture from the avatar and use it in my inventory view, so I set up a camera for the ui avatar:
    upload_2018-9-30_11-58-22.png

    Then I got a rendered texture like this in runtime:
    upload_2018-9-30_11-58-56.png

    But the issue is, with the FFS variant shader provided with o3n, the alpha channel of this picture is wrong, all the parts that rendered by this shader follows the camera's clear flags' alpha resulting in the whole character body is transparent: (alpha channel of the same rendered texture)
    upload_2018-9-30_12-0-47.png

    Here is the actual UI view if I set the camera's clear flags with a half transparent alpha color:
    upload_2018-9-30_12-2-6.png

    If I set the clear flags to a non transparent color, it will show the character in full transparency, but there also will be the ugly black background of the texture showing on my UI:
    upload_2018-9-30_12-3-50.png

    Any ideas how to solve this issue?
     
  22. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Hi Harekelas, I'll definitely look into this. Could you make a unity package that contains a scene with the issue and send it to me?
     
  23. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    I think I replicated the issue.
    renderImageIssue.png
     
  24. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Sure, you can import this into a project that already contains UMA and O3N then opent the scene included and hit play,
    you should be able to see a semi transparent character and a pair of solid eyes. Then play with the alpha channel of the color on UICamera's clear flags, you'll see the issue as I mentioned.
     

    Attached Files:

  25. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    It's something in the shader that make the camera rendered all the skin pixels' alpha color into black
     
  26. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Alright, I've been working on this and read a lot of people's posts that mentioned similar issues. Couldn't find any solution that worked for me.

    Looks like the issue here is that when you have set the solid color for clear flags option and set the alpha for the color, the alpha value is somehow multiplied with the avatar's skin material.

    I've tried lots of things but I couldn't modify the shader to get rid of this issue. The alphatest causes this in the following line in the shader:
    #pragma surface surf StandardSkin fullforwardshadows alphatest:_Cutoff

    If you modify it to
    #pragma surface surf StandardSkin fullforwardshadows

    it will remove the issue but cause another issue with clothing items with alpha mask. (The skin shader uses alpha to be able to apply alpha masks for the areas covered by the clothing to prevent pokethroughs. Base UMA's body doesn't work like this btw)

    So I don't have a real solution to this but I have a work around (not ideal but works):

    1. First of all, do not touch any shader to keep alpha mask feature.

    2. Second, Copy your renderTexture Camera in the scene and try to mimic the setup in the following two screenshots.

    Basically what I did is to have a lower depth camera to render with clear flag set to solid color with 0 alpha. And use legacy vertex lit rendering path with it. (This renders the avatar with alpha background but doesn't look good)

    Then second camera with higher depth has clear flags set to depth only and forward as rendering path. This draws the avatar correctly and depth only clearing prevents the avatar looking transparent.



    workaround2.png
    workaround3.png
     
    Last edited: Oct 1, 2018
    hopeful and Harekelas like this.
  27. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Great work around! Thank you very much!
     
    umutozkan likes this.
  28. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Dwarf Race is on its way to UAS. I am planning to submit it for review in a few days.

    dwarf.png
     
    Shawn67 likes this.
  29. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Hey, I found the character is surrounded by a rim in linear color space:
    upload_2018-10-8_12-4-0.png
    It looks very unrealistic in dark environments, any ideas how can I fix it?
     
  30. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Hi, it is not just o3n races but I noticed the same behaviour with base UMA avatars too. I asked about it at UMA slack channel and they told me it's about Unity's lighting. Unfortunately, I don't know how it can be prevented, but I take it that it can be eased with lighting settings. I am hoping to upgrade to HDRP when it is out of experimental state.
     
  31. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
  32. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Thank you for the reply, I find the ground color of a reflection probe has the direct effect on the rim light.
    When the reflection probe got a brighter color on the ground part, the character will shine in this way.
    Will try to solve this problem by manipulating the skybox which is used in reflection probes.
     
  33. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,196
    Cool! What's next? Pixies? Demons? Draconians? Wasteland post apocalyptic warriors? Racoon City survivors? heheh If I can get around to getting UMA setup in my test environment to run my new orcs around before the first of the month, I'm going to add the dwarves and elves to my library then. :)

    Also I'm seeing the LODs are a separate pack. I should be fine prototyping and getting things setup initially without them right? Just need to add those when I start getting a lot of them in the scene and still want to be able to move? heheh
     
  34. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    I'd like to hear it if you figure it out.
     
  35. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Not really sure what the next race will be. But I'll probably add some hair before anything else. The packs really lack the diversity on that side.

    And yes LOD packages are bundled LOD slots. You can add them later seamlessly. (You'll have to add UMASimpleLOD script on the avatars and check the "swap slots" option. That will enable slot switching if you have the LOD slots in UMA library)
     
    Shawn67 likes this.
  36. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Setting the ground color of the skybox to pure black or dark colors (low brightness) will fix most of the issue, also will make the scene gets more depth:
    upload_2018-10-11_14-54-28.png
     
    umutozkan and Shawn67 like this.
  37. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Hey, I got a problem with the render texture again:
    I used the work around you suggested(two cameras), but when the character is wearing a clothes that has transparent textures, it looks like this in the rendered texture:
    upload_2018-10-11_17-53-7.png
     
  38. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    We create our own clothes models and use base UMA's vertex hide function to hide overlapped body parts, does this makes the alpha test cutout useless to us?
     
  39. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    I don't think it is related. The issue is the workaround I used makes use of the legacy vertex lit on the lower depth camera. I figure that is not handling the alpha in the clothing. You can verify it by disabling the higher depth camera. You should see that the lower camera has those areas that should have been cut out.

    I guess it is the shortfall of the workaround method. I'll try to find another solution to original render texture issue, I'll let you know if I find anything.
     
  40. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    I just deleted the line you mentioned before(alphatest: _Cutout ) and so far there is no mesh poking through occurred, and the alpha channel does not got messed by the camera's clear flag.

    But I got another question: is it possible to add more slot types in the UMA system so I can let my character wear multiple layers of shirts or trousers?
    For instance: I can wear a chest plate piece outside of my shirt, and they should be put in two slots, chest and another chest slot. both should be able to be seen like this:
    upload_2018-10-11_23-15-19.png
    For now there only is one chest slot for me and I can only wear one of these clothes piece.
    Also I'll have to seperate the left / right shoes and gloves for my character, but UMA only offered one slot for both hands/arms and feet. I'll have to create more slots for my custom requirements
     
  41. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    336
    Its on the raceData where you can add more wardrobe slot types, under "Wardrobe Slots"
    http://umadocs.secretanorak.com/doku.php?id=knowledgebase:race
     
    Harekelas likes this.
  42. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Yes kenamis is right, you can add more wardrobe slots to race data. But keep in mind that if you have left glove for example, you won't be able to hide hands base body slot since it will hide both hands. You can use the mesh hide though.
     
  43. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Deleting that line actually disables the alpha mask. you probably don't notice it because you use mesh hide assets and/or your clothing doesn't clip with your body a lot.

    Nevertheless, after a few hours of struggling I fixed the o3n FFS skin shader so it won't need the workaround. It should just work with one camera to the render texture with clear flag set to solid color with alpha 0.

    Here is the shader's fixed version. I'll be sure to update the o3n races package to reflect this as soon as possible.

    Code (CSharp):
    1. Shader "o3n/Skin FFS Variant" {
    2.     Properties {
    3.         _MainTex ("Albedo (RGB) Alpha (A)", 2D) = "white" {}
    4.         _MaskTex ("Spec (R) Gloss (G) Occlusion (B)", 2D) = "white" {}
    5.         _SkinTex ("Skin Mask", 2D) = "white" {}
    6.         _NormalMap ("Normalmap", 2D) = "bump" {}                    
    7.         _BRDFTex ("Brdf Map", 2D) = "gray" {}
    8.         _BeckmannTex ("BeckmannTex", 2D) = "gray" {}                  
    9.         _SpecPow ("Specularity", Range(0, 1)) = 0.03
    10.         _GlossPow ("Smoothness", Range(0, 1)) = 0.28          
    11.         _AmbientContribution ("Ambience", Range(0, 1)) = 1
    12.         _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    13.     }
    14.     SubShader {
    15.         Tags
    16.         {
    17.             "Queue" = "AlphaTest"
    18.             "RenderType" = "TransparentCutout"
    19.         }
    20.         LOD 300
    21.  
    22.         Cull Back
    23.            
    24.         CGPROGRAM
    25.         #pragma surface surf StandardSkin //alphatest:_Cutoff
    26.  
    27.         #pragma target 3.0
    28.         #include "UnityCG.cginc"
    29.  
    30.  
    31.         struct SurfaceOutputStandardSkin {
    32.                fixed3 Albedo;
    33.             half Specular;
    34.             fixed3 Normal;
    35.             half3 Emission;
    36.             half Specularity;
    37.             half Smoothness;
    38.             half Occlusion;
    39.             fixed Alpha;
    40.             fixed Skin;
    41.         };
    42.  
    43.         struct appdata {
    44.             float4 vertex : POSITION;
    45.             float4 tangent : TANGENT;
    46.             float3 normal : NORMAL;
    47.             float2 texcoord : TEXCOORD0;
    48.             float2 texcoord1 : TEXCOORD1;
    49.             float2 texcoord2 : TEXCOORD2;
    50.         };
    51.            
    52.         struct Input {
    53.             float2 uv_MainTex;
    54.             float3 viewDir;
    55.         };
    56.            
    57.            
    58.         sampler2D _MainTex;
    59.         sampler2D _MaskTex;
    60.         sampler2D _NormalMap;
    61.         sampler2D _SkinTex;
    62.  
    63.         float _SpecPow;
    64.         float _GlossPow;
    65.         float _AmbientContribution;
    66.         float _Cutoff;
    67.            
    68.         sampler2D _BRDFTex;
    69.         sampler2D _BeckmannTex;
    70.            
    71.            
    72.  
    73.  
    74.         float Fresnel(float3 _half, float3 view, float f0) {
    75.             float base = 1.0 - dot(view, _half);
    76.             float exponential = pow(base, 5.0);
    77.             return exponential + f0 * (1.0 - exponential);
    78.         }
    79.  
    80.         half SpecularKSK(sampler2D beckmannTex, float3 normal, float3 light, float3 view, float roughness) {
    81.                
    82.             const float _specularFresnel = 1.08;
    83.                    
    84.             half3 _half = view + light;
    85.             half3 halfn = normalize(_half);
    86.  
    87.             half ndotl = max(dot(normal, light), 0.0);
    88.             half ndoth = max(dot(normal, halfn), 0.0);
    89.  
    90.             half ph = pow(2.0 * tex2D(beckmannTex, float2(ndoth, roughness)).r, 10.0);
    91.             half f = lerp(0.25, Fresnel(halfn, view, 0.028), _specularFresnel);
    92.             half ksk = max(ph * f / dot(_half, _half), 0.0);
    93.                
    94.             return ndotl * ksk;  
    95.         }
    96.  
    97.         half3 Skin_BRDF_PBS (SurfaceOutputStandardSkin s, float oneMinusReflectivity, half3 viewDir, UnityLight light, UnityIndirect gi)
    98.         {
    99.  
    100.             half3 normalizedLightDir = normalize(light.dir);
    101.             viewDir = normalize(viewDir);
    102.  
    103.             float3 occl = light.color.rgb * s.Occlusion;
    104.  
    105.             half specular = (s.Specularity * SpecularKSK(_BeckmannTex, s.Normal, normalizedLightDir, viewDir , s.Smoothness) );
    106.             half specular2 = (s.Specularity * SpecularKSK(_BeckmannTex, s.Normal, normalizedLightDir, viewDir , (s.Smoothness + 0.2)));
    107.  
    108.             const float blendAmount = 0.6;
    109.             specular = blendAmount * specular + (1 - blendAmount) * specular2;
    110.  
    111.             half3 brdf = float3(1,1,1);
    112.             float dotNL = dot(s.Normal, normalizedLightDir);
    113.             float2 brdfUV;
    114.                
    115.             brdfUV.x = dotNL * 0.5 + 0.5;
    116.             brdfUV.y = 0.7 * dot(light.color, fixed3(0.2126, 0.7152, 0.0722));
    117.  
    118.             brdf = tex2D( _BRDFTex, brdfUV ).rgb;
    119.  
    120.             half3 color = half3(0,0,0);
    121.  
    122.             half nv = DotClamped (s.Normal, viewDir);
    123.             half grazingTerm = saturate(1-s.Smoothness + (1-oneMinusReflectivity));
    124.                
    125.             color.rgb += 0
    126.                         + s.Albedo * (_AmbientContribution * gi.diffuse + occl * brdf)
    127.                         + specular * light.color
    128.                         + gi.specular * FresnelLerp (specular, grazingTerm, nv) * _AmbientContribution;
    129.  
    130.             return color;
    131.         }
    132.  
    133.         half4 BRDF3_Unity_PBS__ (half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
    134.             half3 normal, half3 viewDir,
    135.             UnityLight light, UnityIndirect gi)
    136.         {
    137.             half3 reflDir = reflect (viewDir, normal);
    138.  
    139.             half nl = saturate(dot(normal, light.dir));
    140.             half nv = saturate(dot(normal, viewDir));
    141.  
    142.             // Vectorize Pow4 to save instructions
    143.             half2 rlPow4AndFresnelTerm = Pow4 (half2(dot(reflDir, light.dir), 1-nv));  // use R.L instead of N.H to save couple of instructions
    144.             half rlPow4 = rlPow4AndFresnelTerm.x; // power exponent must match kHorizontalWarpExp in NHxRoughness() function in GeneratedTextures.cpp
    145.             half fresnelTerm = rlPow4AndFresnelTerm.y;
    146.  
    147.             half grazingTerm = saturate(smoothness + (1-oneMinusReflectivity));
    148.  
    149.             half3 color = BRDF3_Direct(diffColor, specColor, rlPow4, smoothness);
    150.             color *= light.color * nl;
    151.             color += BRDF3_Indirect(diffColor, specColor, gi, grazingTerm, fresnelTerm);
    152.  
    153.             return half4(color, 1);
    154.         }
    155.  
    156.         inline half4 LightingStandardSkin (SurfaceOutputStandardSkin s, half3 viewDir, UnityGI gi)
    157.         {
    158.            
    159.             s.Normal = normalize(s.Normal);
    160.  
    161.             half oneMinusReflectivity;
    162.             half3 specColor;
    163.             s.Albedo = EnergyConservationBetweenDiffuseAndSpecular (s.Albedo, s.Specular, oneMinusReflectivity);
    164.  
    165.             half outputAlpha;
    166.             s.Albedo = PreMultiplyAlpha (s.Albedo, s.Alpha, oneMinusReflectivity, outputAlpha);
    167.                
    168.             half4 color = half4(0.0, 0.0, 0.0, 1.0);
    169.             if (s.Skin > 0.5) {
    170.                 color.rgb = Skin_BRDF_PBS(s, oneMinusReflectivity, viewDir, gi.light, gi.indirect);
    171.             } else {
    172.                 color.rgb = BRDF3_Unity_PBS__ (s.Albedo, s.Specular, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect);
    173.             }
    174.             color.a = outputAlpha;          
    175.             return color;
    176.         }
    177.  
    178.         inline void LightingStandardSkin_GI (SurfaceOutputStandardSkin s, UnityGIInput data, inout UnityGI gi)
    179.         {
    180.             gi = UnityGlobalIllumination (data, s.Occlusion, s.Smoothness, s.Normal);
    181.         }
    182.  
    183.         void surf (Input IN, inout SurfaceOutputStandardSkin o) {
    184.                
    185.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
    186.              
    187.             float3 normal = UnpackNormal(tex2D(_NormalMap, IN.uv_MainTex));
    188.             fixed3 blurredNormal = UnpackNormal(tex2Dlod(_NormalMap, float4(IN.uv_MainTex, 0.0, 3.0)));  
    189.                            
    190.             o.Normal = lerp(blurredNormal, normal, IN.viewDir);            
    191.                                
    192.             o.Albedo = c.rgb;
    193.             o.Alpha = c.a;
    194.                
    195.             half4 maskColor = tex2D (_MaskTex, IN.uv_MainTex);
    196.             o.Specularity = maskColor.r * _SpecPow;  
    197.             o.Smoothness = maskColor.g * _GlossPow;            
    198.             o.Occlusion = maskColor.b;
    199.  
    200.             half4 skinFilter = tex2D(_SkinTex, IN.uv_MainTex);
    201.             o.Skin = skinFilter.r;
    202.  
    203.             if (o.Alpha < _Cutoff) {
    204.                 discard;
    205.             }
    206.         }
    207.         ENDCG
    208.     }
    209.     FallBack "Diffuse"
    210. }
     
    Harekelas likes this.
  44. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Thank you very much for the solution!
    And is there a way for me to use overlay to manipulate color variables in a shader? For now I only get to change the overlay texture's color.
    upload_2018-10-12_11-41-55.png
    I've got my custom eye shader here, and the color of the pupil is controled procedurally by two colors, is there any way for me to use UMA control these colors through overlay?
     
  45. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    I did use different colors on the same item before, but did it with using more than one overlays and changing the color value of the overlay through UMA.

    I think it should be possible to manipulate materials color values from UMA. I just don't know how. Probably asking this in UMA forum or UMA slack channel would yield a more sensible response.
     
  46. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    I just found out that there is only one color option for each material, can't modify multiple materials, maybe I'll just make my own script to manipulate the colors.
     
  47. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    I'd post about it in the UMA forum anyway. The requirement makes sense they might add that feature.
     
  48. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    751
    Great! Thank you very much! I'll go check on the UMA thread too.
     
  49. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    829
    Is there a way to get the characters to render HQ skins for the more realistic look?
     
  50. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    312
    Are you talking about the HD render pipeline or just higher quality textures?