441
ceed to render a new frame into buff er C, rather than idling while it waits for
the display hardware to fi nish scanning buff er A.
Render Targets
Any buff er into which the rendering engine draws graphics is known as a ren-
der target. As we’ll see later in this chapter, rendering engines make use of all
sorts of other off -screen render targets, in addition to the frame buff ers. These
include the depth buff er , the stencil buff er , and various other buff ers used for
storing intermediate rendering results.
10.1.4.7. Triangle Rasterization and Fragments
To produce an image of a triangle on-screen, we need to fi ll in the pixels it
overlaps. This process is known as rasterization. During rasterization, the tri-
angle’s surface is broken into pieces called fragments , each one representing a
small region of the triangle’s surface that corresponds to a single pixel on the
screen. (In the case of multisample antialiasing, a fragment corresponds to a
portion of a pixel—see below.)
A fragment is like a pixel in training. Before it is writt en into the frame
buff er, it must pass a number of tests (described in more depth below). If it
fails any of these tests, it will be discarded. Fragments that pass the tests are
shaded (i.e., their colors are determined), and the fragment color is either writ-
ten into the frame buff er or blended with the pixel color that’s already there.
Figure 10.36 illustrates how a fragment becomes a pixel.
Fragment
Pixel
Figure 10.36. A fragment is a small region of a triangle corresponding to a pixel on the
screen. It passes through the rendering pipeline and is either discarded or its color is written
into the frame buffer.
10.1. Foundations of Depth-Buffered Triangle Rasterization
Antialiasing
When a triangle is rasterized, its edges can look jagged—the familiar “stair
step” eff ect we have all come to know and love (or hate). Technically speak-