PDA

View Full Version : Screen Z coordinate



devdept
04-17-2008, 03:21 PM
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)/(2*far*near) etc.

Can you help my to find it?

Thanks so much.

Alberto

niko
04-23-2008, 07:21 AM
I suppose this (http://www.humus.ca/temp/Linearize%20depth.txt) is what you're looking for...

/N