Alpha cutout in unlit mode

Node-based Shader Editor

Alpha cutout in unlit mode

Postby andreas45 » Thu Nov 29, 2018 9:09 am

Hello,
I was wondering if there is a way to achieve alpha cutout/clip in unlit mode?

Thank you!
andreas45
 
Posts: 7
Joined: Thu Sep 13, 2018 5:55 am

Re: Alpha cutout in unlit mode

Postby Ricardo Teixeira » Thu Nov 29, 2018 12:47 pm

andreas45 wrote:Hello,
I was wondering if there is a way to achieve alpha cutout/clip in unlit mode?

Thank you!


Hello,

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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Alpha cutout in unlit mode

Postby andreas45 » Fri Nov 30, 2018 1:43 am

It's "Unlit".

Thank you!
andreas45
 
Posts: 7
Joined: Thu Sep 13, 2018 5:55 am

Re: Alpha cutout in unlit mode

Postby Ricardo Teixeira » Fri Nov 30, 2018 11:21 am

andreas45 wrote:It's "Unlit".
Thank you!


You'll have to adjust your Rendering Options.

Image

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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Alpha cutout in unlit mode

Postby andreas45 » Sat Dec 01, 2018 1:27 am

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):
Code: Select all
if (ColIn[0] < Cutoff) discard; return ColIn;

With the following settings:
Image
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):
Image
This is the result
Image

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!
andreas45
 
Posts: 7
Joined: Thu Sep 13, 2018 5:55 am

Re: Alpha cutout in unlit mode

Postby Ricardo Teixeira » Mon Dec 03, 2018 1:57 pm

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!
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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Alpha cutout in unlit mode

Postby andreas45 » Wed Dec 05, 2018 8:53 pm

Thank you Ricardo!
andreas45
 
Posts: 7
Joined: Thu Sep 13, 2018 5:55 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 20 guests