Game Development Reference

In-Depth Information

ω

I
0

ω

I
1

L
k

ω

I
2

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.

1

1

z

z

0

0

z
k
−
2

z
k
−
1

z
k

z
k
+1

z
k
−
2

z
k
−
1

z
k

z
k
+1

(a)

(b)

Figure 2.4.

The matting functions (a)
ω
k

and (b)
ω
k

with exemplary anchor points

z
k
−
2

to
z
k
+1
.

Search Nedrilad ::

Custom Search