• Hi Guest!

    We are extremely excited to announce the release of our first Beta1.1 and the first release of our Public AddonKit!
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. For access to the Public AddonKit you must be a Creator tier member. 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.
  • Hi Guest!

    VaM2 Resource Categories have now been added to the Hub! For information on posting VaM2 resources and details about VaM2 related changes to our Community Forums, please see our official announcement here.
Custom Shader - CUA Hair

Assets + Accessories Custom Shader - CUA Hair

Download [1.95 MB]

regguise

Well-known member
Featured Contributor
Joined
Nov 20, 2021
Messages
126
Reactions
959
regguise submitted a new resource:

Custom Shader - CUA Hair - Who needs PBR anyways?

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:

[ATTACH type="full"...

Read more about this resource...
 
How do you access to the rogue hair, so I can load your plugin ? I'm a total noob on this.
When I'm doing on the person, I have Cloth and skin but no CUA.
 
Ok found it. I think. But, how can I save and reload it without too many click. Does it work wirh Blazedust.CUAM CustomUnityAssetManager ?
I don't found my saved asset in the list.
 
Ok found it. I think. But, how can I save and reload it without too many click. Does it work wirh Blazedust.CUAM CustomUnityAssetManager ?
I don't found my saved asset in the list.
Yes like I mentioned in the post you would need to use CUAManager to save the preset.

Although for rogue hair you don't really have to load this shader as the hair already comes with this shader pre-applied. You can still load it to tweak the parameters if you desire.
 
Wonderful plugin! Works flawless with CUA hair, but how can I save and autoload plugin with hair that made as STOPPER CUA clothing?
Or could I save my values as preset?
thanks!
Untitled-1.jpg
 
Wonderful plugin! Works flawless with CUA hair, but how can I save and autoload plugin with hair that made as STOPPER CUA clothing?
Or could I save my values as preset?
thanks!
View attachment 490463
Hi, sorry for missing you reply.

Stopper's clothing plugin manager doesn't save CUA's plugin data. So you'll need to use CUAManager plugin for this.
 
Diana from Hitman 3 being unreleased is crazy o_O
It was an earlier port I did. Not completely satisfied with it so didn't post it. I'll redo one some time later.
 
regguise updated Custom Shader - CUA Hair with a new update entry:

Updates

Updates to sync this release to the version used in my Chunli look:
  • Tweaked the fake SSS code. Now at low SSS value the hair won't get darkened
  • Removed specular highlight from transparent passes to boost some performance
  • Added a variant: RegguiseUnityHairShader_MSAA - where MSAA will be applied using VaM's MSAA setting.
    • It can eat some FPS for close ups and higher res meshes. But will give...

Read the rest of this update entry...
 
hi!!

newest patch dont work with most / all of the cuas thats been working in previous version.

i will use the custom shader cua hair.3 for the time being
1756375072343.png
 
hi!!

newest patch dont work with most / all of the cuas thats been working in previous version.

i will use the custom shader cua hair.3 for the time being
View attachment 519829
Can you provide a bit more detail? Are you loading an old scene or a old preset? What happens when you load it fresh on a new CUA?
 
regguise updated Custom Shader - CUA Hair with a new update entry:

Scatter Update & Optimization

Well I finally figured out why light atten was not working for me and it was because my dumbass couldn't tell the difference of one underscore and two :(

Update:

  • Now has proper scatter effect from strong light source, and correct shadow attenuation calculation. The lighting should be much more accurate under setup with large dark/bright contrast. (i.e. no more bright)
...

Read the rest of this update entry...
 
regguise updated Custom Shader - CUA Hair with a new update entry:

MSAA variant update

MSAA variant update

  • Added the missing json file for MSAA variant
  • Removed transparent passes as with AlphaToMask it is not really needed anymore
  • Added two new properties to better control alpha
    • Alpha Transition High / Low
      • Default to 0.95 / 0.05, most of the time you don't need to adjust these, but sometimes the alpha channel of the main texture may not have very good distribution, in such cases you'll see transparent edges on the hair being too...

Read the rest of this update entry...
 
I'm trying to change the shadow, but the Alpha Cutoff Shadow setting doesn't seem to do anything. Is this just me?
 

Attachments

  • shadow.mp4
    5 MB
I'm trying to change the shadow, but the Alpha Cutoff Shadow setting doesn't seem to do anything. Is this just me?
It is a known issue. Currently it doesn't do anything. I have update coming. Thanks for reporting.
 
regguise updated Custom Shader - CUA Hair with a new update entry:

Alpha/Shadow updates

  • Fixed shadow casting not clipping with alpha - shadow and scattering should look much better now
    • Alpha Shadow Scale - no need to adjust this most of the time, unless for certain light setup
    • Alpha Shadow Cutoff - adjust this if you think the shadow is too broad/narrow
  • MSAA variant only - Added Alpha scaling with mip level
    • Enable Mip Level Alpha Scaling
      • Use this if you see hair becoming too transparent at a distance and adjusting other...

Read the rest of this update entry...
 
Question for you @regguise, does this shader reference the raw alpha values from texture in the CUA assetbundle or does it also take into account the 'Alpha Cutouff' value I baked into my cutout material in Unity? Just checking to see if I need to over adjust that value in Unity to give the MSAA more or less meat to work with or not.

Thanks, and great work man!
 
Last edited:
Question for you @regguise, does this shader reference the raw alpha values from texture in the CUA assetbundle or does it also take into account the 'Alpha Cutoff' value I baked into my cutoff material in Unity? Just checking to see if I need to over adjust that value in Unity to give the MSAA more or less meat to work with or not.

Thanks, and great work man!

Thanks! It is a great question you asked.

The only texture the shader uses from the CUA is the albedo texture. The ‘raw alpha’ is sampled from the alpha channel of the albedo texture.

The AlphaCutoff value is what shader uses to cull off any fragments with alpha lower than the cutoff. Now if you are using MSAA variant, MSAA can already mask out the low alpha fragments, therefore you can leave the cutoff at 0 in most cases when using MSAA.

Now for any fragments that survive the culling, the shader actually does a smoothstep interpolation in order to get a a smoother distribution. The AlphaTransitionHigh/Low value controls this. The way they works is:

If alpha is higher than AlphaTransitionHigh, it is set to 1.
If alpha is lower then AlphaTransitionLow, it is set to 0.
If in between, it is a smoothly interpolated value.

So if you tune down AlphaTransitionHigh, the hair will look more solid/full since more fragments have their alpha pushed to 1, and if you tune up AlphaTransitionLow, the hair will look more scarce and transparent as more fragments alpha pulled to 0.

Now to answer your question, I don’t think you really need to edit alpha of the texture before you pack it into the CUA, you should be able to get a decent look by adjusting the sliders in game. But of course there’s no harm in it as long as you know what you are doing.

Hope this helps. Let me know if you run into any issues or needed any other info.

Thanks!
 
Thanks! It is a great question you asked.

The only texture the shader uses from the CUA is the albedo texture. The ‘raw alpha’ is sampled from the alpha channel of the albedo texture.

The AlphaCutoff value is what shader uses to cull off any fragments with alpha lower than the cutoff. Now if you are using MSAA variant, MSAA can already mask out the low alpha fragments, therefore you can leave the cutoff at 0 in most cases when using MSAA.

Now for any fragments that survive the culling, the shader actually does a smoothstep interpolation in order to get a a smoother distribution. The AlphaTransitionHigh/Low value controls this. The way they works is:

If alpha is higher than AlphaTransitionHigh, it is set to 1.
If alpha is lower then AlphaTransitionLow, it is set to 0.
If in between, it is a smoothly interpolated value.

So if you tune down AlphaTransitionHigh, the hair will look more solid/full since more fragments have their alpha pushed to 1, and if you tune up AlphaTransitionLow, the hair will look more scarce and transparent as more fragments alpha pulled to 0.

Now to answer your question, I don’t think you really need to edit alpha of the texture before you pack it into the CUA, you should be able to get a decent look by adjusting the sliders in game. But of course there’s no harm in it as long as you know what you are doing.

Hope this helps. Let me know if you run into any issues or needed any other info.

Thanks!

Super in depth answer, thanks for that. My knowledge of rendering pipelines and shaders is rather limited, but you have given me a better sense of what knobs I can play with. I wasn't quite sure of the difference between the MSAA shader and the regular one.

Also, nice to know that the cutoff value in the Unity Cutout shader is not important to your calculations, if you're pulling the alpha data from the actual albedo texture itself. I found myself continually re-packaging my hair over and over, unsure of whether or not any adjustments to the coutout values were affecting your shader.

Which is AMAZING by the way. CUA hair was a massive compromise for so long, having to rely only on the binary cutout shader, you've made CUA hair more than viable, and when combined with EZSoftBone, it's almost as good as sim hair, but still leagues ahead of where it was, so thanks for that!

- Metix
 
Back
Top Bottom