Wrong depth in depth pass

I’m currently working on my first blender project and am now encountering something I don’t have an explanation for. It’s a garden scene and I want to use the depth pass (denoising depth) to brighten up the most distant parts of my render, like a volume or mist effect without the heavy renderload a volume scatter would cost.

1: This is the beauty picture without the effect applied.
2: This is the part of the image where it gets weird when I apply the depth pass.
3: The depth pass has a wrong depth at this point. This tree is the one farthest away from the camera, yet for some reason that I’m unaware of it gets a depth value like let’s say the furniture on the wooden deck more towards the camera. Hence it appears way to dark for its distance and breaks the effect in the composite.

The tree itself is part of a geo-scatter biome scatter, but I don’t see how this should be a problem.

4: That’s how I apply the effect.

5: Alternatively I tried using a mist pass but this has the problem that the sky is completely white (because it’s the farthest away) which would apply the mist effect over my entire sky which is not what I’m looking for.

If someone has an idea of what might be causing this, I’d be more than grateful for some tipps :slight_smile: Thanks so much in advance and cheers, Merlz.

You could simply invert this and use it in your effect!

Use a color ramp after the mist pass. You can add more stops to it an adjust the brightness of your mistpass to your requirements.

Thanks for your suggestion Sid. If I invert the depth pass, the sky turns black that’s correct but it means the foreground turns white, and now the fog gets applied to the foreground instead of the background.

Thank you for the tip Lumpengnom. It did the trick, even though I get quite nasty white seams (this might be to the low resolution I did for the test renders). No idea why the problem existed in the first place but as a workaround this works for me, thank you :slight_smile:

Quite frankly, GPUs have become so fast that I ususally just drop in a volume. Costs some more render time, sure but it also saves artist time because you don’t have to deal with this kind of nonsense.

I gotta put more time in understanding how to control the volume more precisely and do an optimization pass of my scene. In 300% it takes 55 minutes to render it with a volume applied on my 3090.

300% of what?

I just saw that you were using the denoising depth. I am not sure if this is the correct way to use it. I think it is only there for denoising purposes.
Have you tried using the z-depth?

As for the mist pass having white seams: Not sure why that is the case. It appears that most of your foreground is complete black. Are you aware that you can set the mist pass range in the World properties panel? It is hidden in a not that discoverable place and only turns visible ony you have enabled the mist pass.
Or perhaps you have to denoise the mist pass first. As mentioned above, I haven’t worked with mist and depth passes for a while.

I couldn’t find the z-depth render layer so I used what I had haha. And true, I’m overwhelmed by all the different approaches and setting the mist distance to mainly affect my background is of course the smartest approach.

I meant 300% rendering of 1920x1080p.

Ok, now just be aware that the z-depth and the mist pass are a bit different. The mist pass goes from 0 to 1 according to the distance you set in the world properties panel mentioned above.

The z-depth does not range from 0 to 1. It simply returns the distance in Blender units of each pixel to the camera.
If you want to work with it you have to normalize it in post with the normalize node.

This however, can lead to problems, esspecially in animations. If you normalize the z-depth it will be turned the z-depths range into a range from 0 to 1. But this means, that if in an animation something enters the view that is more distant this new maximum range will be normalized. So a pixel that might be normalized to 0.7 in one frame might be normalized to 0.3 in the next frame.
For still images this ususally does not matter that much but it is still usefull to be aware of it.