I'm having a hard time understanding how premultiplied blend mode is suppose to work in Unity

syntax analogous to layers would be like
source = Layer 1
destination = Layer 2 (Below 1)

all blending is performed by summation in the final step:

Source * (operation) + Destination * (operation)

so before you add them you may ‘operate’ on them with a number of options

One = multiply by 1 = no change
DstColor = multiply by the Destination color values (incase you want to tint your source with the destination below it)
Zero = multiply by 0 = removes this

Pre multiplied alpha blending = Blend One, OneMinusSrcAlpha

  • Source behaves identical as an additive layer (linear dodge layer in photoshop)
  • The destination is ‘masked’ identically to a multiply layer by 1-alpha (e.g. inverted alpha)

But It’s an ongoing bug with LWRP → URP
:face_with_monocle:

snippet

 #ifdef _ALPHAPREMULTIPLY_ON   
            Color *= Alpha;
    #endif
            return half4(Color, Alpha);

https://fogbugz.unity3d.com/default.asp?1260085_urumn09cr2dqcnam
That breaks Pre-mult because it multiplies Color by alpha.
Identical & redundant to Blend srcAlpha, OneMinusSrcAlpha

It darkens source color creating black halos on VFX as well as causes it to go ‘invisible’
i don’t think you can salvage the blend mode in the shader preset pulldown, you have to compile and make it by hand CG/HLSL or w/e language afaik the pulldown in Shader graph is broken and has been for a while

it is unacceptable - Unity 2020.3.14f1


not technically. Alpha operates as a mask over the background e.g. ‘destination’ before source is added. Technically Premult is additive as source is left alone (*‘one’). it is the reduction of the destination by the alpha that occludes what is underneath that determines how much can shine through adding brightness.

you want to author the color of your textures as if it will be used in an additive blend mode < So you illustrate them on a black background

doing this in photoshop layers : this is how it will and does behave as intended

in a shader it is ostensibly

texture.rgb * vertex.rgb → output shader rgb
texture.a * vertex.a → output shader alpha

any overlap of alpha processing color will alter the basic intended use

also another post about some of this that might contain helpful things - but I tried to include everything here
another for alpha dissolve and the bug
another with scrolling and dissolve

4 Likes