Buffer Alpha Blend

Source: Internet
Author: User

(Demo) source code Download
Alpha Blend

Alpha blending is usually done to achieve transparency, the degree of transparency is controlled by an alpha value, and for a 8bit Alpha Chanel, 0-255 levels of transparency are generated, 0 is completely transparent, 255 is completely opaque, There are three main sources of alpha values in D3D.


Color Mixing Equation


Where OP is defined here as a mixed operation

There are five different forms

Add represents the add operation, i.e.;

Subtract indicates correlation (target-source), i.e.;

Rev_subtract represents the correlation of reflection (source-target), i.e.;

Min means the source, the target color of the small value, that is;

Max represents a large value in the source, target color, that is.



Fusion factor:

D3dblend_zero Fusion factor = (0,0,0,0)
D3dblend_one Fusion factor = (1,1,1,1)
D3dblend_srccolor Fusion factor = (R_SRC,G_SRC,B_SRC,A_SRC)
D3dblend_invsrccolor Fusion factor = (1-R_SRC,1-G_SRC,1-B_SRC,1-A_SRC)
D3dblend_srcalpha Fusion factor = (1-A_SRC,A_SRC,A_SRC,A_SRC)
D3dblend_invsrcalpha Fusion factor = (1-A_SRC,1-A_SRC,1-A_SRC,1-A_SRC)
D3dblend_destalpha Fusion factor = (A_DST, A_DST, A_DST, A_DST)
D3dblend_invdestalpha Fusion factor = (1-A_DST, 1-A_DST, 1-A_DST, 1-A_DST).
D3dblend_destcolor Fusion factor = (R_DST, G_DST, B_DST, A_DST).
D3dblend_invdestcolor Fusion factor = (1-R_DST, 1-G_DST, 1-B_DST, 1-A_DST).
D3dblend_srcalphasat Fusion factor = (F, F, F, 1), where f = min (A_SRC,1-A_DST)


Where R_src, G_src, B_SRC, a_src represent the source (that is, source) pixels of red, green, blue, transparent four component values, while R_DST, G_DST, B_DST, A_DST represents the target (that is, destination) pixels of red, green, blue, A transparent four component value.




Let's use GLSL to make some of these effects simple.

Blendop = ADD;
Srcblend = one;
Destblend = Zero;

The effect of the implementation is the same as not using the alphablendenable effect.




Blendop = ADD;
Srcblend = one;
Destblend = one;

This is the original operation number of one, the purpose of the operand is also a time effect, plus the previous reflection effect, has been very good imitation of glass material



Of course, when we use this effect, the source operand is 0, the target operand is 1, we can't see the teapot.

Blendop = ADD;
Srcblend = Zero;
Destblend = one;



Below we use source fusion as source color

Blendop = ADD;
Srcblend = Srccolor;
Destblend = one;



We then use source Fusion as the source color, the purpose of fusion for the purpose of color

Blendop = ADD;
Srcblend = Srccolor;
Destblend = Destcolor;


(demo) source code download

Buffer Alpha Blend

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.