- Code: Select all
`screenx = x /(z/d - cz)`

cz is the z of the camera

and d is the distance from the screen which is the same as tan(fov_angle/2).

Then instead of finding the z of the back edge we'll assume it's 2 and solve for cz and d.

The math worked out to be:

screenx = x/((z-1)*(BottomWidth/TopWidth)+1)

Actually I had a -1 in there so some reason which was throwing it off until I removed it.

I updated my example in my first post. Click to switch between the old method and the new. The new matches the grid much better when the fov is different.