PDA

View Full Version : zbuffer to range measure?



pixelpusher
03-17-2004, 09:20 AM
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

dorbie
03-18-2004, 10:57 AM
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.