Search Unity

Hair Designer - Dynamic hair & fur tool

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

  1. Rotock

    Rotock

    Joined:
    Jun 29, 2014
    Posts:
    18
    The Disigner seems to save something temporare behind. Then i remove the Hair Designer Script and go in playmode, its reattaching itself ! If i remove it again. it not reattaching, but the Serialization and Nullpointer errors OnEnable still are present. i only get completely rid of the errors then i restart my entire project and no Hair Designer the Scene.
     
  2. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can try to add the component again and remove it.
    I'm sorry that you have all these problems, I'll check what's going on with this version of unity...
     
  3. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, I'll probably need your help :p
     
  4. Rotock

    Rotock

    Joined:
    Jun 29, 2014
    Posts:
    18
    Sorry that i not correctly react to the realy fast replies of yours.

    The next day(s) i test additionaly :

    A other simpler Character Model, with only one Material on the same Mesh.
    (Have the feeling the Seralization errors come from, that the Designer script has problems with more then 1 material. By me only the 7. of 9 Material slots i have selected. And be confused, why the script need to know the Material, then it works with the skinned Mesh Model)

    The same model in a new Project. (Maybe Unity has broken something.......again....)

    For the Null Pointer Erros, i have no clue.
    To bad i can't simply double click the error und see what has the nullpointer.

    The model has 27k Tries , i can spawn 2 or 3 of them without slowdown. (without the Hair Designer)
    But the Idea of duplicate the Mesh with the Weight's in Blender, make the duplicate low poly and reimport this.
    And in unity disable the skinned renderer of the lowpoly duplicated Mesh.

    My clock ticks 1:22 AM here in Germany. Thanks for the fast replies again. ZZZzzzzz
     
  5. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can choose the submaterial where the fur is applied, in the fur demo 2, the character has a specific material for the eyes, so it can be removed from the fur with the checkbox.

    If you disable the lowpoly character, it will break the animation, you have to remove the material (empty list) and it won't be renderer, but the fur will be animated. :)

    I think that I found the bug for the serialization error!
    I'll fix it tomorrow ;)
     
  6. Rotock

    Rotock

    Joined:
    Jun 29, 2014
    Posts:
    18
    So I have made a duplicate from the Mesh, made it low poly and fight for it, to preserve its UV textures coords and weights.
    1. On the low poly, the morphs cannot be exported.
    2. The reimport into Unity of the fbx, has borke the geometry and some bone weights.
    3. The Prefabs are complitly awkward deformed and so on.

    I think, import and export of the model, in a model software, makes problems, too

    So to make a low poly base, for the shell, is not a way to go. Unless there is a easier method, maybe in unity itself.

    EDIT 1:
    So testet it with the same Model. Today, Hair Disigner keep more quiet with its errors.

    Only:
    MissingReferenceException: The object of type 'HairDesigner' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Component.GetComponentsInChildren[HairDesignerMeshInstanceBase] (Boolean includeInactive) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ComponentBindings.gen.cs:99)
    UnityEngine.Component.GetComponentsInChildren[HairDesignerMeshInstanceBase] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ComponentBindings.gen.cs:109)
    Kalagaan.HairDesignerExtension.HairDesignerEditor.OnDestroy ()

    So, set the Casting Mode: OFF and Shell count: 20, but the Porformance slowdown is again to great.

    A Question: Does Shell count 20 means that it makes 20 copys of the Mesh, to stack dot's, to form Hair ?
     
    Last edited: Mar 27, 2018
  7. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The fur won't work on a 27k model, this is the limit of the shell technic :(
    If you can spawn only 2 or 3 models in the scene without fur, you won't be able to spawn 20 shells (27k tri) of fur, even with the GPU instancing enabled.
    You need to balance between performance and graphics, in your case you have to reduce the polycount of your character.

    I did a test on a 34k tri character (DAZ), and I've reduced it to 3399 tris
    - Open the fbx in blender
    - Duplicate the mesh
    - Apply the Decimate modifier before the armature
    with ratio = .1 , triangulate & symetry
    - Export to fbx (Armat & mesh selected)
    forward : -Y Forward
    up : Z Up
    - Import in unity
    - Apply the hair designer component on the low poly
    - Disable the Skinnedmesh renderer
    - Add the fur layer.

    Now I can instantiate 18 characters ( more than 100FPS ) :)



    If you need help, send me your character (contact@kalagaan.com), and I'll have a look to it. ;)

    I'm working on the serializations error, it will be fixed soon.
     
    Last edited: Mar 27, 2018
    Malbers likes this.
  8. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    The version 1.5.6 has been submitted to the asset store, it fixes the errors of 1.5.5. :)

    The version should be available next week on the assetstore, so if anyone needs the update,
    please send me an email (contact@kalagaan.com) with the invoice number and the version of unity. ;)
     
    Last edited: Mar 31, 2018
  9. r3ndesigner

    r3ndesigner

    Joined:
    Mar 21, 2013
    Posts:
    143
    are you still working in the braids system?
     
  10. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, it's still WIP, I had to work on other projects so the developpement is not as fast as I want :confused:
    It's a generic way to import custom mesh.
    The idea is that you could add your own model to the strand library.
     
    wetcircuit and r3ndesigner like this.
  11. and54

    and54

    Joined:
    Jun 16, 2017
    Posts:
    1
    can the hair been modified in runtime? like cut hair or change color in the player
     
  12. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, you can modify some parameters at runtime, like hair color (root & tip), length, specular color, emission, translucency...

     
    tapawafo and MrG like this.
  13. Josh_He

    Josh_He

    Joined:
    Nov 19, 2013
    Posts:
    14
    Hi is this asset compatible with Unity 2018 and the new scriptable rendering pipeline?
     
  14. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Not yet, I'll work on a hair shader with Amplify Shader Editor.
    ASE is compatible with LW SRP, and should be compatible with HD SRP later.
     
    Malbers likes this.
  15. Kripll

    Kripll

    Joined:
    Jan 20, 2017
    Posts:
    7
    Hai.Runtime API not working in build scene,but in editor work.
    What is the problem?

    its my code:
    for (int i = 0; i < hair.m_generators.Count; ++i)
    {
    HairDesignerShaderAtlas shader = hair.GetLayer(i).GetShaderParams() as HairDesignerShaderAtlas;
    shader.m_rootColor = RootColor;
    shader.m_tipColor = TipColor;
    shader.m_smoothness = Smoothness;
    }
     
  16. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Thank you for your feedback,
    you have to add this line :

    Code (CSharp):
    1. for (int i = 0; i < hair.m_generators.Count; ++i)
    2.         {
    3.             HairDesignerShaderAtlas shader = hair.GetLayer(i).GetShaderParams() as HairDesignerShaderAtlas;
    4.             shader.m_rootColor = RootColor;
    5.             shader.m_tipColor = TipColor;
    6.             shader.m_smoothness = Smoothness;
    7.             hair.m_generators[i].m_shaderNeedUpdate = true;
    8.         }
    Sorry, I have to add this in the documentation :confused:
    I have added this behavior to avoid unecessary update when shader is unchanged.
     
    Last edited: Apr 24, 2018
    Kripll likes this.
  17. Kripll

    Kripll

    Joined:
    Jan 20, 2017
    Posts:
    7
    Hey.
    You can learn how to optimize long hair?
    Unity 2017.2.0p4 show too small fps for VR.
    upload_2018-4-25_10-3-18.png
    I initially thought it was a problem in the model, but when I turn off the hair, then the FPS increases.
    upload_2018-4-25_10-3-43.png upload_2018-4-25_10-6-0.png

    Is there a way to optimize? And how can this be best done?
     
  18. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    You can reduce the polycount (subdivision X ans subdivision Y)
    subdivision Y will also reduce the number of bones generated for the strand and will optimize the CPU side.
    For the strands that don't need to move, you can uncheck 'Dynamic' in the strand parameters.
     
  19. Kripll

    Kripll

    Joined:
    Jan 20, 2017
    Posts:
    7
    Hello.Because of this error, I can not build a project under windows. Unity 2017.2.0p4
    upload_2018-4-26_11-39-44.png
    What is the problem?
     

    Attached Files:

    Last edited: Apr 26, 2018
  20. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    looks like unity has changed some compilation settings, you can fix it :
    - Edit "HairDesigner/Shaders/HairDesigner_FurShell.shader"
    - Change "target 3.0" to "target 3.5" (line 41)
    Code (CSharp):
    1. #pragma target 3.5
    I'll push this fix in the next version.
     
    Kripll likes this.
  21. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hello has anyone tested that this work with Morph3d characters?
     
  22. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
  23. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    Was any progress made on this integration? I want to buy this on sale if it works with UMA.
     
  24. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Sorry but it still don't work with UMA, I have to work on a way to deploy the hair system (mesh & scripts) based on templates.
    I had to delay some work on HairDesigner, I'll try to do it as soon as I could. :confused:
     
  25. SeekingFaith

    SeekingFaith

    Joined:
    Apr 22, 2018
    Posts:
    6
    Does this support female type long/straight hair?

    Thanks
     
  26. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Yes, here some demos :
    Demo1 Demo2
     
    hopeful and wetcircuit like this.
  27. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    I just bought this asset some time ago and I am impressed with the possibilities! :D

    However, one thing I don't think that has been explained is how the generated maps work themselves.

    I am going to us Substance Designer to allow for procedural texture generation so the fur groom, hair and style is different depending on the parameters in Substance Designer and Unity.

    Could you perhaps explain how Hair Designer generates these maps than just painting?
    I opened up some tests I made and it all seems to have weird and mixed up pixels that doesn't seem to conform to my UV's.

    I looked through the documentation and it just shows you how to paint, but there are no explanations as to how the maps are actually generated.

    Thank you for reading, I would appreciate it if you could explain how the maps are made with painting.
     
  28. Xoduz

    Xoduz

    Joined:
    Apr 6, 2013
    Posts:
    135
    Out of curiosity, why does the fur layer work with blendshapes, but not the short/long hair layers? Is these layers not working with blendshapes a hard limitation, or is it something that can be supported at some later stage in development?
     
  29. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Fur is a shader, it takes the vertex data as input, so any modification to them is also happening in the fur shader. The other hair is its own mesh, so it's not correlated to the mesh with blendshape.
     
    Xoduz likes this.
  30. cpberi

    cpberi

    Joined:
    Jul 30, 2012
    Posts:
    12
    Hello. Do you have any future plan for Mobile support? I understand the mobile devices lack powers, but at some point, it seems like you could make a cutoff on some of the higher end mobile devices likes of metal iOS and high end galaxy phones
     
  31. Dorumeka

    Dorumeka

    Joined:
    Aug 19, 2017
    Posts:
    18
    Has anyone seen if it's possible to use Toony Colors Pro 2 with this tool? I really don't know much about shaders, so I don't know if adding the modifications stated in the documentation will break the TCP2 shaders.
     
  32. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Here the description of the texture for the fur shader :

    - Main : diffuse color based on UV

    - Density : density texture based on UV

    - Mask : rgb used to be the brush data, but now only the alpha channel is used for fur height. I'll use rgb channel later for new features. It's based on UV

    - Color Texture : additionnal color that can be painted on the model.
    rgb -> color
    a -> 0: override main texture 1: mix with main texture

    - Brush Texture : this texture is not based on UV, this is a per vertex data texture, so a mesh can be brush even if UV's are mirrored, so each pixel define one vertex.
    rgb : fur direction in tangent space
    a : height of the mesh
    The height in the brush texture defom the final mesh, so all the shells will be used for shorter fur. I recommand to paint the height in the brush tool and then to finish with the mask.

    I hope that it will help you :)
    I'm working on a substance too, but I'm still a beginner with substance designer, it's an amazing tool.
     
  33. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    This is the perfect answer :)
    Thanks ;)
     
    neoshaman likes this.
  34. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I don't officially support mobile, because I can't test on many devices.
    You can use hair designer to create hair strands and use any shader on them, so it could be compatible with mobile.
    But the tool is not suitable to create low poly hair like an artist would do, so I don't recommand it on mobile.
    And the fur shader require a GPU compatible with GPU instancing.
     
  35. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I didn't test with Toony Colors, but the shader modification is only for motion support, it should not break anything.
    You can use the shader without modifications if you don't need wind or motion zone support.
    If you have any issue, please send me an email (contact@kalagaan.com)
     
  36. Dorumeka

    Dorumeka

    Joined:
    Aug 19, 2017
    Posts:
    18
    How long do you plan to support this asset? I'm coming from a bad experience with Hair Tool, which the dev abandoned and removed from the store, thus stopping support and putting in risk parts of my project.
     
  37. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I'm still working on my assets, and I don't plan to stop :p
    I'm working on another asset that will be released soon (I hope), and I'll continue to add new features to HairDesigner.
     
  38. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    I had the exact same problem as I had Hair Tool as Dorumeka mentioned and got burned badly just as I had started to work on the texture side of things and found Hair Tool pulled off the Asset Store.
    Sadly, I bought it and got a refund and the developer was a total ass about it all.

    As for me, I also worried you may stop development but your comment has made me an even more confident customer than before, thanks for raising my confidence in you :D

    For once, I am glad a fur and hair solution ACTUALLY works and doesn't close shop just as I begin researching it.
     
    kalagaan likes this.
  39. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    Do you think you could perhaps share a template made in Substance Designer to get something going with fur length, brush groom / direction, color, etc. to study it?
     
  40. amarillosebas

    amarillosebas

    Joined:
    Feb 28, 2013
    Posts:
    44
    Hey, what's up with this? My model shrinks and gets all messed up when I try to edit a layer.




    This is my bone hierarchy:


    I noted that there's something trying to enforce a T-Pose? When I deleted the root bone from the skinned mesh renderer I got this error:


    NullReferenceException: Object reference not set to an instance of an object
    Kalagaan.HairDesignerExtension.TPoseUtility.InitTPose (UnityEngine.SkinnedMeshRenderer smr)
    Kalagaan.HairDesignerExtension.TPoseUtility.ApplyTPose (UnityEngine.SkinnedMeshRenderer smr, Boolean unityMode)
    Kalagaan.HairDesignerExtension.HairDesignerEditor.CreateColliderAndTpose ()
    Kalagaan.HairDesignerExtension.HairGeneratorLongHairBaseEditor.OnInspectorGUI ()
    Kalagaan.HairDesignerExtension.HairDesignerEditor.OnInspectorGUI ()
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1253)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
  41. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Hair Designer set the model to its T-pose, because the generated mesh is based on the bone hierarchy of skinned mesh.
    Could you send me an email (contact@kalagaan.com) with your model?
    I could check what's going on ;)
     
  42. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I could try to do template with a simple noise for the density and the mask.
    But I don't think that the brush direction could be generated with a substance :confused: because it's not based on UVs.
     
  43. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    Could there possibly be a more predictable and interactive way to groom the direction?
    The process of guessing which set of vertices would be a nightmare for customization and unpredictable results lol

    I would think something like selection sets, getting normals or some way of making the process more customizable would be helpful.
     
  44. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I don't know how you vant to customize your characters, but you could use the brush tool for generating different brush textures, and switch between them. So you'll have different styles, and you could merge them.
    In the brush texture the direction is in tangent space :
    r -> projection on normal
    g -> projection on tangent
    b -> projection on cross(normal,tangent)

    If 'r' is set to 1, the fur is in the direction of the normal of the mesh.
    If you want to merge 2 textures you can use the r channel to lerp the result, this will avoid to loose half of the brush direction when one of the texture direction is the normal.
     
    Last edited: May 17, 2018
  45. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    I'm going to give my programmer this challenge in the future, thank you for the helpful advice! :D
     
    kalagaan likes this.
  46. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    With all of this in mind, would it be possible to update the maps without using the Brush and instead use Live Link in Substance alone?

    I've seen Allegorithmic's Tutorials on using Live Link to take your work from Substance to Unity and vise-versa in real time, would that be supported or are there any plans to support that?

    Edit:
    Screen Shot 05-18-18 at 02.06 AM.PNG
    I found a way to get Fur Direction using a World Normal Map and other settings in Substance Designer, but with more control and refinements, I could do this entirely without painting in Hair Designer at all :D
    This is primarily a sort of prototype or test, but I did nothing in Hair Designer, this was all from Substance Designer :D

    All I did was save the texture output from Substance Designer into the proper Maps in Hair Designer, tweaked some settings and there you go :)

    Would it be possible to request a way to update the maps in real-time without having to find a texture or perhaps Substance Designer or PBR workflow support?

    Thanks, this asset is awesome! :D
     
    Last edited: May 18, 2018
    wetcircuit and kalagaan like this.
  47. PenguStudios

    PenguStudios

    Joined:
    Mar 15, 2015
    Posts:
    6
    Hi!

    Thanks for a great asset!

    I don't know if you have replied this somewhere already, but do you have any plans on making Hair Designer work with HD Render Pipeline (Lit Shader)?

    Cheers!
     
  48. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    Nice result :)
    You can change the texture in real time with the API ;)
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Kalagaan.HairDesignerExtension; // use the namespace
    5. public class ChangeFurTexture : MonoBehaviour
    6. {
    7.     public HairDesigner m_hair; // this is the reference of the hairDesigner instance
    8.     public Texture2D m_texture;
    9.     public float m_furLength = .1f;
    10.  
    11.     void Start()
    12.     {
    13.         UpdateFurTexture();
    14.     }
    15.  
    16.     void UpdateFurTexture()
    17.     {
    18.         HairDesignerGenerator layer = m_hair.GetLayer(0); //get the layer by id or by name
    19.                                                          
    20.         //the shader parameters have to be casted into the shader class used by the layer      
    21.         //All the shader classes can be found in the folder "HairDesigner/scripts/"              
    22.         HairDesignerShaderFurShell shader = layer.GetShaderParams() as HairDesignerShaderFurShell;
    23.         //all the shader parameters can be modified      
    24.         shader.SetTexture(3, m_texture);//the texture id is defined in HairDesignerShaderFurShell.cs
    25.         shader.m_furLength = m_furLength;
    26.         //...  
    27.  
    28.         layer.m_needRefresh = true;
    29.        
    30.     }
    31. }
    32.  
    If the texture was made with substance, it should be updated when the sustance is modified.

    For better performances, you should use a low poly version of your character to apply the fur.
     
  49. kalagaan

    kalagaan

    Joined:
    May 27, 2012
    Posts:
    1,503
    I'll try to create a ASE version of the shaders that would work for Render pipelines.
    ASE is compatible with LW RP, and should be compatible with HD RP later.
     
  50. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    Hello,
    Thanks for your nice plugin, i have lost so much time trying to work with others on the asset store !

    it works perfectly for the shader generator, but i have this little problem trying to use the Strand shader on my character
    Screenshot at 2018-05-24 20 51 40.png
    The problem is directly related to unity's update but i have absolutely no idea why it can't compile them:

    shader.jpg