Page 1 of 2

Creating a hair shader

PostPosted: Fri Feb 10, 2017 9:01 am
by SecretAnorak
Hi there,

I'm very new to the world of shaders, but am loving the sudden power that ASE has given me. I'm trying to achieve something which I am unsure is possible in ASE as it stands: Making an effective hair shader.

If anyone has played with adding hair to characters, they will have come across these problems:
1 - The cutout shader (Masked in ASE) looks simply awful, nasty hard edges to hair:
Image
2 - The fade shader looks wonderful with soft alpha blending of hair, BUT has Z-sorting problems (notice the fringe)
Image
What I'm trying to achieve is to render the faded version then layer the cutout version on top. The idea being that the fade version will give nice soft edges whereas the cutout will fix the z-sort problems in more solid parts of the hair. Something like this: (this is a mock up using 2 models with different shaders on them)
Image
(The Fade pass is 2 sided, the cutout pass is 1-sided)

Of course if there was some way to make a fade shader respect z-sorting then none of this would be necessary.

If anyone could let me know if this is possible, or of a better solution, I would be most grateful.

Thanks

Re: Creating a hair shader

PostPosted: Fri Feb 10, 2017 12:01 pm
by Ricardo Teixeira
Hello,

Thank you for using the Amplify Shader Editor, we really appreciate the support. Unfortunately, we currently don't have a specific hair example that we can share. We will definitely include one in future updates, I'll be sure to let you know as soon as it's available.

I will pass this on to the ASE developer and, since you already posted it on the official thread, we will get back to you there.

Thanks!

Re: Creating a hair shader

PostPosted: Fri Feb 10, 2017 12:30 pm
by SecretAnorak
Thanks for the answer.

Turns out I could achieve what I wanted by making both shaders in ASE and a using little bit of judicial Cut and Paste afterwards.

Great product, can't wait to see where it goes.

Re: Creating a hair shader

PostPosted: Fri Feb 10, 2017 1:06 pm
by Ricardo Teixeira
SecretAnorak wrote:Thanks for the answer.

Turns out I could achieve what I wanted by making both shaders in ASE and a using little bit of judicial Cut and Paste afterwards.

Great product, can't wait to see where it goes.


Thanks, happy to hear it ;)

Re: Creating a hair shader

PostPosted: Wed May 03, 2017 4:53 am
by 3d artist1987
Any update?

Re: Creating a hair shader

PostPosted: Wed May 03, 2017 9:17 am
by Ricardo Teixeira
dev19872014 wrote:Any update?


On hair related shader samples? Unfortunately, not at the moment. We will register your interest and contact you as soon as we add any.

Thanks!

Re: Creating a hair shader

PostPosted: Mon Jun 12, 2017 7:18 am
by 3d artist1987
Thanks for reply

Re: Creating a hair shader

PostPosted: Thu Sep 06, 2018 12:26 pm
by miecz
Hello,
Is there a possibility to use temporal AA dither in Amplify Shader Editor? There is a well known concept of using temporal AA and dithering for creating semi transparent objects (like hair). I believe that Unreal's standard hair shader uses it.

I've managed to create a hair shader with very simple alpha dithering. It gives 50% opacity. It's a quite dirty trick using post process (CTAA from Livenda). I simply dither the hair alpha (add a "dithered border" on top of regular alpha cutout). My shader inverts the dither pattern every 1/30th second. This way it gets blended with previous frames via TAA and creates an illusion of transparency. Please see the attached image.

I was wondering if there is any way of replicating Unreal's hair shader in Amplify Shader Editor (maybe when combined with a dedicated post processing?).

Re: Creating a hair shader

PostPosted: Thu Sep 06, 2018 12:50 pm
by Ricardo Teixeira
miecz wrote:Hello,
Is there a possibility to use temporal AA dither in Amplify Shader Editor? There is a well known concept of using temporal AA and dithering for creating semi transparent objects (like hair). I believe that Unreal's standard hair shader uses it.

I've managed to create a hair shader with very simple alpha dithering. It gives 50% opacity. It's a quite dirty trick using post process (CTAA from Livenda). I simply dither the hair alpha (add a "dithered border" on top of regular alpha cutout). My shader inverts the dither pattern every 1/30th second. This way it gets blended with previous frames via TAA and creates an illusion of transparency. Please see the attached image.

I was wondering if there is any way of replicating Unreal's hair shader in Amplify Shader Editor (maybe when combined with a dedicated post processing?).


Grettings,

In addition to common shader types ASE also provides a Template System for increased flexibility, definitely something to consider if you are comfortable with shader development.

We do include a Dither node to get you started; I recommend looking into the Post-Processing stack Temporal AA solution.

Thanks!

Re: Creating a hair shader

PostPosted: Thu Sep 06, 2018 1:25 pm
by miecz
Hi!

I'm not that good at writing shaders, I'm afraid :-). Yes, I am using Dither node provided by Amplify Shader Editor (that example was done with Amplify Shader Editor). It gives really promising results.

I think the only element I'm missing is to be able to move the dither pattern across the screen. If I would have something like a panner for the Dither node, it would most probably work (with CTAA post processing - it doesn't seem to work with Unity's build in TAA).

I will give it a try and do a UV based dither with a panner, it may work as well (but screen-space dither will probably always look better).

Thanks!