Game Development Reference
Figure 1.5. Operations performed before a fragment is written to the image buffer.
The first fragment operation performed, and the only one that cannot be disa-
bled, is the pixel ownership test . The pixel ownership test simply determines
whether a fragment lies in the region of the viewport that is currently visible on
the display. A possible reason that the pixel ownership test fails is that another
window is obscuring a portion of the viewport. In this case, fragments falling
behind the obscuring window are not drawn.
Next, the scissor test is performed. An application may specify a rectangle in
the viewport, called the scissor rectangle , to which rendering should be restrict-
ed. Any fragments falling outside the scissor rectangle are discarded. A particular
application of the scissor rectangle in the context of the stencil shadow algorithm
is discussed in Section 10.3.7.
If the scissor test passes, a fragment undergoes the alpha test . When the final
color of a fragment is calculated, an application may also calculate an alpha val-
ue that usually represents the degree of transparency associated with the frag-
ment. The alpha test compares the final alpha value of a fragment to a constant
value that is preset by the application. The application specifies what relationship
between the two values (such as less than, greater than, or equal to) causes the
test to pass. If the relationship is not satisfied, then the fragment is discarded.
After the alpha test passes, a fragment moves on to the stencil test . The sten-
cil test reads the value stored in the stencil buffer at a fragment's location and
compares it to a value previously specified by the application. The stencil test
passes only if a specific relationship is satisfied (e.g., the stencil value is equal to
Search Nedrilad ::