Graphics Reference
In-Depth Information
Far plane
v
C
Near plane
Up
A
B
P
Look
u
w
f
n
Figure 13.6: The uvw frame for a camera, the look and vup vectors, and the points P , A , B ,
and C.
In writing the equations, we'll use vup and look to indicate the up vector
and look direction, respectively; these shorter names make the equations more
comprehensible. The point P is just a shorter name for the camera's Position .
We'll build the orthonormal basis, u , v , w , in reverse order. First, w is a unit
vector pointing opposite the look direction, so
w =
look
= S ( look ) .
(13.2)
look
To construct v , we first project vup onto the plane perpendicular to w , and
hence perpendicular to the look direction as well, and then adjust its length:
v = vup
( vup
·
w ) w
(13.3)
v
v =
= S ( v ) .
(13.4)
v
Finally, to create a right-handed coordinate system, we let
u = v
×
w .
(13.5)
Inline Exercise 13.1: Some camera software (like Direct3D, but not OpenGL)
starts by letting w = S ( look ) , without negation.
(a) Show that this makes no difference in the computation of v .
(b) Show that in this case, if we want u , v to retain the same orientation on the
view plane (i.e., u pointing right, v pointing up), then the computation of u
becomes u = w
v .
(c) Is the resultant uvw -coordinate system right- or left-handed?
×
Now we'll compute the four points P , A , B , and C . The only subtlety con-
cerns determining the length of edges AB and AC . The edge AB subtends half the
horizontal field of view at P , and is at distance f from P ,so
tan θ h
2
= AB
f
, so
(13.6)
AB = f tan θ h
2
,
(13.7)
θ h denotes the horizontal field of view angle, converted to radians,
θ h = FieldOfView 180 ,
where
(13.8)
 
 
Search WWH ::




Custom Search