Additive Alpha Blend in Unity? {{ShaderForge}}

Hey folks,

I’m having some trouble getting good saturation in my FX. So far I’ve been overlapping two particles (one additive and one alpha) to get the desired range. I believe I read somewhere that Diablo used “Additive Alpha Blend” for one of their lightning effects.

The problem I run into is when I need to create particles that aren’t stationary. I won’t be able to add backing’s to the additive end especially if the values are randomized. Additive becomes desaturated and bright, while alpha blended is too opaque but won’t be bright if its transparent.

Does league use some form of Additive Alpha Blend? Can this setup be achieved in Unity or Unity’s ShaderForge?

3 Likes

We do have a “blendadd” however the effect your referencing is more than likely pure additive from a single texture. Something that I like to do is to just go super saturated with any glow effect like you’ve shown. A useful trick is to just put a soft super saturated version of your effect below an additive one. Jason Keyser goes over this technique in his videos here:

5 Likes

Hey, I think these blending settings in Shader Forge creates this “Blend-add” effect, or “Additive Alpha Blend” as you call it:

I started this shader from the “Particle (Alpha-Blended)” preset. Then modified it and built upon the nodes so I can multiply textures together etc. But anyway, with these blend setting the alpha channel should serve as a controller, where black = Add, and white = alpha-blend (regular blend? what’s it called?).

I might have changed more settings in Shader-Forge. I don’t remember as it’s been a while since I experimented with blend-add shaders. Would be cool to hear more from other people how they do it.

1 Like

This can also be achieved by creating a standard alpha blended shader and another texture as the emissive channel. This combined with the bloom/glow postprocess and HDR camera can give you the exact results.

@NateLane Yea I saw that method. It’s great for projectiles and stationary particles. I believe I figured it out- it was just a super saturated blue (which creates a dark visual tone).
@CellarPhantom Hmm, I’m trying that but I feel like I must be misunderstanding what Blend-Add is. Would this image be considered Blend-add? If so, I’m not getting that result using your setup. All the alpha channel is doing is masking the opacity (and its giving an error since its not ‘alpha-blended’).
@michalpiatek I believe I’ve tried that, although it won’t “add” the additive texture over surfaces. It’ll treat the entire thing as an alpha blend which is just opacity.

1 Like

If the emissive thing does not work you may try different approach. Take the color buffer of the frame and do blending manually (I am not sure how your shader editor calls this but it’s the same color buffer you would use for distortion). You can then use lerp(alphaBlendedTexture, colorBuffer, alphaThreshold) for alpha-blended parts and add additiveTexture on top of that to get additive regions. SO it would look like this:
*Take the color buffer
*Take the texture that acts as a alpha-blended area
*Use lerp function to blend the two based on the alpha-blended texture’s alpha
*Add the additive texture map onto the previously blended result (I mean, literally, use the “add” funtion to add two textures)
*Done. Use this combined texture as your output color

Mine also gives an error, but don’t worry. They give different results.

I added a Color node that I multiply with my emission and opacity input. The Color alpha is mulötiplied with texture alpha and then input in opacity. You can see on the image below, as decrease the alpha my material becomes more and more additive. 0 alpha = completely black alpha as it’s multiplied by 0.

And you can’t have a jpeg image, because it does not save an alpha channel.

EDIT: If you pick “Alpha Blended” instead of “Alpha Blended (Premultiplied)” then there will be no additive, and turning down the alpha will make the material completely transparent and vanish. With premultiplied it will instead become more additive instead of more transparent.

Hi, my approach is to minimize the transparency of the map, using several different sizes of different methods to stack the high light material

3 Likes

Your shadow map transparency is a little high, can reduce a transparency

Wow! So many layers Hen_Ye! It’s interesting to see how others work!

One OneMinusSrcAlpha is the blend mode. The GDC talk showed the maths. Though they also scroll n textures and multiply with a constant n.

If your edge quality is too dark feeling edit the alpha channel; darken the darks a bit more

1 Like

I think the shader I use most in my effects would suit your needs (AddMul in the LoL fan art project I shared). While I don’t think you can qualify it of pure blendadd, you can still adjust the alpha opacity and the additive intensity independently. :slight_smile:

Quick test from your ref:

Good mix:

Almost no emissive:

0 Opacity:

With a 1:1 ratio:

More emissive:

And more alpha:

It’s become my go-to shader. I tend to use it a bit too much, if I’m honest. It is an AlphaBlended (Premultiplied) too, btw. Also, while it is certainly not optimized for a real production, feel free to use it or experiment with it (the project has several variants, with a lot more options, like screen space masks, distortion and whatnot). :slight_smile:

7 Likes

@michalpiatek Ok, I’ll keep that in mind. Thanks!
@CellarPhantom Gotcha! Now I see how it’s working. White Alpha = Alpha Blended, Black Alpha = Additive. It’s like a two in one mode.
@Hen_Ye Is this one texture or multiple textures that are overlapped? What parts are colored and what parts are alpha?
@Torbach Yea, it looks like AlphaBlended (Premultiplied) has that setting. The creator just needs to fix that error haha.
@Sirhaian Thanks again man! I appreciate the breakdown. You weren’t kidding about that max customization. :laughing:

Welp, I believe I got my answer and it works! I just need to find the right balance and areas that I’d want to be additive/alpha-blended. Looks like it’s going to be a good amount of gray-tones instead of pure white/black.

3 Likes

Yup, I absolutely love to have a lot of options. :slight_smile:

A texture, is actually the last one, in front of those who are the last one texture using fuzzy filter Photoshop to do it, actually the first four can be combined into one as a colored, and the last piece of the original texture as alpha.

@Hen_Ye Ah I understand. Thanks!

Here’s one thing I’ve noticed about Additive/Blend-Add in Unity. Opacity cannot be enabled nor does it allow the material to be faded. Additive blocks opacity in ShaderForge.

Alpha Blended (Pre-multiplied; “Blend-Add”) treats Alpha as “What is alpha and what is additive” so things still pop in and out. Using an alpha gradient will simply tell the values to go from alpha to additive before abruptly disappearing. It could work for very quick things such as glints/lightning but that’s about it (afaik).

So far I’ve been using Alpha Blended with a multiplication of (3/6/12) in the Emissive to brighten the Alpha Blended texture. It sorta looks Additive, but doesn’t act that way. It just brightens the texture. This is the only way I can get a texture with special shader (panning/tiling/warping) and get it close to additive. Otherwise, I’m stuck with static textures (but I do get additive w/ opacity in default Unity). It’s an annoying trade-off and I hope the SF Creator gets around to adding Additive Opacity like the default package.

I’m not sure what you mean by opacity being blocked in ShaderForge when using additive (or blend-add)?

And, when you say it abruptly disappears… Does it dissapear when alpha = 0, or when does that happen?
Some times I choose to multply my color (emission) with the alpha, so when alpha is 0 it’s fully additive, and the color is black because it has been multiplied by the alpha. And additive and black = nothing. So multiplying color with alpha can give a nice fade away for a blend-add shader.

When using Additive the opacity fade does not work. I’m using Vertex Color directly and its not affecting the opacity fade at all. Nor is inputting a grayscale value into opacity taken into account while in Additive mode.

As for the Blend-Add, I’ll see if that works. If everything is working for you, I’m not sure why it isn’t for me. It’s kinda odd. Here’s a video trying out the setting. It seems to be ignoring the black mask altogether. Perhaps you could make a quick vid so I can see if it’s just my end.

https://www.youtube.com/watch?v=U7XosGQNarM&feature=youtu.be

Thanks for the video!

It made me confused at first, and I thought why is it not working for you? I tried it myself, and apparently I have to multiply my vertex RGB into my emission, otherwise it won’t fade away when I turn turn the alpha to 0/black in the particle system. I only change alpha over time, but I still need to multiply the RGB into emission for some reason. This is when I’m doing the additive blending. I don’t understand why you need to use the vertex RGB for the vertex alpha to work…?

And for Additive (Premultiplied) / Blend-add, you need to multiply the vertex alpha into emission as well, if you want to be able to fade it away completely.

EDIT: I am sorry. I must have spoke too soon. I can not do whatever I did again. I must have done something wrong on my part, because now I have the same issue as you. Alpha does not matter in additive blending.

Edit again: The only way I can get it to fade away is to use RGB and turn it black over time. Or, I think multiplying the vertex alpha with emission would have the same effect as trying to put it into opacity, with Additive blending.

Just multiply your vertex alpha color by whatever is going into emission and you can get “opacity” fading to work on Additive/Blend-Add (Alpha Blended (Premultiplied)) to work.

Opacity is going from 1 to 0 over particle lifetime

2 Likes