A027298

08-20-2003, 05:24 AM

After perfoming the projection matrix, those vertices which where before in the eye's frustum are now in the unit cube. The vertices near the back plane are very near to the unit cube back side, the ones which are close to the near plane are very near to the unit cubes front plane. Is that right? If I program a small example like:

Matrix4x4 M;

M.identity();

M.perspective(60.0f, 1.0f, 1.0f, 20.0f);

M.lookat(10.0f, 10.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);

Vector v1[100][100];

Vector v2[100][100];

for(int i = 0; i < 100; i++)

for(int j = 0; j < 100; j++) {

v1[i][j] = GTvector((gtFloat)i - 50.0f, 0.0f, (gtFloat)j - 50.0f);

v2[i][j] *= M;

}

...the z-values after projection in v2 are all very close together. No one is negative, they are all very close to the front plane of the unit cube. Where is the mistake? The corners of the unit cube where previously the corners of the frustum, they are on its right place, but everything inside is badly squeezed to the front plan of the unit cube. Can someone clarify that issue for me?

Thanks

[This message has been edited by A027298 (edited 08-20-2003).]

Matrix4x4 M;

M.identity();

M.perspective(60.0f, 1.0f, 1.0f, 20.0f);

M.lookat(10.0f, 10.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);

Vector v1[100][100];

Vector v2[100][100];

for(int i = 0; i < 100; i++)

for(int j = 0; j < 100; j++) {

v1[i][j] = GTvector((gtFloat)i - 50.0f, 0.0f, (gtFloat)j - 50.0f);

v2[i][j] *= M;

}

...the z-values after projection in v2 are all very close together. No one is negative, they are all very close to the front plane of the unit cube. Where is the mistake? The corners of the unit cube where previously the corners of the frustum, they are on its right place, but everything inside is badly squeezed to the front plan of the unit cube. Can someone clarify that issue for me?

Thanks

[This message has been edited by A027298 (edited 08-20-2003).]