4
$\begingroup$

If I check the world-matrix of a camera, that views the default cube from the negative world y-axis location:(0, -6, 0) I see

[1, 0,  0,  0]
|0, 0, -1, -6|
|0, 1,  0,  0|
[0, 0,  0,  1]

Can someone help me interpret the matrix? I understand the translation part, but which axes define the projection plane? I'm viewing in the world y-axis direction so the camera z-axis points there, but I expected camera z-axis to be the world -y-axis and camera x-axis to stay aligned with the world x-axis (true) and the camera y-axis to be aligned with the world z-axis.

In short, with blender, cameras we are viewing in the camera z-axis and we need to negate the camera y-axis to obtain the proper projection plane axes (we leave the camera x-axis alone)? I guess the camera arrow defines the camera "up" direction?

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

The solution is so obvious, I must be getting old :( Anyway, the world matrix of the camera is a transformation matrix, not a viewing matrix. To obtain a viewing matrix out of it, you need to invert (transpose) it and zero out the translation part.

Explanation:

We set all Euler angles of the camera to 0, so the local axes are aligned with the world axes (the "identity", non-transformed camera): "identity" camera We see, that this camera is viewing in the negative local z direction, if we rotate by 90 degrees around the x axis we get the picture in the question. The columns of the world matrix being the transformed axes of the "identity" camera:

x column: [1,  0, 0]
y column: [0,  0, 1]
z column: [0, -1, 0]

To obtain a viewing matrix of the camera (for OpenGL, say), we need to transpose (write the columns as rows) and set the translation part to 0:

[1,  0, 0,  0]
|0,  0, 1,  0|
|0, -1, 0,  0|
[0,  0, 0,  1]

we can see the projection plane is formed by the world x- and z-axes, the local z-axis of the camera is aligned with the world -y-axis, but we view along the negative camera z direction, hence the world y-axis and so can see the cube.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .