Search Unity

HairStudio - beautiful hair, now in Unity !

Discussion in 'Assets and Asset Store' started by methusalah999, Apr 2, 2020.

  1. unity_1iNKoEbR39MurQ

    unity_1iNKoEbR39MurQ

    Joined:
    Nov 24, 2018
    Posts:
    7
    Seré honesto, soy más un artista que un programador. lo que veo en su demostración es esto: "ScalpCollider" que contiene el colisionador de malla y en la ventana de malla dice que falta (malla). Sé que el activo no es el problema, el problema soy yo jaja. Pero primero gracias por la pronta respuesta y segundo, si me pueden dar más detalles sobre cómo hacer el scalpcollider, sería genial. Es que parece simple pero no puedo pintar. Entonces si puedo peinarme y demás. Por otro lado, en la demostración, cuando presionas play, se vuelve muy pesado. será mi pc? tengo 24 gb de ram con núcleo tm i7 cpu 3.06 ghz
    Tarjeta de video geforce GTS 450 Creo que puede ser la tarjeta ya que es muy antigua, ¿verdad?
     
  2. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    Indeed, HairStudio relies entierly on the GPU and with a GTS450, you will have to reduce the density of the hair to work smoothly.

    To create a mesh collider, just create an empty game object at the root of your scene, add the MeshCollider component to it, and set the mesh of your character in it.

    In most situations, you can place your t-posed character on your scene and the mesh collider using the same t-posed mesh at the same position/rotation, so that it coincide.

    It the mesh collider does not coincide for some reason, like your character not being t-posed for example, you will have to move/rotate the mesh collider so that the head of the mesh collider coincide with the head of your character.

    Once the mesh collider head is aligned with the character's head, go in the HairDressing component, open the roots tab, and set it in the "scalp collider" field. Now, the root painting brush will have a surface to paint roots on. Remember, the mesh collider is only a hit surface used by the brush to paint roots on the head. It is independent of actual hair, can be placed anywhere in the scene, and can be deactivated or removed once the roots are painted.
     
  3. unity_1iNKoEbR39MurQ

    unity_1iNKoEbR39MurQ

    Joined:
    Nov 24, 2018
    Posts:
    7
    Perfect it worked a thousand thanks !!!!! and really your asset is great! Congratulations!! Your work and dedication is very valuable, the artists know that ... haha I need it to make 3d film and try to record on video with the unity recorder tool and the animation looks perfect on the video !! that's all I need!! Keep it up!!
     
    methusalah999 likes this.
  4. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    If you like HairStudio, don't forget to write a short review about it on the store, it's very helpful !
     
    unity_1iNKoEbR39MurQ likes this.
  5. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    197
    Hi,
    Just a small thing but I notice in the Store that Unity2019.4 is mentioned.
    I noticed that in the Demo you are using 2019.3.
    Is the earlier version compatible?
    Thanks.
     
  6. unity_1iNKoEbR39MurQ

    unity_1iNKoEbR39MurQ

    Joined:
    Nov 24, 2018
    Posts:
    7
    Hello me again! I have a problem that you surely know how to solve, I will upload the image. Everything works perfect, but when the character walks and moves his head, his mesh is still in the T position, so the colliders and the mesh are out of phase, how can I solve this? Thank you Captura-ma.PNG
     
  7. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    HairStudio officially supports 2019.4 and above. It may work with other version from 2018.3 but it is not guaranteed.
     
  8. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    The mesh collider has nothing to do with it and it should be deactivated in play mode. If your hair does not follow your scalp, it is most likely because the hair object is not a child of the model bone.
     
    unity_1iNKoEbR39MurQ likes this.
  9. unity_1iNKoEbR39MurQ

    unity_1iNKoEbR39MurQ

    Joined:
    Nov 24, 2018
    Posts:
    7
    Perfecto si era eso! no estaba siguiendo al hueso de la cabeza, Disculpa la molestia, son cosas básicas que ya debería yo saber...Gracias por tu tiempo por responder!!
     
    methusalah999 likes this.
  10. dyrwoolf

    dyrwoolf

    Joined:
    Oct 9, 2010
    Posts:
    16
    I have two questions.
    1 Would this work for creation of long beards like a santa claus type of beard.
    2 How far away are You from releasing this a finished product?
     
  11. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    197
    Is there any guarantee of a refund if it doesn't work? A hell of a lot of VR folk are still using 2018 and earlier versions of 2019! Is it possible to give an accurate answer?
     
  12. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    1 It can work for a beard indeed but please note that mesh deformation are not supported yet. If you character open the mouth, or uses a blendshape to smile, the root of the hair won't move accordingly.

    2 HairStudio is already released as a finished product and is not in early access phase anymore ( still need to change the visual on the store...). It is stable and production ready. That said, I still plan updates, of course.
     
  13. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    My answer can't be more accurate than what is stated in the description: HairStudio officially support 2019.4 and above, and HDRP 8 and above.

    It is known to work with earlier 2019 versions, depending on how you use it, but if you want to try it and it doesn't work for you, I won't be able to provide a refund I'm afraid.
     
  14. dyrwoolf

    dyrwoolf

    Joined:
    Oct 9, 2010
    Posts:
    16
    Does this mean that You are planning to update this, and if so do You have any time road for when this could happen?
     
  15. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    This is something I would like to implement. I already have the required technology from another asset. But I don't know when I will have the time to work on HairStudio, and it may not come before fall.
     
  16. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    197
    Many thanks for the prompt answers, and I'll say goodbye to your future asset. Pity Unity versions are so incompatible to work with ....for some developers? I just hope for all your work that you finally nail down a version without all these delays.
     
  17. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    609
    I'm assuming this works for built-in render pipeline? Just flagging that my gut instinct was saying this is a HDRP product (maybe because I see HDRP 8+ on the asset page, maybe because this just looks like it should be ;)), and for this price tag, not being sure about BiRP means I'm steered away from it. I'd add a line about BiRP under compatibility just for clarity's sake.

    Also: Would this work with UMA? Meaning, if I create presets of hair, those should be swappable based on what a player chooses, right?
     
  18. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    HairStudio is compatible with both Built-in and HDRP 8+. Only URP is not supported yet.

    HairStudio works with UMA without issue, and you can indeed switch between multiple hair styles just by enable/disable them. Keep in mind that the initialization of the hair can take some time. You can either load all hair styles at the game start, but that can be long if you have a big collection of available hair styles (and occupy the GPU memory), or load each hair style when it is first enabled, which will cause a certain freeze.
     
    DGordon likes this.
  19. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    609
    What kind of freeze? Do you mean the entire thread locks? For how long? Or do you mean the hair wont load for an amount of time, which is what on average?
     
  20. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    If you load the hair in the middle of the game you can get a one or two seconds freeze, depending on the hair style, the hardware, the density of hair... You may be able to place this code in a coroutine but it won't be trivial because it is already divided in jobs.
     
  21. ZeN12

    ZeN12

    Joined:
    Mar 5, 2013
    Posts:
    10
    Hello HairStudio!

    BTW, your asset is awesome!

    We consider to use it in one of our games.
    There are few questions:
    1. Does your asset supports runtime 'Sculpting' of hair?
    2. Do you have any performance benchmark for mobile device?

    Thanks in advance,
    Andrei
     
  22. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    Hello and thank you for your interest. No, HairStudio does not provide any tool to change the hair style at runtime. Some have already changed the code to allow cutting on their own, but it's not a built-in feature.

    About mobile device, I have never made any video of the result that you can achieve and it depend a lot on the time budget you allow to it. you should be able to run 5/7k thousands of long hair strands smoothly if the rest of your game goes easy with the GPU, 2/4k otherwise. As a comparison, the hair usually shown in the commercial video are 30/40k.
     
    ZeN12 likes this.
  23. ZeN12

    ZeN12

    Joined:
    Mar 5, 2013
    Posts:
    10
    Thanks for the fast reply.
     
  24. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    166
    I have this error "MissingReferenceException: The object of type 'SphereCollider' 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."

    "HairStudio.ColliderDTO..ctor (HairStudio.ColliderInfo ci) (at Assets/HairStudio/Scripts/DTO/ColliderDTO.cs:13)
    HairStudio.HairSimulation+<>c.<PhysicPass>b__72_0 (HairStudio.ColliderInfo ci) (at Assets/HairStudio/Scripts/HairSimulation.cs:275)
    System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    HairStudio.HairSimulation.PhysicPass () (at Assets/HairStudio/Scripts/HairSimulation.cs:275)
    HairStudio.HairSimulation.LateUpdate () (at Assets/HairStudio/Scripts/HairSimulation.cs:202)"


    When I using hairstudio with other asset, it only happen when both plugin using in same character.
    My hairstudio version should be 1.4.
     
  25. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    I think this happens because a sphere collider that is currently in collision with the hair is destroyed before the OnTriggerExit is called (or OnTriggerExit is never called in this situation). Destroying a collider when it is colliding may not be a best practice, but HairStudio should be able to handle that. To solve the issue, I propose this simple fix. Go in Hairsimulation.cs and change the following line by the other one. Note that there are two occurences of this line, one in the LateUpdate method, and one in the PhysicPass method:

    Code (CSharp):
    1. // replace this line by the following one
    2. //colliderBuffer.SetData(colliderInfos.Values.Select(ci => new ColliderDTO(ci)).ToList());
    3.  
    4. colliderBuffer.SetData(colliderInfos.Values.Where(ci => ci.collider != null).Select(ci => new ColliderDTO(ci)).ToList());
    So the code just ignore collisions with null collider. This may cause a problem if this happen too much and the HairSimulation accumulate these ghost collisions over time. In this case, you will probably need to also clean the list but this would be an abnormal situation.
     
  26. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    166
    I Saw you said before "things have changed and you don't need to specify colliders. Hair will collide with any sphere collider in the scene according to the collision layer matrix as normal."
    Maybe the other asset use some temporary sphere colliders to do some work, and delete it later, and hairstudio just scan all sphere collider before and remember it, so the thing get wrong?!
     
  27. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    HairStudio create its own, invisible sphere collider around the hair, which is a trigger. It only check collisions with spheres that are entering this trigger collider. If a sphere enter, the OnTriggerEnter method is called and HairStudio starts checking collision with this sphere. If this sphere is destroyed, then I guess that OnTriggerExit is either never called, or called the next frame or later during the frame. Anyway HairStudio tries to check collision against a sphere that does not exist anymore and that is causing the bug. Ignoring the null colliders as I proposed earlier should do the trick.
     
  28. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    166

    It Work! Thank for quick respond.
    HairStudio work great!:)

     
  29. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    166
    After Play around Hair Studio, Some feature I would like to add.

    1. Paint hair guide Stiffness. It is the only way you can make a lot of hair style.
    Paint0.jpg Paint1.jpg

    2. Pull the hair together.
    pull together.jpg

    3. Flat combing brush.
    pull flat00.jpg pull flat01.jpg

    4. Export or Import the hair Guide, so you can control about it, sometime you may want to use you own physic to control the hair, also you can use the hair guide to rebuild the hair style outside unity.


    The ref is come from Virt-A-Mate, it is a creation tool with Adult theme, like DAZ, it have the most powerful real time hair tool, real time hair simulation. it is also using unity 3D, but it is using it own in house hair tools. I hope one day hair studio can as power as Virt-A-Mate.
     
    Last edited: May 10, 2021
  30. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    If you wish to have a ponytail with a different stiffness that the rest of the hair, you can use a secondary hairstyle that starts after the tie.

    Pull the hair together may be a, interesting tool to tie the hair together indeed, but it may also lead to a very artificial result. Most artists I've seen are patiently combing the hair instead, to get a more natural flow.

    Flat combing could be implemented easily, by preventing the tool strength to decrease with distance to the center. I will keep that in mind.

    Import/export is a tough subject, because there is no standard in the industry for that. Anyway, I would only implement an importer and no exporter at all, because HairStudio can't be compared to a grooming tool from the industry, and would not produce a useful result for another software. The typical pipeline would be to groom the hair on blender, Maya or else, then import it to HairStudio for real-time animation, not the other way around.

    VaM has an interesting hair tool. As far as I know it is made using the deprecated asset HairTool, with custom tooling system suitable for VR and their own rendering. I also suppose they have enhanced the system since HairTool has been deprecated. Their grooming tools may be interesting, but I personally think that the rendering and performance of HairStudio are already better than this system.

    Thank you very much for the advice and suggestions!
     
  31. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    166
    Paint hair guide Stiffness not only for ponytail, why people use hair cream? because We need the hair have different stiffness to make it styled. Every hair have same stiffness can't make good style.
     
  32. pauldrummond

    pauldrummond

    Joined:
    Oct 30, 2014
    Posts:
    127
    An option for mesh deformation would be very useful.
     
    methusalah999 likes this.
  33. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    Hello. When loading a new scene I get the following error:
    Also the scene camera doesn't start.

    MissingReferenceException: The object of type 'HairRenderer' 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.
    HairStudio.HairRenderer.SetLevelOfDetail (UnityEngine.Camera cam) (at Assets/HairStudio/Scripts/HairRenderer.cs:201)
    HairStudio.HairRenderer.RenderPipelineManager_beginCameraRendering (UnityEngine.Rendering.ScriptableRenderContext src, UnityEngine.Camera cam) (at Assets/HairStudio/Scripts/HairRenderer.cs:82)
    UnityEngine.Rendering.RenderPipelineManager.BeginCameraRendering (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at <bad59441812943c7b8d5a5ba85795810>:0)
    UnityEngine.Rendering.RenderPipeline.BeginCameraRendering (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at <bad59441812943c7b8d5a5ba85795810>:0)
    UnityEngine.Rendering.HighDefinition.HDRenderPipeline.TryCull (UnityEngine.Camera camera, UnityEngine.Rendering.HighDefinition.HDCamera hdCamera, UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Rendering.HighDefinition.SkyManager skyManager, UnityEngine.Rendering.ScriptableCullingParameters cullingParams, UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset hdrp, UnityEngine.Rendering.HighDefinition.HDRenderPipeline+HDCullingResults& cullingResults) (at Library/PackageCache/com.unity.render-pipelines.high-definition@8.3.1/Runtime/RenderPipeline/HDRenderPipeline.cs:2821)
    UnityEngine.Rendering.HighDefinition.HDRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Camera[] cameras) (at Library/PackageCache/com.unity.render-pipelines.high-definition@8.3.1/Runtime/RenderPipeline/HDRenderPipeline.cs:1391)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera[] cameras) (at <bad59441812943c7b8d5a5ba85795810>:0)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <bad59441812943c7b8d5a5ba85795810>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  34. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    Sorry for the inconvenience. The situation here is that the HairRenderer component is destroyed, but its OnDisabled method has not been called and some events are still plugged in.

    I don't know why you want to destroy the HairRenderer at run time and it is not a good idea in most situations. Can you give details about it?

    I also don't know why the OnDisabled method is not called in your case upon destruction. It may only be one frame late, though.

    Here is a quick fix that may help. Go into the HairRenderer.cs file, locate the OnDestroy method at the very end of the file, and add the following lines inside like this:
    Code (CSharp):
    1.         private void OnDestroy() {
    2.             segmentDefBuffer?.Release();
    3. #if UNITY_2019_1_OR_NEWER
    4.             RenderPipelineManager.beginCameraRendering -= RenderPipelineManager_beginCameraRendering;
    5. #endif
    6.             Camera.onPreCull -= Camera_onPreCull;
    7.         }
    If that does not help, please give me more context ^^
     
  35. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    The error is gone.
    The context is:
    There is no manual hair object disable/destroy.

    Scene 1 changes to Scene 2. Change occurs, which by default destroys all previous Scene 1 items.

    Scene 2 loads, but the FPS are 50 instead of 100fps.

    If I load Scene 2 directly, without loading Scene 1 first - the FPS is 100.
    When transitioning from Scene 1 to Scene 2 - Scene 2 has half the FPS.

    If I disable the hair, there is no change in FPS when Scene 1 transitions to Scene 2.
     
    methusalah999 likes this.
  36. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    I'm sorry, I didn't say that correctly.
    I meant to say that the error is gone, but now I experience a FPS drop.
    Adding the segmentDefBuffer?.Release(); didn't fix the issue of FPS when changing from Scene 1 to Scene 2

    I just found out that when I created a new hair for Scene 2, the FPS drop is fixed.
    If I use the same character with the same hair from Scene 1 and transition to Scene 2 - the FPS drop.
     
    Last edited: Jun 2, 2021
  37. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    Hard to say why, but I guess that the hair is created twice somehow if you keep the character. I've never tested to load scene additively this way but I think the issue is situated in the cleanup not being called in HairSimulation, or the hair being duplicated in HairDressing. You should add some debug code to see if you are correctly calling the cleanup methods that are located in OnDestroy method
     
    Last edited: Jun 3, 2021
  38. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    I'm really not that great at coding at all. Could you help me out with a way to clean everything up on Disable / Destroy for HairSimulation and HairDressing ?
    I've spent two nights trying to figure this out, but I can't put my finger on the exact cause.
    Now even generating brand new hair in Scene 2 causes a FPS drop (?!)

    If this can help, one more thing I noticed is that when I removed all colliders, the hair behaved like they were still there, which could be a HairDressing cleanup issue.

    Thank you for your time.
     
  39. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    HairDressing does not need any cleanup. It create the hair during Awake and stores the result in HairSimulation.

    HairSimulation and HairRenderer are both cleaned in their OnDestroy method, as normal. The FPS not getting high, and the ghost colliders are both signs that the hair it is still present in your scene somehow, either because you are not actually destroying it, or because you creates it twice.

    As I told in my previous message, you need to ensure that OnDestroy methods are correctly called during your scene additive loading, and that HairDressing awake is not called twice. There is not much I can do for you if you don't try the things I suggest.

    About the ghost collider, it may be because of a limitation in Unity. HairStudio relies on the OnTriggerEnter/Exit methods, and the Exit is not called when you destroy a collider that has already entered (which is a shame). So destroying a collider while it is already in range will create a ghost collider.
     
  40. DeltaTech

    DeltaTech

    Joined:
    Oct 18, 2016
    Posts:
    11
    Hey man random question is this asset still receiving updates? It has been close to 9 months that this hasnt been updated on the store, just wanted to check in on that.
     
  41. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    I hope to release a new version of the asset this fall. There are a lot of features that I would like to work on, but the sales are not enough to allow me to spend much time on it.
     
  42. Eltayeb

    Eltayeb

    Joined:
    Jan 24, 2014
    Posts:
    20
    Hello there,

    I tried to run this in VR using oculus quest 2 but of course it's so heavy, so any idea how to make it work smoothly? If there's anything i can change in the shader or something.

    Regards
     
  43. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    I made a lot of tests to make it run on a Quest 2, and it runs, but the GPU is clearly not powerful enough to get a decent result. You can at least make a static hair with low density and thick strands, but there is not much point in doing this.
     
  44. Eltayeb

    Eltayeb

    Joined:
    Jan 24, 2014
    Posts:
    20
    yea it did run, but very slow, does your the plugin support your suggestion of static hair ?
     
  45. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    Indeed you only have to push the global stiffness sliders to the max and all physics computations will be avoided.
     
  46. passeridaepc

    passeridaepc

    Joined:
    Jun 16, 2019
    Posts:
    284
    Are you planning to update hdrp to the marschner rendering? It's being worked on on Unity's side and they're planning to add it soon. Also how's your cloth simulation asset going?
     
  47. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
    There is currently no way on doing a Marschner rendering in HDRP for the moment as far as I know, which is a shame if you want my opinion. HairStudio is still more beautiful in the built-in pipeline and it is very frustrating. Though if you have information that I missed about HDRP Hair node or HDRP ligthing model in general I would gladly hear about it.

    About MarvellousCloth, I only use it on my own game and distribute it in a private way, and I beleive it won't be sold on the AssetStore any time soon. You can contact me directly to ben.oeilnoir@gmail.com and tell me more about your project if you are interested in it.
     
  48. passeridaepc

    passeridaepc

    Joined:
    Jun 16, 2019
    Posts:
    284
  49. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    581
  50. unity_1iNKoEbR39MurQ

    unity_1iNKoEbR39MurQ

    Joined:
    Nov 24, 2018
    Posts:
    7
    I correct the above message. use 2020.2.7 in hd. In case the flickering hair shadow cannot be fixed, can the shadow be removed somehow? Thanks
     
unityunity