Simple Transparency Shader

Node-based Shader Editor
Post Reply
rxmarcus
Posts: 13
Joined: Thu Feb 22, 2018 6:22 pm

Simple Transparency Shader

Post by rxmarcus »

I'm trying to wrap my head around how to do a shader that supports standard transparency in portions of a texture.

For example, I have a plain white square with transparency in the center, but I can't get it to render correctly with the center being transparent.

Image

At the moment I just have an Sampler2D texture connected to Albedo and I have the shaders Render Type set to Transparent and Render Queue to Geometry.

What else do I need to do?
Thank you
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Simple Transparency Shader

Post by Ricardo Teixeira »

Hello,

We would be happy to help!

Is the Alpha channel connected to the opacity input?

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!
rxmarcus
Posts: 13
Joined: Thu Feb 22, 2018 6:22 pm

Re: Simple Transparency Shader

Post by rxmarcus »

Ah, thank you. I had tried connecting the Alpha channel to the Opacity input previously but it still wasn't working. After your guidance I kept that connected and discovered that I needed to have Blend RGB set to Alpha Blend. Now all is well.

Thank You!
rxmarcus
Posts: 13
Joined: Thu Feb 22, 2018 6:22 pm

Re: Simple Transparency Shader

Post by rxmarcus »

Actually, one more question. In my Editor view, it shows transparent like it should.

But when I'm in the game view seeing what the game camera see's, my transparency is black?!

Image
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Simple Transparency Shader

Post by Amplify_Borba »

Hello, could you test using Transparent as the Blend Mode, in order to use its default settings, and report back if the issue is still present? I've attached a screenshot below as reference.
BlendMode.Jpg.jpg
BlendMode.Jpg.jpg (44.52 KiB) Viewed 20894 times
You may also check out Unity's documentation regarding Blending, it has plenty of useful information regarding this feature.

Please let me know if you have any further questions, thanks!
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!
rxmarcus
Posts: 13
Joined: Thu Feb 22, 2018 6:22 pm

Re: Simple Transparency Shader

Post by rxmarcus »

Changing the blend mode to Transparent does make it appear transparent rather than black, but then the Render queue is wacky because I want it to use a render queue of Geometry. If I have a 3d model that I use this shader on, then the models appendages render out of order and it looks wrong... :/
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Simple Transparency Shader

Post by Ricardo Teixeira »

rxmarcus wrote:Changing the blend mode to Transparent does make it appear transparent rather than black, but then the Render queue is wacky because I want it to use a render queue of Geometry. If I have a 3d model that I use this shader on, then the models appendages render out of order and it looks wrong... :/
Hello,

Can you share a sample for further examination?

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!
Post Reply