0
\$\begingroup\$

I have this simple shader that will "fade out" and object using alpha clip, for this to work the alpha has to be set to 0.5.

I want to add a texture to this shader but I cannot figure out how to add transparent texture and still keep my other function of fading out using alpha clip.

Can this be done?

enter image description here

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Here's a shader graph that combines these effects:

Dissolve and Alpha Blending graph

Animated example

(Don't mind the banding in the animation above - that's just an artifact of saving it as an animated gif, and is not visible when the effect is rendered live)

The idea is that we'll keep our Alpha Clip Threshold low - at zero - so it only clips away completely transparent pixels.

Then we'll mix our smoothly varying translucent texture alpha with a 0/1 threshold signal coming from our dissolve effect. Wherever the dissolve zeroes-out the texture alpha, the pixel will be clipped, while preserving the entire (0, 1] range above that for translucent blending as normal.

You can adjust the threshold used for dissolving using "Edge" the input to the Step function, so it can be controlled independently from the Alpha Clip Threshold applied to the resulting alpha.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you so much, just getting into shaders and having a blast but its hard :D \$\endgroup\$
    – Majs
    Aug 13, 2023 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .