Screen Z coordinate

Hi All,

I can’t find any more the formula to correctly specify the winZ parameter of gluUnproject().

Suppose that the winX,winY are 20,40 while winZ (must be in the range 0-1) is located at 200 from the camera.

I know that there is a formula to use to transform 200 to 0.32 (for example) that looks something like: fz - (far-near)/(2farnear) etc.

Can you help my to find it?

Thanks so much.


I suppose this is what you’re looking for…