The meaning of "Unity Shader"---Alpha blending

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.