The Projection Matrix

Started by
5 comments, last by AtmaWeapon 18 years, 1 month ago
This is just a really quick question. What is the result after multiplying by the projection matrix? The Model/World and View matrices are simply transforms, rotates, and scales. The projection matrix returns something in "clip space" What exactly is stored in Z and W (3rd and 4th) component of the result. Basically vertexpos * modelviewproj = {x position on screen, y position on screen, What is this, What is this?) I know that the depth buffer is z/w ... so what is Z and what is W?!
Advertisement
It's not really valid to think about what comes out of the projection matrix, since there's an extra DOF in there. What IS valid to think about, is what comes out of the perspective division immediately afterwards. And what comes out there is the projection-space coordinates, with the reciprocal of the depth in the Z component. The W component, of course, is 1. You can find more information on this by looking up "perspective division".
Quote:And what comes out there is the projection-space coordinates, with the reciprocal of the depth in the Z component. The W component, of course, is 1.


I don't quite get what you mean. Can you elaborate further. Z does not appear to be reciprocal depth because smaller values are closer to the camera. Also z/w is the depth. This means if W is 1, then z/w = z and I know that's not the case just from experimentation.
Nevermind, I get it now. So assuming z' = z/w what will 1/z' give you? Is that depth-(zmin of the camera clipping plane)?
Pretty much.... well, scaled to the distance between the near and far clipping planes. The reason you don't want to deal directly with the depth (as opposed to its reciprocal) is that it doesn't linearly interpolate correctly in screen-space (which it needs to, for Z-buffering to work).
That makes sense. Ok, so the 1/(z/w) is the depth or rather w/z is the depth. What is this in the scale of 0-1, zmin-zmax. I can't seem to get a straight answer just by experimenting.

Basically the goal here is that I want the depth in the scale of 0-1 in a linear fashion.
That makes sense. Ok, so the 1/(z/w) is the depth or rather w/z is the depth. What is this in the scale of 0-1, zmin-zmax. I can't seem to get a straight answer just by experimenting.

Basically the goal here is that I want the depth in the scale of 0-1 in a linear fashion.

This topic is closed to new replies.

Advertisement