Lecture 18: Lookat Matrix
glm::lookat(vec3 eye, vec3 center, vec3 up)
- with only
eye
andcenter
, infinite possibilities up
tells us which one
How do we construct the matrix?
Camera Basis Vectors
U: “side”, “right”,
V:
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: