Graphics Reference
In-Depth Information
1
E
5
(0, 0, 0)
1
1
5
2
5
0
6
9
6
0.5
2
8
10
0
Y
0
2
1
4
3
4
3
0
2
0.5
7
11
1
7
2
2
1
3
2 1
Z
4
0
5
X
1
Figure 3.6: The labels for the vertices and edges of our cube model. Edge indices are in
circles. The eyepoint and frame from the Dürer woodcut are also included, although we
have chosen to adjust their relative positions by placing the frame in this case so that it
extends from
2 to 1 2 in both x and y. Thus, we're viewing the cube “at eye level” rather
than “from above,” as Dürer viewed the lute.
1
E
1
0
Y
0
2
2 1
2
1
4
Z
0
1
X
Figure 3.7: The result of the rendering algorithm, (a) shown in place (i.e., drawn in the
frame), with rays from the eye to the four near corners of the cube shown, projecting those
corners onto the picture plane, and (b) seen directly, with the surrounding square (which
ranges from
1
2 to
1
2 in both x and y) drawn to give context.
This enhanced model is shown in Figure 3.6.
Now let's determine a method for drawing this enhanced representation. To
update our algorithm to a version that draws lines, we have to make a choice.
Do we iterate through the edges, and for each edge, compute where its endpoints
project, and then connect them with a line? Or do we iterate through the vertices
first, computing where each vertex projects, and then iterate through the edges,
using the precomputed projected vertices? Since each vertex is shared by three
edges, the first strategy involves three times as many projection computations;
the second involves three times as many data-structure accesses. For such a small
model, the performance difference is insignificant. For larger models, these are
important tradeoffs; the “right” answer can depend on whether the work is done in
hardware or in software, and if in hardware, the precise structure of the hardware,
as we'll see in later chapters. We'll use the second approach, but the first is
equally viable. The results of this approach to rendering the cube are shown in
Figure 3.7, both in 3-space and in the plane of the frame.
Furthermore, there's another problem: When we were transforming only
points, we could perform clipping on a point-by-point basis. But now that we plan
to draw edges, we have to do something if one endpoint is inside and the other
Search WWH ::




Custom Search