Original Post
Hello everyone!
I'm a new member of this forum despite the fact that I was registered here long time ago.
So..
All matrix will be OpenGL matrices (not DX)
I would like to tell a little about the View matrix. The model-view matrix consists of Model matrix and View. So I need the second one.
Now I'm reading a book about 3D programming..
And the view matrix is represented like this:
u[sub]x[/sub] u[sub]y[/sub] u[sub]z[/sub] d[sub]x[/sub]
v[sub]x[/sub] v[sub]y[/sub] v[sub]z[/sub] d[sub]y[/sub]
n[sub]x[/sub] n[sub]y[/sub] n[sub]z[/sub] d[sub]z[/sub]
0 0 0 1
where u, v, n - are the normalized vectors of the camera that are representing the coordinate system of the camera.
d - is the translation vector
So I understand that we need to multiply model matrix to a View Matrix to translate World coordinates of some object into Camera coordinates.
But..
I can't understand why u, v, n is in rows, not in columns? I mean that the matrix should be:
u[sub]x[/sub] v[sub]x[/sub] n[sub]x[/sub] d[sub]x[/sub]
u[sub]y[/sub] v[sub]y[/sub] n[sub]y[/sub] d[sub]y[/sub]
u[sub]z[/sub] v[sub]z[/sub] n[sub]z[/sub] d[sub]z[/sub]
0 0 0 1
Why am I think so ?
Let imagine that we have some point that have it own transformation matrix. This point P will be:
P = v + P*i + P*j + P*k;
v - origin,
i,j,k - are orthogonal vectors-columns.
i = (1, 0, 0, 0)[sup]T[/sup]
j = (0, 1, 0, 0)[sup]T[/sup]
k = (0, 0, 1, 0)[sup]T[/sup]
v - (v[sub]x, [/sub]v[sub]y, [/sub]v[sub]z[/sub], 1)[sup]T[/sup]
The last number tells us what is it: vector or point.. if it equals to 0 hence it vector (because it is haven't origin), if 1 then it is a point.
So the final matrix would be:
1 0 0 v[sub]x[/sub]
0 1 0 v[sub]y[/sub]
0 0 1 v[sub]z[/sub]
0 0 0 1
And this is logically ok.
But, looking at the view matrix I can't see any logic..
Could onyone help me to understand what is wrong about my argumentation ?
Thank you.
Pardon for my English. It is not perfect, but I'm working on it. =)
I'm a new member of this forum despite the fact that I was registered here long time ago.
So..
All matrix will be OpenGL matrices (not DX)
I would like to tell a little about the View matrix. The model-view matrix consists of Model matrix and View. So I need the second one.
Now I'm reading a book about 3D programming..
And the view matrix is represented like this:
u[sub]x[/sub] u[sub]y[/sub] u[sub]z[/sub] d[sub]x[/sub]
v[sub]x[/sub] v[sub]y[/sub] v[sub]z[/sub] d[sub]y[/sub]
n[sub]x[/sub] n[sub]y[/sub] n[sub]z[/sub] d[sub]z[/sub]
0 0 0 1
where u, v, n - are the normalized vectors of the camera that are representing the coordinate system of the camera.
d - is the translation vector
So I understand that we need to multiply model matrix to a View Matrix to translate World coordinates of some object into Camera coordinates.
But..
I can't understand why u, v, n is in rows, not in columns? I mean that the matrix should be:
u[sub]x[/sub] v[sub]x[/sub] n[sub]x[/sub] d[sub]x[/sub]
u[sub]y[/sub] v[sub]y[/sub] n[sub]y[/sub] d[sub]y[/sub]
u[sub]z[/sub] v[sub]z[/sub] n[sub]z[/sub] d[sub]z[/sub]
0 0 0 1
Why am I think so ?
Let imagine that we have some point that have it own transformation matrix. This point P will be:
P = v + P*i + P*j + P*k;
v - origin,
i,j,k - are orthogonal vectors-columns.
i = (1, 0, 0, 0)[sup]T[/sup]
j = (0, 1, 0, 0)[sup]T[/sup]
k = (0, 0, 1, 0)[sup]T[/sup]
v - (v[sub]x, [/sub]v[sub]y, [/sub]v[sub]z[/sub], 1)[sup]T[/sup]
The last number tells us what is it: vector or point.. if it equals to 0 hence it vector (because it is haven't origin), if 1 then it is a point.
So the final matrix would be:
1 0 0 v[sub]x[/sub]
0 1 0 v[sub]y[/sub]
0 0 1 v[sub]z[/sub]
0 0 0 1
And this is logically ok.
But, looking at the view matrix I can't see any logic..
Could onyone help me to understand what is wrong about my argumentation ?
Thank you.
Pardon for my English. It is not perfect, but I'm working on it. =)
