Search Unity

Hair Designer - Dynamic hair & fur tool

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

  1. CoderGirlEx

    CoderGirlEx

    Joined:
    Sep 1, 2017
    Posts:
    9
    I've been able to port my entire project to HD Render Pipepline already.
    Worked very fine and looks so much better.
    For most materials it's really easy.
    For Hair Designer I haven't found a way yet. o_O
    So any intermediate solution would be much appreciated.
    I also don't need real time movement.
     
  2. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The main problem with HDRP is that I can't create a specific lighting function for the hair, it's still a black box.
    So maybe I could try to generate specific textures for the standard HDRP shader.
     
    OfficialHermie likes this.
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The short hair layer could have problems with some mesh, I'm working on another way for transfering original skinning to the hair, it should also work with blendshapes :)
     
  4. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The final hair mesh is linked to the character mesh (skin & bones), there's no export for using them on other characters.:(
     
  5. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    So basically wants to character has hair on its head the hair can't be removed how do you add other hairstyles to a character's head?
     
  6. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    That would be amazing and a big help for all of us.
    I was told that HDRP Lit Shader with Material type "Anisotropy" renders hair just great.
     
  7. hunz

    hunz

    Joined:
    Oct 16, 2012
    Posts:
    29
    Thank you so much, can't wait to see what you do with it. Something about the way FleX skins the original geometry just causes issues on short hair. Fur works such a treat.

    I'm using short hair with a more bones / skinned / blend shapes and it shines!

    Thank you again!
    Hans
     
  8. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Hey kalagaan i got one question.
    Im using prefabs with fur shells of Hair Designer.

    Sadly after instantiating it always picks the default fur density map. Which is kinda bad, because im using my own density maps. I tried to select a different default density. Map, but it keeps picking the wrong one.

    Edit: Also could not apply the texture via script because the HairDesigner code is not public, and i dont want to mess to much around with it.

    Cheers.
     
    Last edited: Aug 26, 2018
  9. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can create many haircuts on the same model and enable or disable them at runtime.
     
  10. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Do you have the latest version from the asset store?
    If you still have the problem, please send me an email with your invoice number.
    The shader parameters can be changed at runtime with the API.
    The source code for the fur shader controller is public : HairDesigner/Script/HairDesignerShaderFurShell.cs

    you can access to the textures :

    Code (CSharp):
    1. public HairDesigner m_hair; // this is the reference of the hairDesigner instance
    2. void Update()  {
    3.      
    4.   HairDesignerGenerator layer = m_hair.GetLayer(0); //get the layer by id or by name
    5.  
    6.   //the shader parameters have to be casted into the shader class used by the layer
    7.   //All the shader classes can be found in the folder "HairDesigner/scripts/"
    8.   HairDesignerShaderFurShell shader = layer.GetShaderParams() as HairDesignerShaderFurShell;
    9. shader.SetTexture(1, textureInstance); //id 1 : density
    10.  
    I hope that it will help you ;)
     
  11. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Thanks a lot! :) I will give it a try.
     
  12. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Okay so would this not be able to work with my Uma? Or in any Runtime character creator?
     
  13. Jerome-P

    Jerome-P

    Joined:
    Apr 14, 2015
    Posts:
    34
    Is there perhaps a pre-release of Hair Designer that features that new basic material for HD RP that you talked about?
     
  14. kmetka

    kmetka

    Joined:
    Jul 5, 2018
    Posts:
    2
    Hi folks, does anyone know how to create a prefab of the hair so it can be imported in a different project and be applied to other avatars?
     
  15. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The design tools are made for the editor.
    The final generator can be used at runtime, but the strand data are feed by the editor tool.
    So if you want to create your own tool for realtime, you'll have to create a custom script for generating the strand data.

    I have to create a script for generating each haircut at runtime from an exported file or a prefab.
     
  16. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Not yet, I'll post some screenshots asap.
    I'll have more time for working on it next week ;)
     
  17. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    you can create a prefab of your character with the hairDsigner component, you have to lock every layers and save them before the prefab creation.
    The save process will create the mesh references of each haircut in your project folder.
    These references will be shared between all the instances of your character prefab.;)
     
  18. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Amplify Shader Editor is now compatible with HD SRP :)
    I'll work on a version of the hair shader with it.
    It will be compatible with the motion system & the wind :p
     
    Last edited: Sep 3, 2018
    OfficialHermie likes this.
  19. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Lol dude i would have bought this Amazing tool days ago If u would have just told me this, thats Literally the same thing i was asking haha Thank you!! will be getting it asap.
     
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    First result with HDRP
    need more work, and more parameters :p

     
  21. sasob8

    sasob8

    Joined:
    Jul 11, 2017
    Posts:
    25
    Great! Hope these parameters come asap ;)
     
    OfficialHermie likes this.
  22. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    yes, I'm working on it :)
    And the shader will be editable in Amplify Shader Editor :p
     
  23. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here a test using my HDRP shader and the unity HD/lit for the alpha pass.
    That looks much better :)



    I've still some problems with the alpha and the shadows in ASE,
    I hope that the Amplify team will help me to fix it :p
     
    Last edited: Sep 19, 2018
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Now that's looking more like hair. Previous shader was just not quite right.
     
    OfficialHermie likes this.
  25. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Freaking amazing! You're a *** genius!!!!! :-DDDDDD
     
    kalagaan likes this.
  26. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    So far, I love this Fur Plugin and it's very effective for what I am going for :D

    The Mask Texture seems to be giving me problems and I have tried a lot to get it to work to no success.

    I have purposely blacked out some areas of my model in my painting program to prevent fur from growing there as a Mask Texture but no matter how many times I experiment with Alpha intensities, it all seems to be the same exact length and growth across the entire model despite giving Alpha values.

    In this post, I have attached two images showing the Texture I used and the plugin with it's settings I used so far, which are going to change.

    Would this be a me problem or maybe a bug?
     

    Attached Files:

  27. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The mask is defined on the alpha channel, but your texture is define as RGB, not RGBA.
    Have a look to the compression type, try something that allows the alpha channel.
    you could also try to generate a new texture with the tool, and copy/paste the alpha channel of your texture with photoshop.
     
    Last edited: Sep 19, 2018
  28. QBGROUP

    QBGROUP

    Joined:
    Feb 14, 2017
    Posts:
    3
    Hi,
    I'm completely new to this plugin. I can't find a tutorial for Long hair, is there one? I don't understand how it works, I'm able to create some hair strands, but to create a complete head would need tons of them. Adding one by one doesn't seem to be how it is designed.
    I'll need some more help, but for now this is enough.
    Thank you
    marco
     
  29. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hi Marco,
    sorry, I didn't made a tutorial yet for the long hair layer. :(
    The idea is to create one strand and duplicate it with the shortcuts, so you can easily add many strands around the head.

    shift : enable the selection
    Alt+shift : enable the duplicate button
    Alt+drag : move the strand on the mesh surface.

    so the method is to hold the alt key and duplicate/move the strands.

    The strands will snap to the head while moving.
    You should use the different layers for optimizing the selection.
    Have a look to the HaircutDemo_AtlasShader, the long hair was made with only 25 strands.
    You can also add a short hair layer if you need, and you can copy/past the material parameters between layers.
     
    Last edited: Sep 19, 2018
  30. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    Thank you for the solution, turns out it was a Unity and Substance Painter thing :D
     
    kalagaan likes this.
  31. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Could you give a rough estimation when you're going to release an update for HDRP?
     
  32. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    And I've still some features to add, like wind and motion zones.
    The texture generator is now compatible with the HDRP shader.
    I've converted the hair shader into an ASE node, so it will be possible to customize it.
    I'm still waiting for support from the ASE team about HDRP transparency and shadows, so I don't know yet when it will be available... maybe 2 weeks...
     
    punk and OfficialHermie like this.
  33. Zuon94

    Zuon94

    Joined:
    Aug 4, 2011
    Posts:
    11
    Okay, I'm completely lost. Using this for the first time, consulting the documentation, trying to make long, female hair, and I can't get my character to not look like Cynthia from RugRats. I don't suppose there are any actual tutorials for long hair with this asset, are there? I'm not finding any.
     
  34. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hi,
    sorry there's no tutorial yet for the long hair layer.
    Have a look to the demo scene, there's a sample with the long hair layer.
     
  35. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Next version will support blendshapes :D



    It will also fix the problem ofcompatibility with some meshes and bone hierarchy. :p
     
  36. Amitr

    Amitr

    Joined:
    Mar 3, 2013
    Posts:
    17
    Hi
    I am trying to add a collider.

    I added a capsule collider to the mesh
    Using the collider tools i place it where my long hairs are.
    I added the 2 colliders to the collider list under the motion tab,

    None of the hairs seems to respond to the collider when i press play and moving the object with the move tool
    Is that a known issue?

    EDIT:
    Did exactly the same test on a unity sphere and it is working. but not working on my character

    My model is simple fbx human girl no bones no animations no morphs. ill import an fbx clean sphere and will try again.

    EDIT 2
    Imported FBX sphere was working.
    Tried to match the FBX human to my fbx sphere entire settings but still not working.I go back to maya try to reset all the human attributes maybe it will work. otherwise, I don't know what else to do ...


    Edit 3
    Nothing works
    Tried many characters. anything that is not a new sphere will not work. right now the collision of the system is broken from my tests. will be happy to get help and make it work.

    Thank you
     
    Last edited: Sep 30, 2018
  37. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hi,
    That's weird, the capsule collider should collide with the long hair if the reference is set in the collider list.
    could you send me a fbx that doesn't work (contact@kalagaan.com)?
    I'll do some tests ;)
     
  38. Amitr

    Amitr

    Joined:
    Mar 3, 2013
    Posts:
    17
    Thank you, sent.
     
  39. Amitr

    Amitr

    Joined:
    Mar 3, 2013
    Posts:
    17
    Thanks Kalagaan for the help over email.
    I manage to make it work using the example and help sent fast thru email.
    Hope to see Collision improvement on next updates as this system needs a little more work.

    I think it will be great if you can contact and ornatrix team and try to have a solid connection that can use ornatrix hair output straight to your system, making the visual hairs better looking

    Anyway, awesome system great support thank you
     
  40. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Interesting hair tool. Does it work in consoles? (XboxOne, PS4, Switch) ?
     
  41. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    would you think be possible to create an exporter to get it outside of unity (sketchfab for exemple)
    it would be awesome to present characters directly with this visual
    Screenshot at 2018-10-05 17 23 51.png
     
    kalagaan likes this.
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I don't have consoles dev kit, so I can't test it. :(
    But I think that it should work, the hair shader is based on unity PBR functions. ;)
     
  43. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Nice model :)

    I didn't try to export to sketchfab yet, maybe there's a way to fake the fur layers with some textures and exporting the shells as individual meshes.
    Now I've a lot of work, but I'll have a look ;)
     
    Last edited: Oct 6, 2018
    neoshaman likes this.
  44. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Last time I said I might have made a breakthrough for curly hair shader, I have laid out some prepatory work, I'll share in case people are interested.

    The idea was to raycast in shader using wrapping function to get the parallax of hair in a single hit, and get potentially the exit accumulation of all hair in a single compute.

    I'm not exactly there yet, I'm struggling with intermediary math, I solved it mostly "visually", but I don't see any obstacle to implementation except my might skills. I made a prepatory shader (relief function) and I'm now moving toward implementing parallax hair.

    The idea is simple, if you trace through a grid, the slope of each successive grid change in a predictable manner. If we assume all same size hair cross section is exactly at the center of the grid cross section, them it become a modulo space.

    So given a ray, he can now know in how many grid cells the ray must pass before there is an intersection. Which mean we have parallax and occlusion per ray (ie per fragment) in a single hit. And using that same idea, by computing the exit point we can deduce how many hit there was between the entry and the exit, which allow us to derive thickness.

    The algorithm work by taking the ray direction and computing the derivative of the visibility cone direction (hair have round cross section, we can find the tangent and get a dot product that translate into the angle of which the ray must be to get a hit) when the slope change. So we just compare the ray direction, the distance of the center of the hair cross section, the size of the hair and then have the derivative of the entry of the ray at each cells compared to the derivative of the cone.

    Now the idea for curly is to find an equivalent algorithm but rotating the cross section around a given axis, which is a much more complex function.

    The problem of the algorithm is that hair are space predictably, But that's less an issue since we are getting the hit into a parallax volume into single operation, we just combine multiple random parrallax volume to get the required complexity. Which is cheaper than raymarching random data.

    For taking into account deformation, we can vary the cross section thickness based on the stretch factor of the fragment to get constant visual size, which is uniform across a single face.
     
    Last edited: Oct 6, 2018
  45. sasob8

    sasob8

    Joined:
    Jul 11, 2017
    Posts:
    25
    Not trying to pressure :rolleyes:, but is there a possibilty that HDRP support will come this or next week? (even hardly working beta would be fine :))
    Thank you and great work either way
     
    OfficialHermie likes this.
  46. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I was about to write the same... Your hair is what's missing in my project.
    Any beta would do.
     
    Last edited: Oct 8, 2018
  47. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I'm finishing the version 1.6 before working on the HDRP shader.

    It will include a new version of my skinning system. The short hair will be compatible with blendshapes, and I've added some additionnal parametters to the brush.
    It was more complex than expected, but it's stable and faster now. :p
    This part is really important, because in the current version some models doesn't work properly with HairDesigner.
    In the next version the model won't need to be in T-pose for painting the hair/fur. it will be possible to paint on the model, then modify the blendshapes and continue the modification of the hair.
    When all the tests will be ok (I don't want to publish a buggy version), then I'll work on the HDRP shader.

    There's still some issues with the Amplify Shader Editor for the HDRP transparency and shadows, I'm still waiting for support :( I hope that they will fix it soon.

    For a beta version of the HDRP shader, please send me an email (contact@kalagaan.com) with your invoice number
    I'll send it when it will be more advanced ;)
     
    blackant and AlexanderElert like this.
  48. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you for sharing :)
    Here some shader math that could help :p
     
    neoshaman likes this.
  49. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Of course I'm on inigo quilez :p this is essentially what I need
    http://www.iquilezles.org/www/articles/intersectors/intersectors.htm
    http://www.iquilezles.org/www/articles/ellipses/ellipses.htm

    But the math prove tricky because it seems I have forgot some part of math (20 years since school), and I'm confuse right now as how to proceed. For example: I don't know how to switch between parametric and implicit equation, which is required. Currently trying to implement simple relief function shader, that raycast primitive for cheap repeating greebling relief effect, to validate the necessary math skill I need.

    I'm currently trying to find intersection with an arbitrary 2d curved swept along one axis. I also have the intuition that I will need derivative to get some sweet stuff, though I have no idea what it actually mean in practice mathematically, I forgot everything :( You can see me fumbling awkwardly here, I'm sure I struggling on very simple math concept :oops: https://forum.unity.com/threads/relief-function-shader.549472/#post-3753844 I'll be ashame when I realize I knew the solution all along but just forgot the obvious ... (currently I did the stupid mistake of trying to find a single t for two ray equation, when they should have had their own t ...). That will be necessary to master to get the curly hair which is one degree more complex (helicoid intersection with relax period, to see both longitudinally and from a top down perspective).

    However I did find some stuff that might help for the parallax part, as I wasn't the only one thinking about modulus space!
    https://www.shadertoy.com/view/lly3Rc
    https://www.shadertoy.com/view/MlK3zt
    https://www.shadertoy.com/view/4tyGDK
    I was about to do the exact same thing as a next step :eek: Which already give a simpler working hair volume (ie thin strip of flat hair, can compute the fake normal by taking the distance to the center).

    I kinda consider the math "solved", as in feasibility of the concept is established, the hard part now is implementation and optimization (I hope it can work on opengl es 2.0).

    I found that math is the hardest thing to get help on, especially if it is about some trivial stuff I should know lol :confused:
    Once those nitpick sorted, I think it should be easy to get a proper infinite hair volume shader (well simplified).
     
    kalagaan likes this.
  50. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    i hope to see the next version with alembic mesh [bone less] support too :]