I have a quick question for you experts.

I'm using gluUnProject, which is great. And commonly people would use glReadPixels with the GL_DEPTH_COMPONENT to find the viewing volume z value to feed to gluUnProject to determine a 3D point.

My problem is, I want the z value where the projected ray intercepts the Z-plane, and not the object obstructing it. -For example a bunch of trees. ReadPixel would stop once it hit the tree in the depth component look up. -I need the ray to pass through the tree and stop when the z in the viewing volume touches the Z plane (zero) of OGL space.

Put simply, I need the "ground" unprojected, not the stuff on it.

I guess I need to use something other than glReadPixels to find viewing volume z of the Z plane?

Any ideas?

Thanks very much,