Chapter 18: Look-at Matrix

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

How do we construct the matrix?

Camera Basis Vectors

U: “side”, “right”,


W: “direction”, “forward”,

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.

Camera Matrix

View Matrix

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

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