• Hi Guest!

    We are extremely excited to announce the release of our first Beta for VaM2, the next generation of Virt-A-Mate which is currently in development.
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. Once subscribed, download instructions can be found here.

    Click here for information and guides regarding the VaM2 beta. Join our Discord server for more announcements and community discussion about VaM2.
Custom Shader - CUA Hair

Assets + Accessories Custom Shader - CUA Hair

Download [1.89 MB]
Status
Version change awaiting approval before being displayed publicly.
This is a Unity shader designed for CUA Hair. (hair cards, mostly)
It is packaged into an assetbundle and to be used via this plugin:



Some before, after comparisons:

ezgif-428ebcb6c16f5b.gif
ezgif-773d8b28f7c15c.gif




ezgif-7ae412b421476a.gif
ezgif-70f7e4fe965951.gif


ezgif-7486723929e593.gif
ezgif-28a2af05739c95.gif




Demo video of using the plugin to load and tweak the look:






To save CUA plugin preset, please use @Blazedust 's CUA manager:



Important things to keep in mind when you try this:


  • This shader works best on modern/semi-modern hair cards geometry. I would NOT recommend using this on any solid/clay or stylized hair geometry.
  • As you can probably tell from above comparisons, the improvement this shader brings will vary depending on the hair mesh and texture, and proper tweaking of the properties.
  • The assumption here is that the CUA default shader is Unity Standard, or any shader that uses same texture names (_MaintTex and _BumpMap), the replaced shader will continue to use the two textures already in the CUA.
  • Another assumption is that the texture UV should have the hair strand all in one direction, usually along y axis. This is common practice in hair card meshes. This is what ensure the aniso highlight can run along hair flow.
  • This shader is not really PBR, so how it looks WILL depend on how lighting is setup.
  • I haven't done much testing on performance but based on what I have seen it should still count as pretty lightweight. In theory it should be slightly more expensive due to the extra passes, but still no where near the VaM built in sim hair shader.
  • Lastly please do keep in mind this will never look as good as VaM's sim hair. The whole goal of this is to give an uplift of look of CUA hairs when it is possible.



Breakdown of the properties and tips for tweaking them: (CLICK SPOILER TO SHOW)

  • Show Back Face
    Many hair will look better when back face is culled, so this is default off. But sometimes certain hair needs it to look fuller. Try toggling this and choose whichever one looks better

  • Main Texture
    You don't need to load this.

  • Normal Map
    You don't need to load this.

  • Anisotropic Noise
    It is preloaded when you load the shader. If you have a different/better noise texture you can replace it.

  • Color
    Main texture tint color. It is default to white. But generally you want start by darken this a little bit to counteract the brightness this shader adds.

  • Alpha cutoff
    The alpha cut off value used by opaque pass. Generally this should be higher than the value you would use in Unity Standard cutout. Usually 0.4~0.6 works fine.

  • Mip Level Alpha Scale Offset, Alpha Cutoff Shadow
    These two controls the shadow cutoff and resolution. The default values are generally good enough. If you think the shadow looks bad try changing these two.

  • Specular Color
    Highlight tint color. Default to white, usually it will start appear too bright. Start by darkening it and slightly tint towards the main texture color

  • Primary Specular Intensity
    There are two sets of aniso highlights. This controls the intensity of primary highlight

  • Secondary Specular Intensity
    This controls the intensity of secondary highlight

  • Primary Highlight Shift
    Offsets the position of the primary anisotropic highlight along the hair strand. Use this to fine-tune the main highlight's location.

  • Secondary Highlight Shift
    Offsets the position of the secondary anisotropic highlight. Adjust to control the separation and appearance of the secondary highlight.

  • Smoothness
    Controls the sharpness of the specular highlights. Higher values make highlights smaller and sharper, while lower values make them broader and softer. Adjust to match the desired hair glossiness.

  • Flatness
    This adds a flat diffuse to the lighting, which will make the hair slightly brighter and flatter. Default to 0. If the hair has too many dark part in texture try tweaking this.

  • Lighting Smoother
    Usually I don't change this. It modifies the transition of lighting across the hair surface. Higher values can help reduce harsh lighting transitions and make the hair appear smoother under light.

  • Subsurface Scattering
    This is a fake SSS that is added to the dark/shadowed part of the mesh. Usually 0.2 is good enough. Depending on lighting you may want to adjust it slightly.

  • Anisotropic Roughness
    Adjusts the spread of the anisotropic (directional) highlights. Higher values make the highlight wider and softer, while lower values make it tighter and more focused.

  • Anisotropic Rotation
    Rotates the direction of the anisotropic highlights. Useful for matching the highlight direction to the flow of the hair strands. You don't need to change this unless the texture has hair strands in a direction other than y-axis.

  • Anisotropic Frequency
    Controls the tiling or repetition of the anisotropic noise texture along the hair. Higher values increase the frequency, making the noise pattern finer.

  • Strandiness / Strand Highlight Cutoff
    These two are for a specific situation. It will add "Strandiness" to the highlight based on the brightness of the main texture. The ideal use case for this is when main texture of the hair has clear hair strands drawn out, i.e. brighter color for hair strands and darker color in between strands. "Strandiness" controls the overall effect strength and "Strand Highlight Cutoff" controls the brightness cutoff for the effect to kick in. The effect heavily depends on the main texture. If you are not sure, just try and see if it gives a better look. "Strand Highlight Cutoff" could be very small sometimes (~0.02). If there is no improvement, just leave both at 0.





Hope you give it a try and let me know if any issues/feedback.



Credits:
------------------------------------------

This shader is basically an amalgamation of existing hair rendering methods from Unity community:

  • Dual Anisotropic highlights
  • Fake SSS
  • Custom Fresnel
Above features were implemented in vertex/frag based on methods from itsFulcrum:
https://github.com/itsFulcrum/Unity-URP-Hair-Shader

  • Strandiness
  • Flat Diffuse, Light Smoother
  • Mip offset shadow pass
Above features implemented based on methods from AdamFrisby:
https://github.com/AdamFrisby/UnityHairShader

  • Dual pass alpha blending
This is based on my own dual pass shader here:


------------------------------------------

Looks and CUA hair used in comparison screenshots:
  • Diana from HM3, by me, unreleased
  • Zoe from SF, by me, unreleased

More resources from regguise

Share this resource

Latest reviews

Positive
Version: 1.0
Wow, I've been waiting for this!
Upvote 0
Back
Top Bottom