How make a (parametric) opacity gradient and how mix transparent layers layers

Hi all, my first post here!
I am moving my first steps in the world of VFX, and I found myself doing two things very often, but I don’t know if I do them in the right way, so :):

  • Often I need to apply an opacity gradient from the top to the bottom of something, in the way that the top is fully visible, while the extension of the gradient until the complete opacity is controllable with a parameter.
    I use the pow function to do that in the following way:
    image
    as I increase the Exp the gradient became shorter.
    Are there better ways ? I wonder pow computation could be expensive in the shader…

  • Often I have several layer, each one has its own opacity, usually I try to blend them with “Add”, becouse “multiply” add more transparency to each one.
    Is there a “good” way to do this ?

Thank you very much !!

Hi Frankie, I assume you’re using this in regular sprite particles? The pow is one of the ways you can do it, you could also use a texture, or anything else really. I wouldn’t be too worried about the performance impact of a single pow. You can multiply something by itself a few times instead of using a pow, too.

About combining layers, there’s no single way of doing it, you could try adding two layers together and dividing the result by 2, or you could multiply them together and get the square root of that, or maybe use the screen or overlay blend modes. Try a few and see what works best!

1 Like

Thank you, you give to me some useful insight !! :slight_smile: