Graphics Reference
In-Depth Information
a hardware implementation of the blending function. In that case, there is some
arithmetic unit tasked with updating the frame buffer with the new value. The
unit must always be semantically configured to perform some function, however
trivial.
Say that we're rendering the scene by rasterization. Rasterization is just a way
of iterating over screen-space sample locations. We typically choose to iterate
over the samples arising from the projection of object boundaries (i.e., surfaces).
However, one can also choose to rasterize geometry that does not correspond to
an object boundary as a way of touching arbitrary samples. For example, deferred
shading typically rasterizes a bounding volume around a light source as a conser-
vative method for identifying scene locations that may receive significant direct
illumination from the source. If rasterizing some such volume that lies entirely
within the vacuum, how do we blend the resultant contribution? One method is
BlendFunc(ZERO, ONE) , yielding the net result
d c = 0.0
·
s c + 1.0
·
d c
(14.18)
= d c ,
(14.19)
which allows the preexisting value in the image to remain. Here, the rasterized
surface is perfectly transparent, meaning that it is truly invisible to light. Why
bother rasterizing when we'll just discard the source color? One answer is that
there are more attributes than just radiance stored at a pixel. One might want to
mark an area of the depth or stencil buffer without affecting the image itself. This
occurs, for example, when implementing stenciled shadow volumes by rasteriza-
tion. Another answer is that we may want to change the blending weights per-
sample to selectively discard some of them, as discussed in Section 14.10.2.
14.10.2 Partial Coverage ( α )
Let us return to the scene containing a thin blue star floating in front of a red wall,
introduced in Section 14.10.1. One way to model the blue star is with a single
two-sided rectangle and a function defined on the rectangle (say, implemented
as a texture map) that is 1 at locations inside the star and 0 outside the star. This
function, whose value at a sample is often denoted
α
, describes how the star covers
the background.
The coverage in this case is associated with the sample of the source object that
is being rendered, so we should denote it
α s . An implementation likely contains
a class for representing radiance samples at three visible frequencies (red, green,
and blue) and a coverage value as
1
2
3
4
5
6
class Color4 {
float r;
float g;
float b;
float a;
};
To leverage the concept of coverage as a way of masking transparent parts of
the rectangle, we introduce two new blending enumerants:
SRC_ALPHA :
b c ( s , d )= s α
b c ( s , d )= 1
ONE_MINUS_SRC_ALPHA :
s α
 
 
 
Search WWH ::




Custom Search