Game Development Reference
In-Depth Information
D3DBLEND_INVSRCCOLOR blendFactor =(1 - r s , 1-g s , 1-b s ,
1-a s )
D3DBLEND_SRCALPHA blendFactor =( a s , a s , a s , a s )
D3DBLEND_INVSRCALPHA blendFactor =(1 - a s ,1- a s ,1- a s ,
1- a s )
D3DBLEND_DESTALPHA blendFactor =( a d , a d , a d , a d )
D3DBLEND_INVDESTALPHA blendFactor =(1 - a d ,1- a d ,1- a d ,
1- a d )
D3DBLEND_DESTCOLOR blendFactor =( r d , g d , b d , a d )
D3DBLEND_INVDESTCOLOR blendFactor =(1 - r d ,1- g d ,1- b d ,
1- a d )
D3DBLEND_SRCALPHASAT blendFactor =( f , f , f , 1), where
f =min( a s ,1- a d )
D3DBLEND_BOTHINVSRCALPHA —This blend mode sets the
source blend factor to (1 - a s ,1- a s ,1- a s ,1- a s ) and the destina-
tion blend factor to ( a s , a s , a s , a s ). This blend mode is only valid for
D3DRS_SRCBLEND .
The default values for the source blend factor and destination blend fac-
tor are D3DBLEND_SRCALPHA and D3DBLEND_INVSRCALPHA ,
respectively.
7.3 Transparency
In previous chapters we ignored the alpha component of a vertex color
and material because it was not needed then, as it is primarily used in
blending. However, the alpha components from each vertex color are
shaded across the face of the triangle just as the colors are, but rather
than determining the pixels' colors, it determines the pixels' alpha
component.
The alpha component is mainly used to specify the level of trans-
parency of a pixel. Assuming that we have reserved 8 bits for the alpha
component for each pixel, the valid interval of values for the alpha com-
ponent would be [0, 255], where [0, 255] corresponds to [0%, 100%]
opacity. Thus, pixels with a black (0) alpha value are completely trans-
parent, pixels with a gray alpha value of (128) are 50% transparent, and
pixels with a white alpha value of (255) are completely opaque.
In order to make the alpha component describe the level of trans-
parency of the pixels, we must set the source blend factor to
D3DBLEND_SRCALPHA and the destination blend factor to
Team-Fly ®
Search WWH ::




Custom Search