Graphics Reference
In-Depth Information
additional rules must be used in testing to ensure that all pixels
in two adjacent triangles are selected, and that no pixels that are
selected more than once by neighboring primitives. Figure 3.60
demonstrates some of these situations.
The triangle rasterization rules specify that any points
that fall onto a top edge or left edge of a primitive are se-
lected for rasterization from that primitive. A top edge is any
perfectly horizontal edge, while a left edge is any edge that
faces to the left at any angle. If you consider the normal vectors
of the range of edges that will allow selection of a pixel, the
angles that will produce a fragment when an edge resides on a
pixel center would appear as shown in Figure 3.61.
Figure 3.61. The angular
range of primitive edge
normal vectors to select a
pixel for rasterization.
Line rasterization is somewhat different from triangle rasterization. It can follow
one of two paths—either aliased or anti-aliased. Aliased line rasterization uses a
fairly simple algorithm to determine which pixels are covered by a line, while anti-aliased
line rasterization performs a more sophisticated algorithm to determine how much of a
pixel is covered by a line, and then multiplies the output color for that pixel by this cov-
erage factor. Selection of aliased or non-aliased line rasterization is determined by the
AntialiasedLineEnable parameter of the rasterizer state. We will examine the details of
aliased rasterization, while leaving the anti-aliased lines. The anti-aliased line algorithm
implementation is hardware specific, and hence it does not make sense to try to interpret
in great detail here.
Aliased line rasterization is performed as follows. Instead of using a point-based
algorithm, the process starts by inscribing a diamond shape on each pixel. This is shown in
Figure 3.62. If a line's slope falls within the range -1 <= slope <= 1, it is considered to be
an x-major line. In this case, if the line itself intersects the bottom left or bottom right edge
or the bottom corner of the diamond, then the pixel is selected for fragment generation. If
Figure 3.62. Some examples of line rasterization, with the two diamond selection possibilities depicted at
the right.
Search WWH ::




Custom Search