Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Most visual effects have source and destination blend modes:

  • Both

    blends

    use

    inverse

    source

    alpha

    alpha (Obsolete):

    Source

    blend

    factor

    is

    (1

    -

    Aₛ,

    1

    -

    Aₛ,

    1

    -

    Aₛ,

    1

    -

    Aₛ),

    and

    destination

    blend

    factor

    is

    (Aₛ,

    Aₛ,

    Aₛ,

    Aₛ);

    the

    destination

    blend

    selection

    is

    overridden.

    This

    blend

    mode

    is

    supported

    only

    for

    the

    D3DRS_SRCBLEND

    render

    state.

  • Constant blend factor: Constant color blending factor used by the frame-buffer blender. This blend mode is supported only if D3DPBLENDCAPS_BLENDFACTOR is set in the SrcBlendCaps or DestBlendCaps members of D3DCAPS9.

  • Destination alpha: Blend factor is (Ad Ad Ad Ad). May cause rendering issues with sky.
  • Destination color: Blend factor is (Rd, Gd, Bd, Ad).
  • Inverse destination alpha: Blend factor is (1 - Ad 1 - Ad 1 - Ad 1 - Ad).
  • Inverse destination color: Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad).
  • Inverse source alpha: Blend factor is ( 1 - Aₛ, 1 - Aₛ, 1 - Aₛ, 1 - Aₛ).
  • Inverse source color: Blend factor is (1 - Rₛ, 1 - Gₛ, 1 - Bₛ, 1 - Aₛ).
  • Inverted constant blend factor: Inverted constant color-blending factor used by the frame-buffer blender. This blend mode is supported only if the D3DPBLENDCAPS_BLENDFACTOR bit is set in the SrcBlendCaps or DestBlendCaps members of D3DCAPS9.

  • min(source alpha, 1 - destination alpha): Blend factor is (f, f, f, 1); where f = min(Aₛ, 1 - Ad).
  • Obsolete: you can achieve the same effect by setting the source and destination blend factors to Source alpha and Inverse source alpha in separate calls.
  • One: Blend factor is (1, 1, 1, 1).
  • Source alpha: Blend factor is (Aₛ, Aₛ, Aₛ, Aₛ).
  • Source color: Blend factor is (Rₛ, Gₛ, Bₛ, Aₛ).
  • Zero: Blend factor is (0, 0, 0, 0).

...

  • As, Rs, Gs, Bs are the ARGB components of the source image.
  • Ad, Rd, Gd, Bd are the ARGB components of the destination image.
  • SourceBlend seems to be always D3DBLEND_SRCALPHA, no matter the value you set.
  • Undernlined blend modes are probably the most useful ones



Source:

from Freshlook:

This is the relationship between the blend modes of visual effects and the D3DBLEND enumeration:

Zero                                     D3DBLEND_ZERO
One                                      D3DBLEND_ONE
Source color                             D3DBLEND_SRCCOLOR
Inverse source color                     D3DBLEND_INVSRCCOLOR
Source alpha                             D3DBLEND_SRCALPHA
Inverse source alpha                     D3DBLEND_INVSRCALPHA
Destination alpha                        D3DBLEND_DESTALPHA
Inverse destination alpha                D3DBLEND_INVDESTALPHA
Destination color                        D3DBLEND_DESTCOLOR
Inverse destination color                D3DBLEND_INVDESTCOLOR
min(source alpha, 1 - destination alpha) D3DBLEND_SRCALPHASAT
Obsolete                                 D3DBLEND_BOTHSRCALPHA
Both blends use inverse source alpha     D3DBLEND_BOTHINVSRCALPHA
Constant blend factor                    D3DBLEND_BLENDFACTOR
Inverted constant blend factor           D3DBLEND_INVBLENDFACTOR
NWN2_BLEND_FORCE_DWORD                   D3DBLEND_FORCE_DWORD

By looking at https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dblend you can understand the meaning of each blend mode.

SourceBlend seems to be always D3DBLEND_SRCALPHA, no matter the value you set.

...