Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Hair Designer - Dynamic hair & fur tool

Discussion in 'Assets and Asset Store' started by kalagaan, Sep 16, 2016.

  1. trez_mm

    trez_mm

    Joined:
    Jan 17, 2018
    Posts:
    5
    Forgive me for another question - I just started using Hair Designer and it's great!

    I'm having a problem where the hair is visible through the character mesh (I'm seeing hair from the front rendering when looking at the back, and vice versa).

    The scene is using HDRP, and the character's shader is HDRP/Lit. Switching to another shader type doesn't seem to affect it.

    I understand the HDRP functionality is brand new, but I wonder if you've seen this and if you have advice for fixing it?

    Thanks again for the awesome tool! I've attached an image to show my issue.
    HairClipping.PNG
     
  2. trez_mm

    trez_mm

    Joined:
    Jan 17, 2018
    Posts:
    5
    Nevermind!

    Immediately after posting, I found that setting the hair material's Depth Offset to 0 fixed it!

    Thank you for this quality tool! HairClipping2.PNG
     
    kalagaan likes this.
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    WIP new fur shader (geometry shader)
    compatible with the Texture Generator :)


     
    hopeful likes this.
  4. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Here with more density

     
    kilik128 and led_bet like this.
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    That looks really nice! :)
     
    kalagaan likes this.
  6. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Mixing fur technics (shell and geometry)

     
    Last edited: May 29, 2019
    kilik128 and led_bet like this.
  7. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Now it's compatible with the custom color map :)

     
    led_bet likes this.
  8. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    And it's also compatible with the fur mask :p
    Super fun to use :D

     
    kilik128 and led_bet like this.
  9. led_bet

    led_bet

    Joined:
    May 5, 2015
    Posts:
    83
    This is incredible! Is it possible to adjust settings like this at run-time? I have a creature design that is covered in fur-like tendrils all over its body that change color based on mood. Would that be possible out of the box?
     
  10. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Yes, there's a lot of settings that you can change at runtime, like : root and tip colors, length...
    You could also modify the textures ;)
     
    led_bet likes this.
  11. led_bet

    led_bet

    Joined:
    May 5, 2015
    Posts:
    83
    Brilliant. Thanks for the heads up :) I will definitely pick this up!
     
  12. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Thank you,
    this version still need a bit of work, but it should be available soon ;)
     
  13. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    WIP better control : lighting, AO, shadows

     
    kilik128, nirvanajie, Acekey and 3 others like this.
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Wow really nice result :)

    tip : you can change the alpha of the root color to fade the strand with the skin. ;)
     
    hopeful likes this.
  15. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    I can't stop playing with that :p

     
  16. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Pretty awesome. Will this work with skinned mesh renderer and rigged creatures and in play mode?
     
  17. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Yes, it will work with skinned mesh ;)
    The brush system is based on textures, so it could work at runtime,
    I'll add a way to interact with the fur at runtime later ;)

    This shader will only work on platform compatible with Geometry shaders.
     
  18. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Awesome. I need this! ;)
     
  19. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    93
    I am new to this asset, it looks fantastic, but I am having some issues (I bought the lite version initially, which I am sure is not helping).

    I create hair dynamically on an UMA. I set the motion zones through code at time of creation. This all seems to work well, but it is like they are not initiated? If I click on the UMARenderer during test and then select the Motion button on HairDesigner component then they suddenly start working (no other changes).

    Setting the variables seems a little cryptic, eg. setting the limit float involves setting the y component of a Vector2 with no idea what the x component does?
    I have yet to find how to set damping and bounce etc. through code?
    Have I missed a detailed explanation of the API somewhere?

    So I tried changing the hair colour through code at the time of creation (there is an example for this in the documents), which I initially copied. The debug shows all variables are setting correctly, but the colours/parameters do not change. If I change them in the editor during test they do change. I have included layer.m_shaderNeedUpdate = true; which in the absence of an API explanation I assume is the cue to update?

    Thanks for help
     
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Thank you for the feedback,

    the parent bone of the motion zone is not properly initialized, when the runtime layer is generated. :confused:
    Sorry, I'll fix that in the next release.

    I'll also add an API to setup the motion zone at runtime ;)
    In the current version, it's a bit tricky to change the values :p

    Motion limit :
    The x parameter is the negative limit
    layer.m_motionZones[0].motionLimit.x = -layer.m_motionZones[0].motionLimit.y


    Damping parameter :
    layer.m_motionZones[0].pid.m_params.kp

    Bouncing parameter :
    layer.m_motionZones[0].pid.m_params.ki


    You have to set the parameter m_shaderNeedUpdate to true when you want to modify the shader parameters at runtime. This is specified in the documentation :
    layer.m_shaderNeedUpdate = true;

    I'll add a comment in the documentation to explain that this is mandatory. ;)
     
    Last edited: Jun 7, 2019
    DankP3 likes this.
  21. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    93
    Thank you for the fast reply (I am not surprised i struggled to find those variables :).

    Regarding this last comment, I did add this line as specified in the documents, but it doesn't appear to work? This point was clear in the document.
    If i recall correct, it was in Update(), but i assumed that is unnecessary to do in Update()? Changing the colortip in the editor during test mode worked fine, changing through code and debugging through code seemed to suggest it worked but the colour did not change.... could i be missing anything else?
     
  22. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    The final modification is made by the HairDesigner component Update()
    So the HairDesigner component must be enabled.

    I did this test with the UMA loader

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Kalagaan.HairDesignerExtension;
    5.  
    6. public class TestChangeColor : MonoBehaviour {
    7.  
    8.  
    9.     HairDesignerUMALoader m_loader;
    10.  
    11.     // Use this for initialization
    12.     void Start () {
    13.         m_loader = GetComponent<HairDesignerUMALoader>();
    14.  
    15.     }
    16.    
    17.     // Update is called once per frame
    18.     void Update () {
    19.        
    20.  
    21.         if(m_loader.m_hairDesigner != null)
    22.         {
    23.             HairDesignerGenerator layer = m_loader.m_hairDesigner.GetLayer(0); //get the layer by id or by name
    24.                                                               //the shader parameters have to be casted into the shader class used by the layer
    25.                                                               //All the shader classes can be found in the folder "HairDesigner/scripts/"
    26.             HairDesignerShaderAtlas shader = layer.GetShaderParams() as HairDesignerShaderAtlas;
    27.             //all the shader parameters can be modified
    28.             shader.m_tipColor = Color.white;
    29.             shader.m_rootColor = Color.red;
    30.             shader.m_length = .5f;
    31.             shader.m_alphaCutoff = .8f;
    32.             //...
    33.             layer.m_shaderNeedUpdate = true;
    34.  
    35.         }
    36.     }
    37. }
     
    DankP3 likes this.
  23. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    93
    Thanks, that must be it. Will change.
     
  24. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    The advanced Fur layer will include a GPGPU motion system instead of the motion zone. :)

     
  25. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Here on sphere

     
    led_bet likes this.
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    This is looking better and better all the time. :)
     
    led_bet and kalagaan like this.
  27. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    On a Skinned mesh :D

     
    hopeful and Ruberta like this.
  28. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    I have some cats that are waiting for this….
     
    kalagaan likes this.
  29. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Can we set the strength of the physical fur wobbling with a map/fur lenght by normals(directions) or by a global value?
     
  30. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    There's a
    For now there's a global value for the motion settings, and there's a texture mask for the length.
    I'll add additionnal settings in a texture, so it will be possible to set the wobbling FX on specific parts of the mesh.
     
  31. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Cool. :>

    wobbleFX = furlenght * globaleffectstrenght then and in future version there is basically wobbleFX = furlenght * furmask * globaleffectstrenght.

    Great work so far. :> I assume wind and gravity will also work at some point.
     
  32. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Yes, wind and gravity will also work with it ;)
    Most of the parts are already done, now I have to finish to mix all and optimize :D
     
    Last edited: Jun 14, 2019
    hopeful and Acekey like this.
  33. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Better gravity settings :D

     
    Last edited: Jun 15, 2019
    Ruberta, hopeful and wetcircuit like this.
  34. DeadSeraph

    DeadSeraph

    Joined:
    Sep 8, 2017
    Posts:
    97
    I haven't gone through the whole thread but found this while on my quest for UMA hair. Am I correct in stating that this is now compatible with UMA? It looks amazing just as it is, but I'm looking for something that can be integrated with UMA.
     
  35. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Short hair and long hair layers are compatible with UMA, but the fur layer is not.
    There's a addon for UMA in the package :)
     
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    Is the fur layer eventually going to be UMA compatible, or is there a fatal snag?
     
  37. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    It looks like UMA compact all the textures into a single one and modify the UVs.
    The fur layer is based on Texture mask, so the uvs are different from the original mesh. :confused:
    I'll search a way to fix that later ;)
     
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    Things can be separated by material, if that helps.
     
  39. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    The main issue is that the UVs are different from the original version. :(
     
  40. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    It has been like 15min since I spammed this thread…

    Unity - Main Camera 2019-06-21 at 10.46.36.png
     
    hopeful likes this.
  41. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    That's looking pretty good. :)
     
    wetcircuit likes this.
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Wow!
    Really nice :)
     
    wetcircuit likes this.
  43. Rumplestiltz

    Rumplestiltz

    Joined:
    Jun 23, 2019
    Posts:
    1
    Ugh... This program/plugin is great but I am reallllly struggling to get it working the way I would like. Pretty much every haircut I attempt to create ends up looking like Danny Green from the Raptors lol.

    But I have one major question that I can't seem to find the answer anywhere in the docs:

    How on earth do I switch layers of haircuts at runtime?

    I am trying to make a character designer, and was hoping to create 7-8 haircuts, and a simple "- +" button GUI to cycle through the different cuts etc... but I cannot find any API documentation on that, and in the coding environment its even less obvious. Like I see how to GetLayer... but I don't see a "SetLayer" function or an enable layer... There is some cryptic sentence about how you can call a prefab, and I see some function m_prefab but thats as far as my Sherlock skillz went.
     
  44. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    You can enable/disable each layer with the bool parameter 'm_enable'
    m_hd.GetLayer(i).m_enable = true;

    I'll add this in the documentation ;)
     
    wetcircuit likes this.
  45. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    @wetcircuit great work :D do you think you can add "baby hair" to ground the hair to the scalp more?
     
    wetcircuit likes this.
  46. r3ndesigner

    r3ndesigner

    Joined:
    Mar 21, 2013
    Posts:
    143
    any news about braids? basic hair caps to speed up creation? Or the possibility to export the hair with bones to give some touches in another software and re-import?
     
  47. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    I'll continue my work on the mesh generator after the release of the advanced fur layer.
    Maybe I should add the way to import custom mesh in the long hair layer, it could be done before the release od the mesh generator.

    I've no plan to export/import the hair models, it would be a pain to keep the skinning and the blendshapes compatible with the original character. I want to keep a non destructive workflow, so you'll always be able to edit the haircut within unity.
     
    wetcircuit likes this.
  48. ObiOneStenobi

    ObiOneStenobi

    Joined:
    Jan 20, 2017
    Posts:
    6
    Hi, I've found a problem when importing HairDesigner runtime layers to a UMA character.

    In the HairDesignerUMALoader class:

    Code (CSharp):
    1.  
    2.     public void Awake()
    3.     {
    4.        
    5.         // WRONG: avatar not found
    6.         //UMA.UMADynamicAvatar avatar = GetComponent<UMA.UMADynamicAvatar>();
    7.  
    8.         // CORRECT: avatar found
    9.         UMA.UMAAvatarBase avatar = GetComponent<UMA.UMAAvatarBase>();
    10.  
    11.         if (avatar != null)
    12.             avatar.CharacterCreated.AddListener(GenerateLayers);
    13.        
    14.     }
    15.  
    I'm currently using Unity 2019.1.1f1, HairDesigner Pro 1.7.0, UMA 2.8.1
    Is it a proper fix or maybe I've messed up something?

    Anyway nice work with HairDesigner! It's one of the best tools out for Unity!
     
  49. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,487
    Thank you for the feedback, :)
    It works well with the UMAAvatarBase class, I did my tests with UMADynamicAvatar.
    I'll fix the script for the next release ;)
     
    ObiOneStenobi likes this.
  50. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Is this a better hairline? :D

    Turns out there's a whole panel where you can "anchor" the root of the hair to the model… So now that I see how to adjust it I realize how bad my settings were, lol.

    Unity - Main Camera 2019-06-27 at 18.47.41.png
     
    Last edited: Jun 27, 2019
    hopeful and kalagaan like this.