Render Target Alpha (Direct3D 9)
The frame buffer blender can now blend alpha channels independent from color-channel blending on render targets. This control is enabled with a new render state, D3DRS_SEPARATEALPHABLENDENABLE.
When D3DRS_SEPARATEALPHABLENDENABLE is set to FALSE (which is the default condition), the render-target blending factors and operations applied to alpha are the same as those defined for blending color channels. A driver needs to set the D3DPMISCCAPS_SEPARATEALPHABLEND cap to indicate that it can support render-target alpha blending. Be sure to enable D3DRS_ALPHABLEND to tell the pipeline that alpha blending is needed.
To control the factors in the alpha channel of the render-target blenders, two new render states are defined as follows:
Like the D3DRS_SRCBLEND and D3DRS_DESTBLEND, these can be set to one of the values in the D3DBLEND enumeration. The source and destination blend settings can be combined in several ways, depending on the settings in the SrcBlendCaps and DestBlendCaps members of D3DCAPS9.
The alpha blending is done as follows:
renderTargetAlpha = (alphain * srcBlendOp) BlendOp (alphart * destBlendOp)
- alphain is the input alpha value.
- srcBlendOp is one of the blend factors in D3DBLEND.
- BlendOp is one of the blend factors in D3DBLENDOP.
- alphart is the render-target alpha value.
- destBlendOp is one of the blend factors in D3DBLEND.
- renderTargetAlpha is the final blended alpha value.