When I use a standard surface shader with a matte plugged into cutout opacity, I get a z-depth pass where that opacity is ignored. Therefore the z-depth pass is not usable for post DOF as the areas behind the object will not be blurred. Is it possible to get a correct z-depth pass with cutout opacity? Or does anybody know a workaround for that?
As far as I know, the z-depth AOV only considers geometry attributes and not material attributes. So unfortunately opacity won't carry over.
Depending on how complicated your scene is, you could try setting up multiple Takes (foreground, mid-ground, background) and composite them all back together again in your preferred compositor. You could rebuild a complete z-depth pass by compositing the z-depth AOVs of each separate Take by using the alphas of the beauty passes (or custom masks... whichever you prefer) to cut each z-depth layer out.
@Sabine Füreder You can go with Deep exr workflow or create a sampler info node and connect point camera to a surface shader's color input and you get the camera info