Additive Alpha Blend in Unity? {{ShaderForge}}

@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?

10 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

4 Likes

Looks really interesting, i’ll try that out for sure.
I’d love for regular written shaders to be used again tho, as I’ve got a couple ones i wanna reuse, but don’t really have the experience with shadergraph to recreate just yet

helps to know ; prevent miscommunication +help you find what you want :slight_smile:

BLEND-ADD (as Julian Love called it in GDC 2013) is …

pre-multiplied Alpha blending

since ‘Alpha blending’

= (Color * Alpha) + (background * [1 - Alpha])

you can toss out that bold instruction (Color * Alpha) in your engine because ‘pre-multiply’ obviously implies the work was already done — you now save the computer instruction overhead

shaderGraph (many tools that offer this in a pulldown or in a default material setting) use this nomenclature : well… obviously because it is technical tools created by Tech companies

image

this is basics
Texture.RGBA * TINT.RGBA (or Vertex.RGBA)
just split the Alpha out when done
choose blend and the pre-mult operation

JoanP what does Red channel HDR * Alpha do? confused me

4 Likes

Well you can use RGBA, i’m doing this for the background of a texture when you import one as black or transparent from PS.