zbuffer to range measure?

I know I’ve seen a formula for converting the values returned by reading the zbuffer with glReadPixels() into distance from eyepoint. But now that I need it, I can’t find it. Can anyone point me in the right direction?

Thanks

http://www.cs.unc.edu/~hoff/techrep/openglz.html

Remember this will give you eyespace z not distance. You’ll need to compensate for tan theta if sampling off center from the view vector. Range is only equal to z if eyepace x & y are zero.