Zbuffer not matching Depth Channel

Long story short: Using ShowZBuffer shows a good depth map. In the render window, if the ground plane is turned on, the depth channel gets ruined which means I can’t use depth of field. I do want the ground plane on to get some shadows.

ZBuffer:

In render window when ground plane is on:

The ground plane is an object, so turns up in Rhino Render depth channel. Additionally ShowZBuffer and the Render Window depth channel visualization show an inverted version (whiter is closer to camera), where the Rhino Render depth channel records distance to camera on model units.

You could turn on Object ID channel and then mask out the ground plane with its object id as the mask.