i
i
i
i
i
i
i
i
74 4. Ray Tracing
Figure 4.7. The sample points on the screen are mapped to a similar array on the 3D
window. A viewing ray is sent to each of these locations.
All of our ray-generation methods start from an orthonormal coordinate frame
known as the camera frame, which we’ll denote by e, for the eye point, or view-
point, and u, v,andw for the three basis vectors, organized with u pointing right-
up
view
u
v
w
Figure 4.8. The vectors of
the camera frame, together
with the view direction and
up direction. The w vec-
tor is opposite the view di-
rection, and the v vector is
coplanar with w and the up
vector.
ward (from the camera’s view), v pointing upward, and w pointing backward, so
that {u, v, w} forms a right-handed coordinate system. The most common way
to construct the camera frame is from the viewpoint, which becomes e,theview
direction,whichis−w,andtheup vector, which is used to construct a basis that
has v and w in the plane defined by the view direction and the up direction, using
Since v and w have to be
perpendicular, the up vec-
tor and v are not generally
the same. But setting the
up vector to point straight
upward in the scene will ori-
ent the camera in the way
we would think of as “up-
right.”
the process for constructing an orthonormal basis from two vectors described in
Section 2.4.7.
4.3.1 Orthographic Views
For an orthographic view, all the rays will have the direction −w. Even though
a parallel view doesn’t have a viewpoint per se, we can still use the origin of the
It might seem logical that
orthographic viewing rays
should start from infinitely
far away, but then it would
not be possible to make or-
thographic views of an ob-
ject inside a room, for in-
stance.
camera frame to define the plane where the rays start, so that it’s possible for
objects to be behind the camera.
The viewing rays should start on the plane defined by the point e and the
vectors u and v; the only remaining information required is where on the plane the
image is supposed to be. We’ll define the image dimensions with four numbers,
for the four sides of the image: l and r are the positions of the left and right
edges of the image, as measured from e along the u direction; and b and t are the
Many systems assume that
l
=–
r
and
b
=–
t
so that a
width and a height suffice.
positions of the bottom and top edges of the image, as measured from e along the
v direction. Usually l<0 <rand b<0 <t. (See Figure 4.9.)
In Section 3.2 we discussed pixel coordinates in an image. To fitanimage
with n
x
× n
y
pixels into a rectangle of size (r − l) × (t − b), the pixels are
spaced a distance (r − l)/n
x
apart horizontally and (t − b)/n
y
apart vertically,