I have a standard 3D rendering pipeline. Let's say I have a camera looking down at a flat plane that represents the floor. (in my game, z = height, so this is a plane where z == 0), and for simplicities sake, the camera is tilted so that floor fills the entire screen (there's no horizon).
I have an unproject function, where I can provide a screen (x,y) pair and get back the point on the floor plane. Let's say I do this once for every y value on the screen. If I then project each of these points, I get the original (x,y) cordinates back, but I can also look at the w value for the projected point. This value is dependent on the height and pitch of the camera, and increases in a non linear way towards the top of the window.
My question is - can I calculate this w value per line without going through the unproject-project process for each line on the screen? The value is seemingly a function of camera height, yaw and screen y, so I feel it must be possible to obtain it directly from these three values via some alegbra.