Alpha Texture Blending

The lighting engine combines material color, vertex color, and lighting information to generate a per-vertex color. Once interpolated, this generates a per-pixel color that is written to the frame buffer. If an application enables texture blending, the pixel color will become a combination of the current pixel in the frame buffer and a texture color.

This formula determines the final blended pixel color:

Color = TexelColor x SourceBlend + CurrentPixelColor x DestBlend

Where:

The final blending equation is set by calling IDirect3DDevice9::SetRenderState and specifying the blend render state (D3DRS_BLENDXXX) with a corresponding blending factor (D3DBLEND). The values of SourceBlend and DestBlend range from 0.0 (transparent) to 1.0 (opaque) inclusive. In addition, an application can control the transparency of a pixel by setting the alpha value in a texture. In this case, use the following:

SourceBlend = D3DBLEND_ZERO 
DestBlend = D3DBLEND_ONE

The blending equation will cause the rendered pixel to be transparent. The default values are:

SourceBlend = D3DBLEND_SRCALPHA 
DestBlend = D3DBLEND_INVSRCALPHA

See Also

Texture Filtering, D3DRENDERSTATETYPE