McLovin
McLovin

Reputation: 3415

OpenGL camera direction

So I was reading this tutorial's "Inverting the Camera Orientation Matrix" section and I don't understand why, when calculating the camera's up direction, I need to multiply the inverse of orientation by the up direction vector, and not just orientation.

I drew the following image to illustrate my insight of the tutorial I read. What did I get wrong?

enter image description here

Upvotes: 3

Views: 2302

Answers (1)

derhass
derhass

Reputation: 45362

Well, that tutorial explicitely states:

The way we calculate the up direction of the camera is by taking the "directly upwards" unit vector (0,1,0) and "unrotate" it by using the inverse of the camera's orientation matrix. Or, to explain it differently, the up direction is always (0,1,0) after the camera rotation has been applied, so we multiply (0,1,0) by the inverse rotation, which gives us the up direction before the camera rotation was applied.

The up direction which is calculated here is the up direction in world space. In eye space, the up vector is (0,1,0) (by convention, one could define it differently). As the view matrix will transform coordinates from world space to eye space, we need to use the inverse to transform that up vector from eye space to the world space. Your image is wrong as it does not correctly relate to eye and world space.

Upvotes: 2

Related Questions