Graphics Reference
In-Depth Information
When the square is rendered, the RGB values of the source color
S
are assigned
to the destination pixels
D
:
⎧
⎨
D
r
←
S
r
,
D
←
S
or
D
g
←
S
g
,
⎩
D
b
←
S
b
.
In this way, the destination pixel color is overwritten by the source primitive color.
Modern graphics hardware generalizes this color assignment operation with a
color blending function. Instead of simply overwriting the destination pixel color,
the blending function combines the destination pixel colors (
D
) with the source
primitive colors (
S
) to create new destination colors:
D
←
f
(
D
×
A
d
,
S
×
A
s
)
,
(12.3)
where
⎧
⎨
D
−
destination pixel color
,
A
d
−
destination blending factor
,
S
−
source primitive color
,
⎩
A
s
−
source blending factor
,
()
−
.
f
blending function
For example, with blending factors
A
d
=(
.
,
.
,
.
)
,
0
2
0
2
0
2
A
s
=(
0
.
8
,
0
.
8
,
0
.
8
)
,
and a blending function of addition
D
←
f
(
D
×
A
d
,
S
×
A
s
)
,
D
←
(
D
×
0
.
2
)+(
S
×
0
.
8
)
,
we get
⎧
⎨
←
×
.
+
×
.
,
D
r
D
r
0
2
S
r
0
8
←
×
.
+
×
.
,
D
g
D
g
0
2
S
g
0
8
⎩
D
b
←
D
b
×
0
.
2
+
S
b
×
0
.
8
.
In this case, the final destination pixel colors are a blend of 20% (0
.
2) original
destination pixel colors with 80% (0
8) source primitive colors.
To properly support this blending functionality, modern graphics hardware
introduced a forth channel to the color representation, the
.
α
channel:
color
=(
r
,
g
,
b
,
α
)
,
Search WWH ::
Custom Search