Original Post
This could have been posted in graphics programming, directX, or math, but I'm choosing math because of the levels of sentience in here. I've only used one type of matrix row/column setup, and I'm not sure of their individual titles. But the matrix I use is set up like this:
R = Right
U = Up
F = Forward
T = Translation
R.x R.y R.z 0
U.x U.y U.z 0
F.x F.y F.z 0
T.x T.y T.z 1
My normal projection matrix is constructed in this way:
float aspect = ScreenWidth / ScreenHeight;
float w = cosf( FOV / 2 ) / sinf( FOV / 2 );
float h = w * aspect;
float ff = FarPlaneDistance / ( FarPlaneDistance - NearPlaneDistance );
float tf = -ff * NearPlaneDistance;
Matrix:
w 0 0 0
0 h 0 0
0 0 ff 1
0 0 tf 0
My goal is to render something, something that is in normal world-space, and has a normal world-space transform matrix, but to have it write the highest z-buffer values possible to the depth buffer. After playing around a little, I've come up with this projection matrix:
float aspect = ScreenWidth / ScreenHeight;
float w = cosf( FOV / 2 ) / sinf( FOV / 2 );
float h = w * aspect;
Matrix:
w 0 0 0
0 h 0 0
0 0 1 1
0 0 0 0
I don't completely understand what effect this is having. But if I disable z-testing (disable z-reading, but leave z-writing on), it seems to render the object at really high z values (I'm guessing >= 0.99, maybe even 1.0), no matter where it actually is on the screen. Another thing I really liked was the fact that the object is never clipped when it gets really far away. In my vertex shader, vertices are mutlipied by [world_matrix * view_matrix * proj_matrix]. If I were to guess, I would say that FF->1 is a z scaler, which is scaling rendered objects throughout the entire z distance with a value of 1. And that TF->0 is the z translation, where 0 is forcing objects to appear as though they are smashed onto the screen. Is this way off? I'm interested in understanding this better. And most importantly, knowing about any problems I could run into with other graphics cards or drivers. Thanks for any help!