Game Development Reference
In-Depth Information
Figure 12.2: The transformation from world space to view space. This
transformation transforms the camera to the origin of the system looking
down the positive z-axis. Notice that the objects in space are transformed
along with the camera so that the camera's view of the world remains the
same.
Therefore, we want a transformation matrix V such that:
pV = (0, 0, 0)—The matrix V transforms the camera to the origin.
rV = (1, 0, 0)—The matrix V aligns the right vector with the world
x-axis.
uV = (0, 1, 0)—The matrix V aligns the up vector with the world
y-axis.
dV = (0, 0, 1)—The matrix V aligns the look vector with the world
z-axis.
We can divide the task of finding such a matrix into two parts: 1) a
translation part that takes the camera's position to the origin and 2) a
rotation part that aligns the camera vectors with the world's axes.
12.2.1.1 Part 1: Translation
The translation that takes p to the origin is easily given by - p , since
p - p = 0 . So we can describe the translation part of the view transfor-
mation with the following matrix:
1
0
0
0
0
1
0
0
T
0
0
1
0
p
p
p
1
x
y
z
Search WWH ::




Custom Search