D3DTEXTUREBLEND

The D3DTEXTUREBLEND enumerated type defines the supported texture-blending modes. This enumerated type is used by the D3DRENDERSTATE_TEXTUREMAPBLEND render state in the D3DRENDERSTATETYPE enumerated type.

typedef enum _D3DTEXTUREBLEND {

D3DTBLEND_DECAL = 1,

D3DTBLEND_MODULATE = 2,

D3DTBLEND_DECALALPHA = 3,

D3DTBLEND_MODULATEALPHA = 4,

D3DTBLEND_DECALMASK = 5,

D3DTBLEND_MODULATEMASK = 6,

D3DTBLEND_COPY = 7,

D3DTBLEND_ADD = 8,

D3DTBLEND_FORCE_DWORD = 0x7fffffff,

} D3DTEXTUREBLEND;

Members

D3DTBLEND_DECAL

Decal texture-blending mode is supported. In this mode, the RGB and alpha values of the texture replace the colors that would have been used with no texturing.

cPix = cTex

aPix = aTex

D3DTBLEND_MODULATE

Modulate texture-blending mode is supported. In this mode, the RGB values of the texture are multiplied with the RGB values that would have been used with no texturing. Any alpha values in the texture replace the alpha values in the colors that would have been used with no texturing; if the texture does not contain an alpha component, alpha values at the vertices in the source are interpolated between vertices.

cPix = cSrc * cTex

aPix = aTex

D3DTBLEND_DECALALPHA

Decal-alpha texture-blending mode is supported. In this mode, the RGB and alpha values of the texture are blended with the colors that would have been used with no texturing, according to the following formula:

In this formula, C stands for color, A for alpha, t for texture, and o for original object (before blending).

In the D3DTBLEND_DECALALPHA mode, any alpha values in the texture replace the alpha values in the colors that would have been used with no texturing.

cPix = (cSrc * (10 - aTex)) + (aTex * cTex)

aPix = aSrc

D3DTBLEND_MODULATEALPHA

Modulate-alpha texture-blending mode is supported. In this mode, the RGB values of the texture are multiplied with the RGB values that would have been used with no texturing, and the alpha values of the texture are multiplied with the alpha values that would have been used with no texturing.

cPix = cSrc * cTex

aPix = aSrc * aTex

D3DTBLEND_DECALMASK

Decal-mask texture-blending mode is supported.

cPix = lsb(aTex) ? cTex : cSrc

aPix = aSrc

When the least-significant bit of the texture's alpha component is zero, the effect is as if texturing were disabled.

D3DTBLEND_MODULATEMASK

Modulate-mask texture-blending mode is supported.

cPix = lsb(aTex) ? cTex * cSrc : cSrc

aPix = aSrc

When the least-significant bit of the texture's alpha component is zero, the effect is as if texturing were disabled.

D3DTBLEND_COPY

Copy texture-blending mode is supported. This mode is an optimization for software rasterization; for applications using a HAL, it is equivalent to the D3DTBLEND_DECAL texture-blending mode.

To use copy mode, textures must use the same pixel format and palette format as the destination surface; otherwise nothing is rendered. Copy mode does no lighting and simply copies texture pixels to the screen. This is often a good technique for prelit textured scenes.

cPix = cTex

aPix = aTex

For more information, see Copy Texture-blending Mode.

D3DTBLEND_ADD

Add the Gouraud interpolants to the texture lookup with saturation semantics (that is, if the color value overflows it is set to the maximum possible value). This member was introduced in DirectX 5.

cPix = cTex + cSrc

aPix = aSrc

D3DTBLEND_FORCE_DWORD

Forces this enumerated type to be 32 bits in size.

Remarks

In the formulas given for the members of this enumerated type, the placeholders have the following meanings:

·cTex is the color of the source texel

·aTex is the alpha component of the source texel

·cSrc is the interpolated color of the source primitive

·aSrc is the alpha component of the source primitive

·cPix is the new blended color value

·aPix is the new blended alpha value

Modulation combines the effects of lighting and texturing. Because colors are specified as values between and including 0 and 1, modulating (multiplying) the texture and preexisting colors together typically produces colors that are less bright than either source. The brightness of a color component is undiminished when one of the sources for that component is white (1). The simplest way to ensure that the colors of a texture do not change when the texture is applied to an object is to ensure that the object is white (1,1,1).

QuickInfo

  Windows NT: Use version 4.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in d3dtypes.h.