# Re: view frustum corners with infinite projection matrix

> What does your matrix look like? Can you post an example? What results do you get,
> and why do you they they are wrong?

Ok, i have now found an error in my projection matrix. i interchanged
two components. my projection matrix now:

| 2*zNear/(2*x) 0 0 0 |
| 0 2*zNear/(2*y) 0 0 |
| 0 0 -1 -2*zNear |
| 0 0 -1 0 |

I obtain this matrix from the standard opengl projection matrix with
lim zFar -> infinite
the sourcecode for setting up the matrix:

pInf[0][1] =
pInf[0][2] =
pInf[0][3] =
pInf[1][0] =
pInf[1][2] =
pInf[1][3] =
pInf[2][0] =
pInf[2][1] =
pInf[3][0] =
pInf[3][1] =
pInf[3][3] = 0;
pInf[2][3] = -1;
pInf[0][0] = (2*zNear)/(x-(-x));
pInf[1][1] = (2*zNear)/(y-(-y));
pInf[2][2] = -1;
pInf[3][2] = -2*zNear;

glMatrixMode(GL_PROJECTION);

// set infinite projection matrix

this yields a more reasonable result as my wrong matrix before
(interchanged pInf[2][3] and pInf[2][3] so that pInf[2][3] was -2*zNear
and pInf[3][2] was -1. the old matrix brought me z-values of 199 for
the near plane and 201 for the far plane, which was not reasonable).

i now get for zNear = 1.0f
zValues of 199 for the near plane and
33554632 for the far plane which looks much better.

but why is the zValue for the near plane corners 199? should not that
be 1, because the near plane is at 1.0f?

thanks!

.

• Follow-Ups:
• References:

## Relevant Pages

• Re: wbuffer distances in wrong order
... > As for a w-friendly projection matrix, I'm not sure if it's the case. ... While other transformation matrices have a fourth ... the viewer (since the view matrix first transforms vertices into view ... the far plane. ...
(microsoft.public.win32.programmer.directx.graphics)
• Re: Render image to near plane
... What are your near and far planes set to? ... values when the z value is equal to the near plane. ... projection matrix usually result in irrational numbers that cannot be ... > scroll the image by using the world transform which is the best way in ...
(microsoft.public.win32.programmer.directx.graphics)
• Re: How to get 3D coordinates from screen coordinates?
... > coordinates, e.g., if I click in the vertices of the triangle I should get ... the near plane to the far plane defined by your projection matrix. ... When you specify a coordinate to Unproject, ... Using a perspective projection matrix, you would also find that the X and Y ...
(microsoft.public.win32.programmer.directx.managed)