Hi,

I'm reading the depth buffer to enable me to calculate the range to any pixel in the screen. I'm want to ajust the z values from [0,1] to real-world depths. I can then multiply these by the corresponding precomputed scale factor to give the range. Can anyone tell me how these depth buffer values could be adjusted to real-world depths? Am I right to assume that 0.0 is coincident with the near clipping plane and 1.0 with the far clipping plane - thus I simply need to multiply by (far-near)?

Cheers for any pointers.Code :// read the depth map from the framebuffer normalizing on the way glPixelTransferf(GL_DEPTH_SCALE, 1.0); glPixelTransferf(GL_DEPTH_BIAS, 0.0); glClearDepth(1.0); glReadPixels(x, y, dx, dy, GL_DEPTH_COMPONENT, GL_FLOAT, depthMap);

[This message has been edited by thelamberto (edited 07-22-2002).]