Exclude atmosphere from ZDepth?

I’ve been searching for a while without much luck. I need a really simple thing:

A clean ZDepth pass to use for DOF in post.

My scene has environment fog and I can’t seem to achieve it.
Atmosphere affects it and makes the zdepth turn white again in the far background which seems like the complete opposite of what a zdepth pass is supposed to do.

Is there a solution? Or am I stuck rendering another full pass with atmosphere off and all objects set to mattes? We’re a small studio and this extra render overhead is not ideal.

Surely there’s a way to just get a straight white foreground to black background with a zdepth in this situation? The ZDepth is not even picking up the mountains I have in the background because of it.

Cheers!

(Vray Next + 3ds Max 2020)

Yes, good thing - I was wondering once about that either… any hints?

You may try disabling the Z-Depth RE filtering and increase the min. subdivs of the image sampler.

Thanks for replying Aleksander, but where is Z-depth RE filtering? I’ve never seen or heard of it?

Open the Render Elements tab in the render settings, click on the Z-Depth pass and below there should be a ‘Selected render elements parameters’ graph - in it there is a checkbox called ‘Enable filtering’.

That actually worked! Thanks Aleksandar.

By Autodesk’s definition that checkbox simply turns anti-aliasing on or off.
I would never in a million years have thought to un-check that to get a clean Zdepth (albeit now with no anti-aliasing which is adding a new problem to the mix)

I would propose that the Zdepth parameters should have its own checkbox that “excludes atmosphere” so it actually makes sense to users and isn’t a big mystery.
Or at least add this “fix” to the actual Zdepth help page.

Thanks again.