Camera

We will use a very simple camera that only requires three vectors to define: what we are looking at, which way is up, and the camera location. Given these vectors, we can compute the basis of the camera. We will define \(\mathbf{g}\) as the look vector, \(\mathbf{t}\) as the up vector, and \(\mathbf{e}\) as the position vector. The basis vectors will continue to be \(\mathbf{u}\) \(\mathbf{v}\), \(\mathbf{w}\).

If we begin by saying that the camera is oriented so that the positive x-axis goes right and the positive y-axis goes up, then we are looking down the negative z-axis. So, the look vector will point down negative z. From this we can construct the camera basis:

$$ \mathbf{w} = -\mathbf{g} $$ $$ \mathbf{u} = \mathbf{t} \times \mathbf{w} $$ $$ \mathbf{v} = \mathbf{w} \times \mathbf{u} $$

If you make sure the look and up vector are normalized before building the basis, then the resulting camera basis is orthonormal.