# Chapter 18: Look-at Matrix

glm::lookat(vec3 eye, vec3 center, vec3 up)

• with only eye and center, infinite possibilities
• up tells us which one

How do we construct the matrix?

## Camera Basis Vectors

U: “side”, “right”, $camera_x$

V: $camera_y$

W: “direction”, “forward”, $camera_z$

Actually, the W vector is the opposite of the “forward” vector of the camera. This is because we are working in a right-handed coordinate system.

### View Matrix

What we want is the view matrix, inverse of the camera matrix.

Because $U$, $V$, and $W$ are orthonormal basis vectors (and other matrix theorems etc.) the inverse of the above matrix is: