Game Development Reference
In-Depth Information
3.10B LEND M ODES
Blend statesarerenderingcontrolsthatallowustospecifyhowweneedcolorandalphaval-
ues to be blended into a render target. When we render we are taking some source data and
converting it into a set of pixels that we will store in a render target, this render target may
be empty or may already contain some pixels set in previous rendering operations, blending
takes place when we combine the source pixels with the existing pixels in the render target.
Each pixel has a numerical representation, blending is done by applying different mathem-
atical operations onthepixelstocalculate theresulting pixel.Ablendcanbeseenasafunc-
tion f(a,b) where a is the source pixel color and b is the pixel color in the render target, f
then will be the final color that will be stored.
Blend states are configured by sending different flags to the rendering device, these flags
represent blend factors that specify how the value of the source pixel and the destination
pixel will be applied such that the final color is determined by the formula:
Where bf a , bf b are the blend factors for a and b respectively, and they consist of four ele-
ments, such that
.
Dependingontheplatformitispossibletoconfigurecolorsblending,andalsohowthealpha
is blended by setting different blend factors for the source color, destination color, source
alpha and destination alpha. Not every blend mode can be achieved using the device's blend
factors, some blend modes need to be implemented through pixel shaders in the program-
mable rendering pipeline.
Search WWH ::




Custom Search