
192 III Image Space
I
0
I
1
I
2
L
k
ω
˙ω
˙ω
Figure 2.3. A flowchart showing how the input buffers get decomposed into a depth
layer: First, the fragments in the input buffers get weighted by ω and ˙ω. The resulting
subdepth layers get alpha-blended to compose the depth layer L
k
. The formula for this
schematics can be found in Equation (2.2).
where z
k−2
to z
k+1
defines anchor points for the layer boundaries. Pseudocode
for how to do matting in a fragment shader is shown in Listing 2.2.
0
1
z
k−2
z
k−1
z
k
z
k+1
ω
k
(z)
z
(a)
0
1
z
k−2
z
k−1
z
k
z
k+1
˙ω
k
(z)
z
(b)
Figure 2.4. The matting functions (a) ω
k
and (b) ˙ω
k
with exemplary anchor points
z
k−2
to z
k+1
.