Hello,
I was wondering if there is a way to achieve alpha cutout/clip in unlit mode?
Thank you!
Alpha cutout in unlit mode
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Alpha cutout in unlit mode
Hello,andreas45 wrote:Hello,
I was wondering if there is a way to achieve alpha cutout/clip in unlit mode?
Thank you!
What's your shader type?
Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Alpha cutout in unlit mode
It's "Unlit".
Thank you!
Thank you!
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Alpha cutout in unlit mode
You'll have to adjust your Rendering Options.andreas45 wrote:It's "Unlit".
Thank you!
It's quite flexible, be sure to let me know if you have any additional questions.
Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Alpha cutout in unlit mode
Hi Ricardo,
Thank you for the reply.
I'm afraid that I don't really understand why your directing me to the blend settings. Alpha clip is a feature that works independently of the blend mode, and in fact, should work quite well with the default blend settings. The render settings, sure, they should be set to "AlphaTest" for efficiency, but again, this is not be required for a working alpha clip shader.
Alpha clip is achieved by selectively calling the "discard" function from inside the pixel shader. For reference (and posterity) I've managed to achieve alpha clip in a "Custom Expression node" using the following code (Note that I'm using the "r" channel to control the clip value. change 0 to 3 to use the actual alpha value for clip):
With the following settings:

And used in the following way (Note that the expression node must me set up inline as shown, or the code will not be compiled into the shader):

This is the result

I could have done this from the start, but figured there might have been a more sensible way to use this feature. If there is not, is there any chance we could get this functionality into the output node of the unlit shader type in a future version?
Thank you!
Thank you for the reply.
I'm afraid that I don't really understand why your directing me to the blend settings. Alpha clip is a feature that works independently of the blend mode, and in fact, should work quite well with the default blend settings. The render settings, sure, they should be set to "AlphaTest" for efficiency, but again, this is not be required for a working alpha clip shader.
Alpha clip is achieved by selectively calling the "discard" function from inside the pixel shader. For reference (and posterity) I've managed to achieve alpha clip in a "Custom Expression node" using the following code (Note that I'm using the "r" channel to control the clip value. change 0 to 3 to use the actual alpha value for clip):
Code: Select all
if (ColIn[0] < Cutoff) discard; return ColIn;
And used in the following way (Note that the expression node must me set up inline as shown, or the code will not be compiled into the shader):

This is the result

I could have done this from the start, but figured there might have been a more sensible way to use this feature. If there is not, is there any chance we could get this functionality into the output node of the unlit shader type in a future version?
Thank you!
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Alpha cutout in unlit mode
My apologies, I was thinking of the HD template. You do indeed need to discard them manually with the Standard Unlit, we actually had a specific node for that but it was a removed a couple of builds ago due to a few recent changes in our template system.
We'll add it in the upcoming update, apologies for the inconvenience.
Thank you for the heads-up!
We'll add it in the upcoming update, apologies for the inconvenience.
Thank you for the heads-up!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Alpha cutout in unlit mode
Thank you Ricardo!