Layered Sprites With Transparency

Node-based Shader Editor

Layered Sprites With Transparency

Postby JosephHorsmann » Fri Nov 09, 2018 7:22 pm

Hello,

I'm new to Amplify and still wrapping my head around how transparency is handled. I'm currently looking at making a shader with multiple PNG sprites with transparency layered on top on each other. I've experimented with add & multiply, as well as different blend types & modes and have yet to find success.

What I would like to achieve as a result is simply for one texture to sit on top of another, without blending in any way, as seen below:
PIC 1.png
PIC 1.png (5.87 KiB) Viewed 1437 times


I want to avoid masking or blending, like this example:
PIC 2.png
PIC 2.png (5.42 KiB) Viewed 1437 times

Any idea how to accomplish this? I feel like it should be possible, but I can only seem to find nodes & settings that will blend, instead of layering on top of, like I am trying to.
JosephHorsmann
 
Posts: 10
Joined: Mon Oct 08, 2018 2:32 pm

Re: Layered Sprites With Transparency

Postby Amplify_Borba » Mon Nov 12, 2018 4:36 pm

Hello, one possible way to accomplish this is through setting up a mask as the interpolator for a Lerp node, please refer to the example below:

Image

I'm using the relay node to show a preview of the mask being used, which has a value of 0 or black where the A input's texture is present, and 1 or white for the B input's texture.

You can also check out our SingleChannelMasking sample for a more complex case in which several masks are used, as well as the SpriteMask or MaskedUI samples for examples using each of those specific templates.

Please let me know if this helps!
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
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Layered Sprites With Transparency

Postby JosephHorsmann » Mon Nov 12, 2018 5:06 pm

Thanks for the reply Amplify_Borba,

Your example does help. I didn't realize that the alpha input of the lerp node worked that way. The lerp node will allow me to do what I need to do.
JosephHorsmann
 
Posts: 10
Joined: Mon Oct 08, 2018 2:32 pm

Re: Layered Sprites With Transparency

Postby Amplify_Borba » Tue Nov 13, 2018 8:50 am

Glad I could help!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, every bit helps, your feedback is extremely valuable to us.

Please feel free to get back in touch if you have any further issues or questions.
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
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: Bing [Bot] and 44 guests