Search Unity

Hair Designer - Dynamic hair & fur tool

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

  1. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA uses standard Skinned Mesh Renderers. The only issue that I see is that it requires the vertexes to be tied to specific bones (to support customization). If you were able to generate the bone-weights so that they were the same as the nearest vertex on the mesh, it could in theory work fine.
     
  2. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Maybe I'm wrong, but the SkinnedMeshRenderer is generated at runtime,
    so I can't apply the HairDesigner component and use it when the editor is not playing.
    I need to learn more about UMA :p
    The bone weights from the original mesh are already applied to the hair mesh.
     
  3. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You're right, it is generated at run time. The base fbx meshes are available though, and UMA has the ability to generate all the slots/overlays that it needs from a mesh.
    So in theory, someone could import the base fbx meshes, generate the hair, and if your app created a SkinnedMeshRenderer for the hair, it could build all the stuff needed for UMA. If your app goes on sale, I'll give it a try! :)
     
  4. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, that should work ;)
    Thank you!
     
  5. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hi,

    I was wondering if the hair/fur works with skinned mesh renderers. Reading through the asset description and the comments in this thread, I "think" that it does. But it is never explicitly stated anywhere.

    So does the hair/fur work with skinned mesh renderers?

    Thanks :)
     
  6. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes it works with SkinnedMeshRenderer
    The hair/fur follow the bones motion ;)

    Here a sample with the HTC vive
     
  7. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here a sample with the 3 shaders included :
    Hair&Fur - Fire - Standard ( feather texture )
     
    Velo222 likes this.
  8. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Looks pretty cool :)
     
    kalagaan likes this.
  9. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thanks :)
     
  10. HermieW

    HermieW

    Joined:
    Oct 16, 2016
    Posts:
    10
    I have a newbie question, please:

    How could we get the hair to look realistic?
    I like the approach very much, but it doesn't look realistic to me, judging from what I have seen.

    Is that due to the nature of the procedural hair, or is it somehow possible to achieve as realistic-looking hair like the Unity Volund hair?
     
  11. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I'll keep trying to optimize my hair shader.
    You can also use some hair textures with the standard shader.
    I'll work on a texture atlas, then you'll be able to switch between different UV for each strand.
    I also planned to create a texture generator that compute complexe hair shape. :)
    But first I'm focused on long hair and ponytails.
     
    HermieW likes this.
  12. Slowbud

    Slowbud

    Joined:
    Jul 19, 2015
    Posts:
    81
    Kalagaan, will you include the long hair and ponytails in the pack? When do you guess it's finished?
     
  13. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Of course it will be included
    Hair Designer is not a complete tool without this feature :p
    I have rewritten the code twice, that's why it took more time than I expected...
    Lot of people ask me for it, so here the state of my work:
    - I've created a new layer type for long hair.
    - the brush tool create hair strands driven by a curve
    - each curve can be edited in the scene view :
    -> number of nodes, tangents, rotation around the curve, the shape along the curve, subdivisions (X,Y)
    - the generated mesh has bones and physics (still need debug)

    There's still some work to do :
    - multi selection UI for the curves edition
    - Add some parameters to create procedural hair strand templates along the curve (for creating ponytails with a single curve)
    - Plug the animation system
    - intensive test on many assets
    - debug

    With this system you'll be able to create long hair, ponytails, mustache, eyebrows...
    you'll be able to lock objects on the bones.
    The big part of the job is done :cool:
    I hope I'll post some screenshots soon!
     
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here a ponytail sample :

    This is driven by a single curve and some procedural settings.
    You'll have a full control of all parameters : size, shape, rotation angles, subdivisions...
    It will be easy to create LOD by sliding some values :)
     
    Last edited: Nov 12, 2016
    punk likes this.
  15. HermieW

    HermieW

    Joined:
    Oct 16, 2016
    Posts:
    10
    Sorry for the question: Can we / you use the Volund Hair Shader like Morph3D does? And if yes, could you post the results?
     
  16. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503

    I did a quick test with the shader included in MCS Female Lite package.
    I've took some parts of the original textures to fit the UV of the generated mesh (Diffuse/normal/specular).

    With the procedural shader of Hair Designer, you can change all the look and feel of the hair (color, shape, size, specular...).
    No need to look for hair textures, all is done in the shader itself. ;)
    So you can edit all the settings at runtime :D
     
    Last edited: Nov 14, 2016
  17. sickbattery

    sickbattery

    Joined:
    Jul 13, 2014
    Posts:
    20
    First of all: HT v1.0.6, Unity 5.4.2f2, Radeon R7 370, Win 10 x64, your "Demo" scene (reimported, removed, imported, all the same)

    When I click on play in the editor I get:
    And everything works, I see the hair, it's moving fine, I can edit stuff ... but: Focus on an other window or task bar and go back to unity and the hair disapperas and never comes back -.- ... no exceptions in editor, everything else is still working.
     
  18. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hi,
    these errors do not come from HairDesigner :confused:
    You're on the wrong forum :p
     
  19. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    hi, is it possible to add/remove hair at runtime?
    thank you.
     
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hi,
    you can't paint hair at runtime, but you can enable/disable the hair layers.
    You can also modify the shader parameters (by instance) at runtime : size, density, color...
    The hair mesh won't change but you can create some fx like hair grow, or density modification :
     
  21. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Lol just noticed this :)
     
    kalagaan likes this.
  22. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Hello! (cc: to @Martin_H )

    Remember when I asked about afro hair (not the hairstyle, the hair type), I told you you where halfway there ... Well be prepared to be the most complete hair solution ever :D!

    I worked a bit on the fundamental and solved the main problem! Better, it's directly compatible with straight hair's workflow, as there is a direct relation between the two, it's just a mere extension of your current solution. :)

    To understand the basics, it's very simple. Hair exist along a spectrum, from tightly curled to straight through wavy hair. But if you take a curled hair and stretch it, it start to show a wavy pattern, and stretched to the maximum it's a straight line (we will ignore torsion stress as it's another problem for lighting shader implementation), so straight hair and wavy hair can be seen as specific cases of curly hair, we can define them by that.

    Can we reproduce this, using the simple polygon population we have, to create all hair type inside the spectrum?
    It seems the solution is a flat YES!

    As shown straight hair and wavy hair are specific case of curly hair, therefore:
    1. Using a folded polygon along it's length, with a wrapping "S" texture along the length, that correlate to each folded period gave us
    https://www.dropbox.com/s/sgoeeu7idmdh4ul/Capture d'écran 2016-12-08 19.42.14.png?dl=0
    which looks like that at another angle, effectively recreating the volume of the curl!
    https://www.dropbox.com/s/yqobnq5xp20q6tz/Capture d'écran 2016-12-08 19.48.50.png?dl=0
    We can also tile the curl within the width of a single polygon strand!
    https://www.dropbox.com/s/cer1os0rg8nr2dk/Capture d'écran 2016-12-08 19.53.47.png?dl=0
    here is the strand's mesh
    https://www.dropbox.com/s/658n3mnxy8g5sgw/Capture d'écran 2016-12-08 19.53.54.png?dl=0

    Now that was a crude prototype, I tried more complex S shapes, more irregular, to look more like hair, and it works great! Also you can superpose hair texture's lines along the width of the polygon strand to get better effect (pretty much like straight hairs), as long as the S curve have the same period than the strand fold (you can still mirror the S shape). If you unfold the polygon strand until it's flat, you obtain a wavy pattern, just like when you do it with real curly hair.

    Now a bit of subtlety:
    - the "style length" and the "hair length" are new parameters, ie style length is always shorter than hair length in that they are the folded length of the hair, if you were to unfold the mesh, it will reveal the real length of the hair, and that's the same length than straight hair on the same polygon strand.
    - The number of division along the length depend on the tightness of the curl (it affect the fold period because S curve are shorter), tighter curl is basically scaling the texture along the length (though you need uniform scaling to conserve shapes), so scaling curl along the length is modifying the number of division, proportionally, to keep the volumetric effect.
    - Physics must have a spring component along the length that depend on the ratio of the "hair length" vs "style length", the bigger the ratio, the stiffer the physics. Mesh must also unfold when stretched a bit, to keep length of division constant (I think it's a simple trig relation).

    Do you think this can be added? It will be the most complete polygon hair solution on the market! :p
     
    Last edited: Dec 11, 2016
    kalagaan likes this.
  23. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Wow, thank you :)
    You did a nice work!
    I'm pretty close to that kind of solution.
    I already use a S shape for the hair drawing, and the long hair code has an option for creating the wavy shape (for volume).
    The geometry and the shader parameters are not linked, so the period of the S shape has to be set manually.
    The result is not yet perfect, but I'll work on it.


     
    kurotatsu and neoshaman like this.
  24. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Another screenshot with different parameters
    3700 tri
     
    neoshaman likes this.
  25. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here a quick test of the long hair layer :)
     
    kurotatsu likes this.
  26. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here the settings

    10 curves with some settings :D

    setup done in 5 minutes :p
     
    punk and neoshaman like this.
  27. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    I'll try to buy the pro version this month if anything is clear! that's great and it seems to fit my need!
     
    kalagaan likes this.
  28. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    cool :)
    I'll submit the release of the long hair layer to the assetstore this week.
    I have to write the documentation and update the demo.
    I'll also do a video tutorial ;)
     
  29. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Lovin' what I'm seeing.:D

    Great work guys!
     
    kalagaan likes this.
  30. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you ;)
     
  31. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here a sample with my War Dragon :)
     
  32. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Version 1.1.0 is available on the assetstore :D
    Long hair layer available

    next week : version 1.1.1
    shader improvment ;)
     
    neoshaman likes this.
  33. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    version 1.1.1 has been submit to the assetstore it should be available soon :)
    It fixes the lighting problem for the long hair layer.
     
  34. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    I have bought it btw

    I wonder can you have a shader like in unreal engine paragon? basically they pick a depth snapshot like in shadow mapping, but when comparing the sample to the depth map they use the distance to fragment as an absorption rate (basically a thickness approximation). I wanted to look at the personal shadow used in the blacksmith demo to try modding it for that purpose, but it' still a bit above my level.

    Also the current shader seems to be a cut out, it would be cool if there was an option to change the cut out depending on distance to have denser hair, in order to have better silouhette.

    Also a softer transparent shader (not cut out) for quality shoot, and capture the finer details.

    Also can is there more than one type of strand in a single simulation? I want to replicate that look:

    It's obvious that just curly won't cut it to have the full texture!
    Anyway getting close one step at a time lol
     
    kalagaan likes this.
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    This looks very promising. I'm pleased to see that it's a GPU solution and should work on any SM 2.0 or better platform. I am using the Wii U, which has SM 4.0 so this should work nicely. I'll put this on my wish list and pick it up soon.
     
    kalagaan likes this.
  36. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you :)
    The thickness approximation could be very cool, I'll think about it :p
    I'll improve the procedural shader, the next step will be a transparent pass to avoid aliasing.
    I will also add some different kind of drawing algorithm for the strand :)

    I have a lot of ideas to experiment!
    I'll also work on tools for baking strands into textures, it would be faster for LOD versions of the haircuts or mobiles.
     
    neoshaman and wetcircuit like this.
  37. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Procedural texture strand, is definitely a great addition, especially if does layered variation!
     
  38. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Much better with a transparent pass :D

     
    neoshaman and wetcircuit like this.
  39. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I'm working on the procedural shader V2
    more parameters, alpha pass, better lighting...

    neoshaman, you'll love this one :D

     
    Last edited: Jan 12, 2017
    neoshaman likes this.
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    In your first post you have an animated gif of the beard guy showing how the hair and beard move when the head turns. But one thing I'm concerned about is how much control over this behavior do we have? For example, generally a beard like that isn't really going to move at all when the head is turned. But even if I did want it to move, it should quickly settle almost instantly instead of jiggling for a couple of seconds. So, are these parameters that can be set? And can they be set separately for the hair versus the beard? Or even turned off completely for a section of hair?
     
  41. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    This start to look really solid :D , I haven't properly test it yet though, I need to make some time for it.
     
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The animation is done with motion zones.
    A motion zone is a sphere with some motion detection parameters : radius, damping, bouncing and limit.
    Each hair in the range of the motion zone will move according to these parameters.
    you can add many motion zones (up to 50) on each layer, so you can create really complex animations.
    The motion zones can be attached to a bone, so it react with the character animation. :)

    There's a demo with one motion zone in this video (2:50)


    The long hair layer has a curve animation system, and you can mix it with motion zones. ;)
     
    Last edited: Jan 12, 2017
    magique likes this.
  43. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here a sample


    and the settings :

     
    neoshaman and magique like this.
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Awesome. Just what I was hoping for. Looks great.
     
  45. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you ;)
     
  46. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I'm working on thickness :)

     
    Crossway, wetcircuit, punk and 2 others like this.
  47. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Aside from the background transition (might need to be clip into a range) it looks very natural!
    I guess you are comparing the hair sample vs the depth buffer like for deep water shading ...
    If this was inspired by what I said, it's an absolutely amazing misunderstanding lol I was refering to thickness relative to light but that goes too, I hadn't thought of that!

    I'm referring to the hair technique explain between 11:30 and 46:10, thickness at 21:30
     
  48. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I've just worked on the alpha pass :p
    I've added 2 thickness parameters for the hair root and tip.

    Here a sample with some lights
     
    neoshaman likes this.
  49. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
     
    punk and neoshaman like this.
  50. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Is it remotely possible for the hair (well, fur in this case) to use the color of the underlying texture? So the character can have a multicolored coat and the fur shoes that?