Camera & View Matrix
How the lookAt function maps world coordinate systems into local camera space.
Camera Coordinate Axes
Given eye ($E$), target center ($C$), and up ($U$), the camera system axes are:
- Forward vector: $F = \frac{C - E}{\|C - E\|}$
- Right vector: $R = \frac{F \times U}{\|F \times U\|}$
- Orthogonal Up: $U' = R \times F$
The View Matrix
The resulting matrix combines translation and rotation into camera space. The composite matrix $V$ maps world coordinates into camera-relative locations: $$V = \begin{bmatrix} R_x & R_y & R_z & -R \cdot E \\ U'_x & U'_y & U'_z & -U' \cdot E \\ -F_x & -F_y & -F_z & F \cdot E \\ 0 & 0 & 0 & 1 \end{bmatrix}$$
Ready to Visualize Camera Views?
Launch our interactive visualizer to step through calculations in real-time.
Launch Camera Visualizer →