Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Hair Designer - Dynamic hair & fur tool

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

  1. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    1st : vacation :p:p:p
    Then update of the texture generator & shaders, windzones and design tools :)
     
    punk and neoshaman like this.
  2. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @kalagaan hey bro, no rush - but I think I've found an issue - I'm getting some performance spikes when the hair is near the camera, hair has about 30 bones using the procedural V2 shader with 2 capsule colliders, only 900 verts

    hairProblem.jpg
     
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Thank you, I'll check that ;)
     
    punk likes this.
  4. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I've done some tests, when the hair is rendered on a large part of the screen, it could impact performances.
    To fix it you can set a smaller value for the 'hair density' in material tab, and a higher value for the 'Hair per pass'.
    I think that you should use the Atlas shader, it's really faster, and I'll improve the texture generator with more options.

    The cloth API is buggy on unity 2017, you have to decrease the Solver frequency to 20. The mesh is already animated by bones, so you won't noticed the difference, but the performances will be much better. :)
     
  5. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    thanks bro I'll give that a try :)
     
  6. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @kalagaan the atlas shader looks fantastic bro, performance is great also
    hair.jpg
     
    wetcircuit and kalagaan like this.
  7. r3ndesigner

    r3ndesigner

    Joined:
    Mar 21, 2013
    Posts:
    143
    Any news :)??
     
  8. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I'm working on the shader for a better lighting, with more parameters :)
    I'll post some screenshots when it will be ready ;)
     
  9. ImNotEvilsizer

    ImNotEvilsizer

    Joined:
    May 25, 2017
    Posts:
    20
    Hello ... was about to buy this asset but see its only for Unity 2017. I have a game close to finishing in 5.6.1 and would rather not go through the headache of upgrading right now. It seems like whenever I change versions in the middle of a project several weird bugs pop up that give me days of headaches. Any way to get this working in 5.6.1? Thanks.
     
  10. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    The cloth component is not stable on unity 5.5 and 5.6 (the editor crash), so I've decided to update only to 2017 :(
    I can send you the previous version for 5.4 +, but you should not use the cloth component option for the long hair.
     
  11. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Here some screens of the new lighting model :)
    I'll add the aniso texture to the generator.



     
  12. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Here a new version, I think that it's really better :p

     
    punk and r3ndesigner like this.
  13. r3ndesigner

    r3ndesigner

    Joined:
    Mar 21, 2013
    Posts:
    143
    agree, please dont forget the base mesh system and mirror tool *-*
     
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I'll work on the tools after the texture generator update ;)
    I need to generate the aniso texture for the specular settings.
     
  15. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Here the new lighting function with the long hair :)

     
    b_game_studios, punk and r3ndesigner like this.
  16. r3ndesigner

    r3ndesigner

    Joined:
    Mar 21, 2013
    Posts:
    143
    looks much more realistic
     
    kalagaan likes this.
  17. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Specular test :)

     
  18. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Nice
     
    kalagaan likes this.
  19. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I'm working on a new demo for HairDesigner, here a VR test
     
    Last edited: Sep 15, 2017
  20. julesd

    julesd

    Joined:
    Sep 30, 2016
    Posts:
    26
    Not sure if this was mentioned, but will this work well in Webgl. Is there a way to make the hair static?
     
  21. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Yes, it works with the webGL export, here a demo ;)
    You can choose to enable or disable the hair motion.
    There's some realtime settings for changing the hair rigidity.
     
    Last edited: Sep 17, 2017
    neoshaman and trilobyteme like this.
  22. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Hi is it possible to change the Hair Designer Shader colors at run time?
    I have got as far as:

    public HairDesigner hair;
    hair.GetLayer(i).m_shaderParams.ToArray()[0].
     
  23. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Yes, you can change all the shader parameters. ;)
    You have to cast it to the class of layer's shader.
    Code (CSharp):
    1.  
    2. HairDesignerShaderAtlas shader = hair.GetLayer(0).GetShaderParams() as HairDesignerShaderAtlas;
    3. shader.m_tipColor = Color.white;
    4. shader.m_rootColor = Color.white;
    5.  
     
  24. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Wow that was fast! Brilliant, thanks very much! Was really struggling with that one.

    Would I need to cast it back to assign to the layer?
     
    Last edited: Sep 19, 2017
  25. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    You don't have to assign it to the layer, GetShaderParams returns the reference of the data structure ;)
     
    Last edited: Sep 19, 2017
  26. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Hmm I'm still struggling with this, the line:

    shader.m_tipColor = Color.white;

    is producing a "NullReferenceException: Object reference not set to an instance of an object" error, I can't tell exactly why that's happening.
     
  27. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Do you use the AtlasShader?
    You have to cast it to the shader used on the layer :
    If you are using the procedural V2, you have to cast to 'HairDesignerShaderProcedural_v2'

    All the shader classes are in the folder : HairDesigner/Scripts

    I recommand to use the Atlas shader, it's faster than procedural and you can combine it with the textures generated by the texture generator tool.
     
  28. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Ahh ok I'm an idiot, I was using a different shader - thanks for the help!
    I'll also give the atlas shader a shot :)
     
  29. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I'll add a section in the documentation :p
     
    HummerBumble likes this.
  30. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Hello again, I'm a bit confused about the "Save Layers" button. It creates a prefab successfully, but how do I reapply this to a duplicate mesh? Is there a way to take the hair from one mesh to another via prefab? I've looked all the way through the documentation but can't find anything. Thanks!
     
  31. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    The "save layers" button, create references of the generated mesh in the project folder.
    You have to do that because the mesh have to be shared between the intances of your character.
    When you have saved the layers, you can duplicate the character.
    You can use the generated mesh like any mesh in unity, but the motion data won't be applied without the hairDesigner script.
     
  32. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Thank you that makes a lot of sense. I guess when I add new hair layers to one mesh, it will have to be reduplicated throughout all the models, then re-saved. Your support is brilliant by the way I will definitely be giving a good review.
     
  33. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Thank you :)
    Yes, you have to re-save when you edit a layer or when you add a new one.
     
  34. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    I know you are still working on the hair texture generator, but I found some good example if you can achieve this:





    I'm always on the look out to find good tightly curly example, this is the best I have ever found in term of silhouette, now the texture is kinda lost as per texture it's flat, we don't see individual hair strand (mostly because there is no normal/anisotropic map).

    I really like how they distinguish tight curl with wavy hair:





    So far you have been the best goto hair asset!
     
  35. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Thank you for the references :)
    The current version generator support only waves (for the strand and for each separated hair),
    I'll try to include somme additionnal parameters for the curls.
    I don't know yet if it will be included in the next version.

    Now the UI of the tool is more friendly, and it generates the specular/aniso texture for the new version of the atlas shader :D
     
    punk and neoshaman like this.
  36. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Here a test with the wave settings :)



    the textures have been generated by the tool :

     
    Last edited: Sep 21, 2017
    wetcircuit and punk like this.
  37. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Wow, I've worked for a year on HairDesigner :p

     
    Last edited: Sep 21, 2017
  38. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I've just added the length control to the atlas shader :)

     
    magique, GoRolyGo, punk and 2 others like this.
  39. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    The latest feature for the version 1.5 is done :D

    Now the texture generator can create 3 different hair colors on each texture.



     
    Last edited: Sep 25, 2017
    GoRolyGo, punk, neoshaman and 2 others like this.
  40. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,203
    that looks good. Have you completed the mesh export yet (so we can import into UMA, create slots)?


     
    hopeful likes this.
  41. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Thank you ;)
    The UMA export is not yet available :(, I wanted to optimize the hair quality first.
    I will also work on the morph compatibility.:p
     
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    the version 1.5 has been submitted to the assetstore team.
    It should be available soon ;)
     
    punk likes this.
  43. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Hey, this looks really promising. Seriously considering picking it up, but having been bitten by a few assets before, so I thought I'd ask a few questions (sorry if they've been answered previously).

    1. The alpha-blended stuff looks great, is this added in combination with cutout so that it receives shadows properly? (Really need proper shadowing, but cutout tips look awful, so some combination would be great).

    2. What control is there for colouring the hair differently across the surface of the mesh? Can we sample hair colour from the mesh's diffuse texture? (For instance, if you were making a wolf, could the upper part of the head be a dark grey, the neck white, with some variation in other places etc?). Ideally we'd also like some very high frequency variation across that in places. Sampling from a high res texture with some masked noise overlays would be great.

    3. Any plans to have a mode for root/tip colouring that's a ramp/gradient instead of two colours? This is useful for animals where there are more than two colours across the length of the fur. (I.e some grey wolf fur is dark at the root, white at the middle and then dark at the tip again).

    4. Play nicely with blendshapes? (Probably not essential).

    5. Sorry this is probably dumb, but I haven't found it entirely clear - does the tool only use the generated textures or can we plug in our own that have been authored elsewhere?

    6. Do all these features play nicely with the new Post Stack V2, write properly to depth etc?

    Our current project revolves around realistic wolves and other animals, so fur is obviously a very high priority. Currently we're struggling with solutions that shadow well, give us flexible colouring across the mesh and play nicely with physics. Your fur layer looks like it'll be well suited for the very short-haired layer that sits above the skin, and we'd then want to lay on the much longer alpha-blended hair for the fluffy stuff on top.

    Sorry for so much text, thanks for taking the time to develop such a cool tool already! :)
     
    OfficialHermie likes this.
  44. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    The HairDesigner component can generate 3 types of layers:
    - short hair: the polygons are painted on the surface, the vertices rely on the original mesh skinning.
    - long hair: the polygons are defined by some curves, and the bones are generated.
    - fur : the fur is defined by textures with the shell technic. It uses a specific fur shader.

    1. Unity does not provide shadows support for the transparent pass, but I have worked in a way to simulate the shadow on the alpha pass. There's a parameter to control the shadow strength. You'll need to balance between cutout and alpha to adjust the shadows.
    The Fur Shader does not use alpha blending, so you could use an AA filter on the camera.



    2. You can paint the color across the surface on a layer of fur (shell technic) but not on the short hair layer (polygons). I should add this feature, I could use an extra UV and another texture location. I will do some tests;)

    3. There is a strip setting for short hair (2 colors). And I should also add this feature to the fur shader. I have to do some tests for that.



    4. The fur layer works with blendshapes, but not the short hair layer. The long hair root is locked on a bone of the original mesh skeleton. This is a feature that I want to develop.

    5. You can use your own textures for each shader :) The specular / aniso uses the Scheurmann method, the 3 textures are combined into one
    R: specular, G: tangent shift, B: tangent mask
    The texture generator is really fast, and it applies the result in the appropriate texture slots, so you can easily do some tests.

    6. the shaders work with Post Stack V1, I'll try the V2

    You can also duplicate a shader and customize it with your own inputs. There is a way to create a script for including a custom shader in the HairDesigner user interface.
    Here is the documentation.
     
    Last edited: Sep 30, 2017
    tweedie and OfficialHermie like this.
  45. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    @kalagaan
    Are you actually aware how good you are?
    wow.png

    Your work is just outstandingly amazing.
     
    Last edited: Sep 30, 2017
    JamesArndt, KRGraphics and kalagaan like this.
  46. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Thank you :p
    This haircut has a totally changed when I've improved the long hair motion :D

    The version 1.5.0 PRO is available!
    I hope that the basic will be updated soon!
     
  47. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    Here a fix for the standard shader used in the 1.5.0 demo.
     
  48. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311

    Thanks a ton for such a detailed response! :) Those shadows look fine. Sounds like almost everything's covered, I think we'll look into picking it up ;) thanks again and hope the tests go well!
     
    OfficialHermie and kalagaan like this.
  49. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    I found a bug in the version 1.5
    The fur Mask and color are not saved properly.
    How to fix it :
    - Select the texture in the project folder
    - Set Alpha source : 'Input Texture Alpha'
    - Set Alpha is Transparency : 'True'

    I'll fix this in 1.5.1
     
  50. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,498
    HairDesigner Basic 1.5.0 is not yet available... I'm waiting for support from the asset store team.
    There's some bugs on asset submissions. :(