Why do I have multiple gradients in custom depth buffer?

Hi, I want to use Custom Depth to mask certain objects so I can use a post process material on them. Somehow, when I preview the custom depth buffer, it seems like there are multiple gradients, instead of one. This leads to the post process being shown only on parts of the mesh.

Is there a way to fix this? Can I somehow tell the custom depth gradient to become larger? The scene is very large, the shown object is about 30 meters high.

281243-poidepthbufferissuev2.gif

Gradients are for visualization purpose only.