Graphics Reference
In-Depth Information
computation that produced the RGB triple at the vertices would be prohibitive if
carried out for every interior point).
In the 1980s, when raster graphics (pixel-based graphics) technology was new,
scanline rendering was popular. In scanline rendering, each horizontal line of the
screen was treated individually, and all the triangles that met a line were pro-
cessed to produce a row of pixel values, after which the renderer moved on to the
next line. Usually the new scanline intersected many of the same triangles as the
previous one, and so lots of data reuse was possible. Figure 9.7 shows a typical
situation: At row 3, only the orange pixel meets the triangle; at row 4, the two
blue pixels do. At row 6, the four gray pixels meet the triangle, and after that the
intersecting span begins to shrink.
1
3
5
7
9
11
Figure 9.7: The processing of
a single triangle by a scanline
renderer.
One scheme that was used for interpolating RGB triples was to interpolate the
vertex values along each edge of the triangle, and then to interpolate these across
each scanline.
It's not difficult to show that this results in the same interpolant as the barycen-
tric method we described (see Exercise 9.4).
But now suppose that we apply this method to a more interesting shape, like
a quadrilateral. It's easy to see that the two congruent squares in Figure 9.8, with
gray values of 0, 40, 0, and 40 (in a range of 0 to 40) assigned to their vertices in
clockwise order, lead to different interpolated values for the points P and P ,the
first being 20 and the second being 40.
The interpolated values in each configuration look decent, but when one makes
an animation by rotating a shape, the interior coloring or shading seems to “swim”
in a way that's very distracting.
What went wrong?
The problem was to infer values at the interior points of a polygon, given val-
ues at the vertices. But the solution depends on something unrelated to the prob-
lem, namely the scanlines in the output; this dependence shows up as an artifact
in the results. The difficulty is that the solution is not based on the mathematics
and physics of the problem, but rather on the computational constraints on the
solution . When you limit the class of solutions that you're willing to examine a
priori, there's always a chance that the best solution will be excluded. Of course,
sometimes there's a good reason to constrain the allowable solutions, but in
0
0
40
40
P
40
P
9
40
0
0
Figure 9.8: The congruent squares in these two renderings have the same gray values at
corresponding vertices, but the scanline-interpolated gray values at P and P differ.
 
 
Search WWH ::




Custom Search