Additive Alpha Blend in Unity? {{ShaderForge}}

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:

10 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

@CellarPhantom Ah gotcha. That makes sense because it does disappear if the RGB is a value of black.
@DedRed Ok I’ll try that out! Thanks.

popcorn wiki has a comprehensive visual to explain but I’ll elaborate
http://wiki.popcornfx.com/index.php/Particle_tutorial_smoke#Setting_up_the_billboard_renderer

note alpha channel acts like a mask: as @Sirhaian called AddMul

if you network like @DedRed

Vertex.Alpha * source.RGB = emission

you re-create [SrcAlpha] [OneMinusSrcAlpha] and cannot use particle system vertex.alpha to lerp styles.
You still get addBlend according to alpha channel but imo it’s not the same

It comes down to preference

  • alpha acting like opacity …? or strictly controlling ‘Additivity’

One OneMinusSrcAlpha power imo comes from being able to lerp alpha <-> additive and in shaderforge the nodes would be

  • vertex.RGB * texture.RGB = emission
  • vertex.Alpha * texture.Alpha = opacity

so as @CellarPhantom pointed out you can’t use Alpha for opacity; the textures opacity is controlled by ‘fading out’ both Color and Alpha

to visualize you can imagine photoshop…

  1. Texture.RGB is a dodge channel
  2. Texture.Alpha [inverted] is a multiply channel

then you can mix-n-match styles: alphy, semi-additive, fully additive, /w full transparency etc…

whew, is this more clear?

9 Likes

Sorry for necroposting, but I’m trying to create this shader and have an odd bug - the texture is stretched out (?):

No idea why and how to fix it (but several textures are fine). I use Unity 5.6 and Shader Forge 1.38

Adobe Photoshop PNG will compress RGB like that and not save an Alpha channel for “blendAdd”

use Super PNG
http://www.fnordware.com/superpng/

  • you have to make a proper alpha channel
  • your RGB (texture) must be on a black background
2 Likes

Hey, sorry for bringing this back from the dead, but i’ve been staring at this thread all day trying to wrap my head around it.

I’ve got some help from a friend of mine and made a shader like this using code, but it won’t work with hdrp annoyingly, so I’m currently trying to recreate it in either shadergraph or amplify, but I just can’t seem to get it right.

Has anyone had any success making a AddBlend shader like this using Shadergraph or Ammplify?

((Alternatively knows how to get custom shaders to work with hdrp properly))

Here is how I see it in Shadergraph :slightly_smiling_face:


blendaddexample

Difference on a Bright Surface Beetween ADD and BlendADD
blendaddaddd

3 Likes