For my project, I save rgb frames (PNG format) and the depth maps (EXR format) for different camera views. The compositor setup I use is shown here enter image description here and I use Cycles. When I read the raw depth values, for plane surfaces like paintings or glass surface the depth map has sporadic, or clusters of, very large values like 10^10 among a region of foreground pixels with low depth values. enter image description here Screenshot of raw depth values read in python Why does blender render these certain pixels as background, when they actually belong to a foreground object? This renders the depth map inaccurate. Is there a better, accurate way to obtain depth maps from blender?

Edit: The link to a blend file where I saw this.


1 Answer 1


It's hard to say for sure without seeing the file.

But I believe you're probably seeing places where the reflections shoot off into infinity.

Let's think about glass, which is one place where you mentioned problems. A ray either goes through the glass or reflects from the glass. You can get vastly differing depths depending on which it does. The depth needs to take into account the reflection for purposes of misting, DoF, etc (think a mirror). But there's no sense in mixing depths-- you're not going to get something more right by averaging the depth through and the depth reflected, you're just going to get something completely wrong. Blender has to pick between reflected depth and refracted depth, and where it changes its pick, you have a discontinuity.

What's the solution? I've asked around and not heard any suggestions. If you want your depth to a surface, you can render an Eevee depth map, which won't have this behavior. You could also consider using multiple render layers, perhaps with material AOV outputs that would let you specify flat depth, reflected depth, or refracted/transparent depth. But yes, these are frustrating solutions in that they can potentially add a lot of render time and complexity.

  • $\begingroup$ Thanks, this explanation makes sense. Regarding rendering depths with, possibly, Eevee, is it possible that it will introduce errors in other regions where I previously had not any errors? I.e, is eevee error-free? $\endgroup$ Commented Apr 11, 2021 at 12:31
  • $\begingroup$ Also, how does blender choose between reflected and refracted depth? $\endgroup$ Commented Apr 11, 2021 at 13:35
  • $\begingroup$ @VjayalakshmiK Eevee depth map and Cycles AOV depth material should be same, but untested. Cycles probably choose between depths on the basis of which component (glossy, refraction, diffuse et al) has the strongest influence on the sample (mix glossy->refraction at 0.6 probably gives refracted depth.) $\endgroup$
    – Nathan
    Commented Apr 11, 2021 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .