Alpha Blending that is alpha blending
Blending is dealing with transparency, processing the final stage of rasterization, displaying the color on the screen
1 blend off turn off alpha blending
2 Blend formula: Blend srcfactor Dstfactor
Srcfactor mixed-source coefficients shader the blending coefficients of the colors of the current calculated points
Dstfactor mixing coefficients of colors accumulated before the current point of the mixed target coefficients
Final color = (shader calculated point color value * source factor) + (point cumulative color * target factor)
3 common coefficient of mixing
One 1 (show only RBG values)
Zero 0 (does not participate in mixing, for (0,0,0,0))
Scrcolor the RGB value of the source
Scralpha the alpha value of the source
Dstcolor the RGB value of the target
Dstalpha the alpha value of the target
Oneminussrccolor 1 minus source RGB value
Oneminusscralpha 1 minus Source alpha value
Oneminusdstcolor 1 minus the target RGB value
Oneminusdstalpha 1 minus target alpha value
4 several mixed-mode cases
Blend Zero One only displays the target's RGB opaque channel processing (alpha is 1)
Blend One zero only displays the RGB non-transparent channel processing of the source (Alpha is 1)
Blend one one target and source RGB values added, no transparent channel processing (alpha 1)
Blend Scralpha Zero displays only the color of the source (handles transparent channels), where it is fully transparent (0,0,0,1)
Blend scralpha oneminusscralpha Source RGB * Alpha + target RGB * (1-alpha)
5 Color Calculation rules
(Note: The R,g,b,a,x,y,z value range is [0,1])
(r,g,b) * a = (R * A, G * A, B * a)
(r,g,b) * (x, y, Z) = (R * ×, G * y, b * z)
(r,g,b) + (x, y, Z) = (r + x, G + y, B + z)
(r,g,b)-(x, y, Z) = (r-x, g-y, B-z)
The meaning of "Unity Shader"---Alpha blending