Search Unity

HairStudio - beautiful hair, now in Unity !

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

  1. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Hi and thank you for your purchase.

    This exact subject has been discussed in the previous messages on the forum. An object being ignored when outside of the camera field of view is called frustrum culling.

    In HairStudio, the frustrum culling is naively done by creating a 1 meter sized bounding box in the center of the hair game object. This causes the following know issues:
    - the hair game object is required to be at the approximate center of the hair volume
    - the one meter size is not sufficient for longer hair
    - the scale is not taken into account at all.

    I'm currently working to fix this. The bounding box will be place in the average position of the hair roots, its extent will take the maximum hair length into account, and the scale will be used correctly.

    The patch will not come soon, though, so I suggest that you move your hair object in the middle of your hair volume approximatly, as a temporary workaround. With a scale of 1, you should not have any issue in this configuration.

    Oh, and if you like HairStudio, please write a short review on the store, it helps a lot!
     
  2. Vegaplanet33

    Vegaplanet33

    Joined:
    Jan 26, 2019
    Posts:
    14
    Sure!
    Done!
     
    methusalah999 likes this.
  3. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92
    SmartSelect_20201209-215559_Video Player.gif

    thank you for this nice tool. I've been experimenting for a few days. the most fun was running on the phone.
    URP works fine except for shadow bugs. physics performance S20 (exynos) dropped from 120 fps to 30 fps. It's nice to be able to run on mobile at this quality.
     
    methusalah999 likes this.
  4. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    So you are working on URP? How did you do the rendering shader? I can send you some URP work in progress if you don't mind getting your hands dirty.
     
  5. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92
    All I do is edit the HDRP shader. I'm using the URP 11 version from github. but I think it will work on versions like urp 8. shadow disappears occasionally.

    upload_2020-12-10_0-36-52.png
     
  6. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Oh I see, you replaced the HDRP Hair master node by a fragment node. URP does not include a hair master node and I'm afraid that doing so, the light scattering on the hair fibers won't be great at all, but it can do the trick.

    Anyway I will release the complex light scattering of HairStudio for the URP in a few months.

    Thanks for sharing your solution!
     
  7. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    Hey! Great asset, but I am having some issues with it. When I have two actors next to each other, only one haircut is displayed. The same goes for multi-layer hair. It just shows up the first layer. When the camera zooms into just one of the object - the hair shows up. It doesnt render two at the same time.
    Using Unity 2019.4.10f1 (64-bit) HDRP 7.3.1
     
    Last edited: Dec 20, 2020
  8. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Can you please go into the showcase scene and take a look at the composition pedestal? Or any pedestal with multiple hair near to one another?

    If the showcase scene result is ok, my best guess is that you hair objects are not in the approximate center of the hair volume, which cause them to be frustrum culled. The bounding volume of the hair is a 1m box around the hair object.
     
  9. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    Here is a video I just made of the problem.
    Using Hair Studio 1.4.
    The HDRP Showcase is a mess (Image attached). It worked fine on Unity 2020, but unfortunately I cannot switch versions in the middle of my project.

    Sometimes, even if there is a single character with hair in the scene, the hair disappears under certain camera angles.
    The same happens in the Showcase.

     

    Attached Files:

  10. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Ok I missed the part where you say that you were working with HDRP 7. Unfortunately, as stated in the description, HairStudio is not compatible with HDRP before 8. It's a known bug of the HDRP (related to camera spacing) and I've spent much time trying to solve it, without success.
     
  11. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    Everything worked when I updated to HDRP 8.3.1
    There is just one thing left - I keep getting this error after I stop playing:

    GarbageCollector disposing of ComputeBuffer allocated in \Assets\HairStudio\Scripts\HairRenderer.cs at line 195. Please use ComputeBuffer.Release() or .Dispose() to manually release the buffer.
    UnityEngine.ComputeBuffer:Finalize()
     
  12. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Oh this one is probably on me. I will have a look, thanks for pointing me out.
     
  13. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    Thank you and looking forward to your reply how to fix it.
    Once again - a great asset and so far the only one that is useful on the asset store.
     
    methusalah999 likes this.
  14. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Sorry for the late answer. I haven't checked on the current version of the store, but you should be able to remove this message by adding a compyte buffer dispose in the OnDestroy method of the HairRenderer class like this:
    Code (CSharp):
    1. private void OnDestroy() {
    2.     segmentDefBuffer?.Release();
    3. }
    4.  
    This issue should be inoffensive anyway, even in a build.

    Oh, and if you like HairStudio, please write a short review on the store ! It helps a lot.

    Have fun !
     
  15. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14

    Worked like a charm.
    One last issue


    Could you let me know how to fix that ? It happens after a rapid change/teleportation of a character. The hair shadow seems stuck to the previous location.

    I didn't have this issue with the previous version of HDRP.

    Of course it will be a 5 star review. I love your work.
     
  16. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    If you maximize the global stiffness start and end, does the hair go back in place correctly? In the showcase, the pedestal #26 explains how to reset the hair simulation, to avoid hair being stretched during a teleportation.

    In your video, it seems to be another issue, though. Like some strands only being stuck at the previous position. Can you please try the hair reset first, and send me a simpler video if it does not solve the issue?

    What is the HDRP version you are using? Have you tried going back to the previous version and see if it works again?
     
  17. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi!
    I'm using HDRP 10.2.2 and Unity 2020.2. I've encountered some strange rendering issues. Hairs disappear when they are too close to the screen border (especially the left one, for some reason). They are best rendered when they are at the centre of the screen. I can't pinpoint the issue. This happens in your demo scene as well as in the Unity start scene where I've manually created some hair for testing. Every time I start a game I have to adjust the camera angle and/or distance to see the hair.



    Distance for max and min detail in the hair rendering script doesn't help with this issue. Shadows from hair are rendering correctly only in the editor tab when the game is in the play mode. In the play mode window, hair shadows either disappear or have very low quality despite any settings in the directional light or/and HDRP Volume. I'm also wondering if there's any manual on the script called "Hair Self Shadow Caster".
    Thanks!
     
    Last edited: Jan 3, 2021
  18. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    About the hair disappearing, I guess it is only a issue with frustrum culling. Frustrum culling uses the bounding volume of objects to determine if they are in the camera field of view and should be rendered or not. In HairStudio, the bounding volume is a one meter box centered on the object that contains the HairRenderer component. So you have to ensure that this object is located at the approximate center of the hair volume to obtain a correct culling.

    I have already identified this as a issue for many HairStudio users and I will change that in a future version, so the bounding volume is sized and placed automatically.

    If you have observed this issue in the demo scene, then it may be something else as all examples are correctly centered as far as I know. Could you make a video?

    The shadow issue is most likely a HDRP bug. Could you please test with HDRP 8? I haven't tested HairStudio for with the latest HDRP yet.

    Finally, the script HairSelfShadowCaster won't work in HDRP at all and is now deprecated. Currently there is no way of creating a decent self shadowing in HDRP, but things are changing fast and a future version may allow for a new self shadowing method.
     
  19. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    The demo scene somehow started to work correctly after some switching between it and the Unity demo scene.

    Shadows in your scene are fixed now as well. I guess they're somewhat broken in the Unity demo scene due to its specific setup. For example, disabling the "shadows" override in the volume component brings them back a bit. All in all, this start-up scene turned out to be not the best place to test HairStudio:)

    Thanks for your fast reply! I'll try to render the shadows with ray-traced screen-space shadows. Hope they'll work.
     
    methusalah999 likes this.
  20. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    Enable Update When Offscreen and that will fix the issue
     
  21. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    The HDRP Demo Scene works fine. The hair teleports well in it.
    After adding the Demo Teleport Script and testing it on my project, it does reset the hair, but that shadow stretch still exists. My HDRP is 8.3.1 (verified). I just upgraded to Version 9.0.0-preview.13 and the shadow is still there, but the hair shader broke (the hair looks like a mirror).
    Is there any workaround this shadow issue?

    Completely disabling shadows will be OK too for now
     
    Last edited: Jan 4, 2021
  22. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Sorry for the inconvenience. I have not been able to reproduce any shadow or shading bug so far. I just tested with both Unity 2020.1 with HDRP 8, and 2020.2 with HDRP 10 (verified versions) with same results.
    upload_2021-1-4_12-13-23.png

    I can't see any reason why the shadow would not follow the geometry except for a HDRP bug. The hair geometry is thin and easily culled so I suppose there may be invisible faces causing artifact shadows if something is buggy in HairStudio, but you said that the hair was correctly teleported.

    I would start tweaking the parameters of shadows, contact shadows and ambiant occlusion to check if these are changing something to the artifact. I would also try with the simplest hairstyle, with thick hair and draw the scene using wireframe to check if the geometry is correct, before and after teleport.

    I'm interested in any screenshot and/or video to help me understand what is going on in your setup!
     
  23. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    In your manual, there's this description of the "Width R" parameter: "The width of the reflection feature. Realistic is between 5 and 10 degrees."

    However, the maximum value in the material is 1. Is it expected?

    Angle reflection, on the other hand, can be set to the values described in the manual (from -5 to -10) which makes the setup a bit confusing.

    Update: it seems the manual is for the Built-In material only. Or can it be applied to the HDRP as well? I'm trying to create realistic black hair. Is your setup in the demo scene the most optimal?

    Thanks!
     
    Last edited: Jan 5, 2021
  24. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    And one more question:



    Here I have 3000 guides and 100 density multiplier. But it's obvious that all hairs are divided into groups or chunks. At first, I thought that they are divided on the per-guide basis. But I can't get above the current number of these groups no matter how many guides I generate. Is there a hardcoded limit? Because if there is, than there's no practical sense to go above certain guide and density values since a lot of individual hairs won't create an appearance of density as long as they are scattered in groups.
     
  25. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    The documentation for the shading features is indeed only usable for the built-in rendering which is a physically accurate Marschner model. HDRP rendering uses a simpler shading model named KajyaKay and it harder to determine realistic values for the shading angles and smoothness. The materials provided in the HDRP version are not as accurate as what you can do with the built-in shader.

    What you can do to get close is to have a built-in project to run your hair with the Marschner shader, with precise camera and light angles. Then, in your HDRP project, you can setup the camera and light in the same way and tweak your material to obtain comparable angles and smoothness for the primary and secondary réflexion. Getting an accurate transmittance will definitely be more complicated, though. For the color, you can use the hints provided in the doc (tweak the color saturation only).

    Remember that HairStudio accuracy is far from perfect what-so-ever due to its real-time nature, and the lighting features may vary from reality. Also, not that HDRP will make it possible to create the very specific shading HairStudio need in the future and HairStudio will be updated sometime after.

    Now about your hair dressing issue. You should not have that much guides. Here is some random information that may help you understand what's going on.
    - roots are placed on the surface of the scalp where the hair must be present
    - each root have a radius in which a hair strand has a chance to spawn
    - all roots should be painted with the same radius to get a homogeneous distribution of roots (and strands)
    - guides are NOT used to spawn the hair strand. Roots are.
    - the density of hair is a ratio of the roots number. a density of 2 and 3000 roots will give 6000 strands
    - each hair strand is spawned at a random position around a random root.
    - when a strand is spawned, it will look for the closest guide. If the guide is in interpolation mode, the strand will find the three closest interpolating guide
    - when the guide or three guides are found, the strand will grow by following the guide(s) shape.
    - the clumping effect will allow to create locks around guides, for example by bringing the tip of the strands closer to the guide than the root.

    Don't hesitate to go into the showcase scene to get inspiration from the existing hair style and how they are done. Also, if you have any specific question, just shoot !

    Oh, and if you appreciate HairStudio, please write a short review, it helps a lot !

    Ben
     
  26. drlh1976

    drlh1976

    Joined:
    Oct 6, 2017
    Posts:
    20
    A friend of mine told me anbout HairStudio and I am not quite familiar with it. I want to know whether hairStudio support HDRP with transparent(always known as OIT) and self shadow? Thank you!
     
    Last edited: Jan 8, 2021
  27. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    HairStudio HDRP does not rely on OIT method for translucency but on a triple Kajya-Kay including a transmittance feature. It's not as good as a the Marschner model or a real multiple scattering, but it provides a decent real-time approximation of the translucence in back lighted situations.

    Thin self shadows are not supported and the effect is approximated with a nuance feature, which add some variance in the color saturation to simulate the depth of the hair volume.

    Both these approximations make HairStudio more suited for dark hair than bright one.
     
  28. skanev

    skanev

    Joined:
    Oct 15, 2018
    Posts:
    14
    I just found out what the issues is. I am using two hair generators on the same head. When I disable one of them, there is no bug.
     
    methusalah999 likes this.
  29. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Thanks for your feedback, I will make sur that only one instance of the components is present on the game object to avoid this situation in the next version.
     
  30. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    Does it work with blend shapes? Can I paint beard and then use blend shape to open mouth?
     
  31. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Blendshapes and other skin deformation are not yet supported. This feature is in the road map and should land in a future version (not before fall I'm afraid).
     
  32. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509

    I want to buy but without blendshapes support it's useless for me. Please add this sooner...
     
  33. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    @methusalah999
    Hey, this look great! Does it only support sphere colliders? I was watching your video and I'm seeing that you have quite a few colliders for the arms and such. I'd like to be able to use capsule colliders.

    Also, when are you planning on letting us try your cloth system?!
     
  34. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Hello and thank you for your interest.

    HairStudio only supports sphere colliders for the moment, indeed. The good news is that in MarvellousCloth, I have implemented capsules and box colliders so I know now how to do it and I will be able to implement it in HairStudio soon. The bad news is that I have a lot on my table at the moment and the next version of HairStudio (that will include a global refactor using MarvellousCloth technology) will not land before April I'm afraid.

    About MarvellousCloth itself, I'm using it successfully in a game in production but I will still work on the UI and missing features for the next few months before going public with an early access.
     
  35. Vinayak-VC

    Vinayak-VC

    Joined:
    Apr 16, 2019
    Posts:
    60
    Can this work in Play mode?
    Like comb, Cut and all?
     
  36. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Hair is generated at startup and it is a long process so no, you won't be able to comb the hair during play mode.

    You won't be able to grow it either, but there are some tricks usable to shorten it : https://twitter.com/pushmatrix/status/1277953972599508992

    However, you can change all material and physics properties at run time.

    Have fun !
     
  37. Vinayak-VC

    Vinayak-VC

    Joined:
    Apr 16, 2019
    Posts:
    60
    can you please advice how the hair cutting logic is implemented in the presented demo and also the demo is quite remarkable...I was wondering about the approach.
     
  38. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Here is a copied answer I have already send to another HairStudio user on the subject:

    Have fun!
     
    Vinayak-VC likes this.
  39. AmyGilhespy

    AmyGilhespy

    Joined:
    Mar 7, 2019
    Posts:
    10
    Hi! I don't need this yet but I just purchased it early to support your development. I intend to use it in a URP project for which development will likely officially begin either late 2021 or early 2022. I will play around with your asset for now while I eagerly await your updates. Thanks for the excellent asset and keep up the good work!

    For my coming project, I will eventually want the following features. If you don't end up supporting the ones I can't live without for this project then I absolutely won't try to get a refund or anything (because I still want to support the effort), but I may have to go with another solution for the coming project, it just depends on what is supported by then and whether or not I can live without the missing bits. No matter what, I will try to find a use for Hair Studio eventually, even if it doesn't make it to this coming project.

    1. URP support. I didn't read the entire thread yet and I know you've been working on this so maybe it is already finished. Either way, I would like URP support eventually if it is not already finished.
    2. Blendshapes. I know this is on the roadmap, as you stated above that you might get to that point at around fall. I look forward to this most of all as it is an exciting feature, but I will wait patiently for you to finish, even if it takes another year or longer.
    3. The ability to swap hairstyles with reasonable performance. Again, I know this is on the roadmap via GPU loading.
    4. Ponytail and twintail support. I know you can already approximate a ponytail by starting at the root, but I think I read you say that you planned to add support for starting a long strand at the tip of a short locked hairstyle. That would be quite nice.
    5. Mac and Linux support. I'm sure you covered this somewhere in this thread, but I would want to release my game on multiple desktop platforms, not just Windows. As DirectX is not available on Linux and I'm not too sure about Mac, I realize that this is something that may or may not be coming to Hair Studio. I hope it does, but I want to support your effort either way.

    Basically, everything I think I might need that isn't already included (aside from Mac and Linux support) are features that you have stated here that you plan to add anyway. I look forward to your progress! Good luck and take care :)

    -- Amy
     
  40. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Hi and thank you for your purchase and your support. Here is some thoughts:
    - URP support is indeed almost done and there is only a issue with shadowing. Unfortunately, last time I checked, there was no easy solution. This pipeline in now more stable than the HDRP and I hope to find a solution next time I will work on that again.
    - Blendshape support is indeed on the roadmap. Note that this feature only won't be enough to create fur, but it will be great for beards.
    - It is already possible to activate/deactivate hairstyle with no cost during playmode, given that all the hair simulation have been already started once (if not, there will be a short freeze). Depending on what you need, this features is already ok.
    - About ponytails, I indeed plan to create a feature that allow to lock any part of the hair, but I would not use that for a ponytail. This method is used in DeusEx: Mankind Divided and the hair before the tie is still moving, creating useless and unrealistic motion while consuming performance. Lara Croft's and Geralt of Rivia's ponytails are created from roots, the upper hair is completely lock and the tips are hidden in the tie, which is much more efficient. But with the feature, one will be able to do whatever they want ^^
    - Both Mac and Linux are already supported as far as I know. I've never had specific feedback for Linux, though.
     
  41. flyer19

    flyer19

    Joined:
    Aug 26, 2016
    Posts:
    126
    can support xgen export .abc Format like UE GROOM?
     
  42. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    HairStudio does not support any import for the moment. But creating hair strands or guides in a script is not a big deal if you have some coding skill
     
  43. flyer19

    flyer19

    Joined:
    Aug 26, 2016
    Posts:
    126
    Hope for support xgen hair ~,because pure artists should be good at Maya Not Good At Unity.And AlembicCurves is handy now~,It seems not diffult to Support .abc curve to your hair tools for you~
     
  44. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    So I bought this and I am looking for a video on properly setting it up in a scene. The how to video starts with the scene already set up.
     
  45. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    Hi and thank you for your purchase.

    There is no video for it, because it's just a matter of adding three components to a game object : HairDressing, HairSimulation and HairRenderer. Also not show in the tutorial, you will need to set a mesh collider to HairDressing before you can paint the roots on the scalp.

    The good news is there are plenty of examples in the showcase scene and the textual documentation is also covering this part. Please come back to me if you need anything else.

    Have fun with HairStudio
     
  46. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    So are you making a separate scalp mesh (Skullcap) or are you just setting the entire head to Hairdressing. And how do I set the collider to HairDressing?
     
  47. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    As stated in the doc

    upload_2021-3-8_16-33-57.png

    you can use the head bone, or any child game object as long as it moves with the head.

    upload_2021-3-8_16-36-9.png
    Scalp collider is located in the roots tab, in the HairDressing component
     
  48. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    Thanks for the NFO :)
     
  49. unity_1iNKoEbR39MurQ

    unity_1iNKoEbR39MurQ

    Joined:
    Nov 24, 2018
    Posts:
    10
    Hola, funciona bien en hdrp en unity 2020.1 Pero al intentar pintar en el busto en la demostración no puedo pintar nada, si borra pero no pinta. Solo tengo eso como una duda
     
  50. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    To paint root, you will need to set a mesh collider first. The tool that place roots casts rays on this collider to find the surface to place the roots on. Once your roots are painted, you can disable the collider or even delete it completely.

    Does it help?