Starting from a look-at

Figure 3.15: The vector from the eye position $ e$ to a point $ p$ that it is looking at is normalized to form $ \hat{c}$ in (3.37).
\begin{figure}\centerline{\psfig{file=figs/eyeframe5.eps,width=2.3truein}}\end{figure}

For VR, the position and orientation of the eye in the virtual world are given by a tracking system and possibly controller inputs. By contrast, in computer graphics, it is common to start with a description of where the eye is located and which way it is looking. This is called a look-at, and has the following components:

  1. Position of the eye: $ e$
  2. Central looking direction of the eye: $ \hat{c}$
  3. Up direction: $ \hat{u}$.
Both $ \hat{c}$ and $ \hat{u}$ are unit vectors. The first direction $ \hat{c}$ corresponds to the center of the view. Whatever $ \hat{c}$ is pointing at should end up in the center of the display. If we want this to be a particular point $ p$ in $ {\mathbb{R}}^3$ (see Figure 3.15), then $ \hat{c}$ can be calculated as

$\displaystyle \hat{c}= {p - e \over \Vert p - e \Vert} ,$ (3.37)

in which $ \Vert\cdot\Vert$ denotes the length of a vector. The result is just the vector from $ e$ to $ p$, but normalized.

The second direction $ \hat{u}$ indicates which way is up. Imagine holding a camera out as if you are about to take a photo and then performing a roll rotation. You can make level ground appear to be slanted or even upside down in the picture. Thus, $ \hat{u}$ indicates the up direction for the virtual camera or eye.

We now construct the resulting transform $ T_{eye}$ from (3.36). The translation components are already determined by $ e$, which was given in the look-at. We need only to determine the rotation $ R_{eye}$, as expressed in (3.35). Recall from Section 3.2 that the matrix columns indicate how the coordinate axes are transformed by the matrix (refer to (3.7) and (3.8)). This simplifies the problem of determining $ R_{eye}$. Each column vector is calculated as

\begin{displaymath}\begin{split}\hat{z}&= -\hat{c} \hat{x}&= \hat{u}\times \hat{z} \hat{y}&= \hat{z}\times \hat{x}.  \end{split}\end{displaymath} (3.38)

The minus sign appears for calculating $ \hat{z}$ because the eye is looking down the negative $ z$ axis. The $ \hat{x}$ direction is calculated using the standard cross product $ \hat{z}$. For the third equation, we could use $ \hat{y}= \hat{u}$; however, $ \hat{z}\times \hat{x}$ will cleverly correct cases in which $ \hat{u}$ generally points upward but is not perpendicular to $ \hat{c}$. The unit vectors from (3.38) are substituted into (3.35) to obtain $ R_{eye}$. Thus, we have all the required information to construct $ T_{eye}$.

Steven M LaValle 2020-01-06