Graphics Reference
In-Depth Information
the (underdetermined) image processing problem of matting, where an algorithm
tries to recover s c s α , s α , and d c from the composite d c .
14.10.3 Transmission
Partial coverage was a model that allowed us to describe fine but macroscopic
structures like lace or a window screen using simple geometric shapes and a sta-
tistical measure of coverage. In that case, the covered parts of the surface were
completely opaque and the uncovered parts transmitted all light because they were
filled by the surrounding medium, such as air.
If we ignore refraction (the phenomenon of light bending when it enters a
new medium), we can extend partial coverage to microscopic structures. Con-
sider an extremely thin pane of colorless glass. An incident light ray will either
strike a glass molecule on the surface and reflect or be absorbed, or pass through
the empty space between molecules (this model is physically simplistic, but phe-
nomenologically viable). We can let
represent the coverage of space by glass
molecules and render the glass using the partial coverage model. This is in fact
done frequently, although adding a bit more sophistication to our model allows us
to remove the extremely thin and colorless models to better describe a range of
transmissive media.
Green glass appears green because it transmits green light. If you hold a piece
of green glass over a black background, then it appears mostly black because it
reflects little green light. If we continue with the microscopic partial coverage
model, then s g
α
0 for the glass. The green glass in fact reflects little light at any
frequency, so s r
s b = 0. We can't describe the appearance of green glass
over a white surface using a single coverage value
s g
, because the coverage must
be large for red and blue light (so that they are blocked) and low for green light
(so that it transmits). We need to extend our coverage representation. Let s c be the
color of light reflected or emitted at the surface near frequency c , and 1
α
t c be the
microscopic coverage of frequency c by the surface, that is, t is the amount of light
transmitted. We retain the s α value for representing macroscopic partial coverage
by a transmissive medium. We can now express the composition of the surface
over the background by holding out the background by 1
t and then adding the
contribution due to s .
To implement this in code, we use the SRC_COLOR enumerant to selectively
block light from the background and then make a second pass to add the contribu-
tion from the surface:
1
2
3
4
5
6
7
8
9
10
// Selectively block light from the background
// where there is coverage
SetColor(t * s.a + (1 - s.a));
BlendFunc(ZERO, SRC_COLOR);
DrawSurface();
// Add in any contribution from the surface itself,
// held out by its own coverage.
SetColor(s);
BlendFunc(SRC_ALPHA, ONE);
Note that this example implements transmission by a thin surface that may
itself have only partial macroscopic coverage. In the case where that coverage is
complete and the surface itself scatters no light, the entire example reduces to
simply:
 
 
 
Search WWH ::




Custom Search