Cycles Z-Depth does not conform to the standard Z-Depth output used in other renders

I checked the Cycles Z-Depth, studying it to use in conjunction with ouputs from other engines, in a mixed piepeline, and I was surprised to see that Cycles Z-Depth works differently to the other most user render engines out there.

While other engines project the Z-Depth from the film plane, which gives us a linear distance of the scence towards the camera, it seems Cycles uses a pinhole system, which gives a distorted version of the Z-depth, because it’s an spherical projection.

I’m not saying that this is inherently wrong, but makes very difficult to integrate cycles in a mixed pipeline.

Since there is an effort for adopting some industry standards in Blender, like the “Industry Standard” keymap, could be good to have the Z-Depth all other engines use out there.

It’s also interesting that this Z-Depth that we require is already given by Eevee.

Let me show the examples, this is the “correct” Z-depth, the expected one that works in general with any compositing software and in a mixed pipeline, in this case this is Eevee:

And this is the “incorrect” one, that makes very difficult to mix outputs in general, even mixing with eevee could be problematic:

As you can see this is distorted.

This may be a not-so-big effort (it is for me, but from what is said by others here, it’s a trigonometric calculus) so could be great, maybe not replace the Z-Depth as it is right now, but add a Linear Z-Depth option to the passes, so the user can choose which kind of Z-Depth wants, because right now it’s impossible to extract a compatible Z-Depth with Cycles, a Linear one.

As a side not, doing another render with eevee is not an option, it’s ok for a simple scene, but it’s not ok for a production scene with a large amount of instances, and hundreds of millions of polygons.

@dfelinto @brecht @lukasstockner97 what do you think?


yeah this is actually a ‘mist’ pass as it was called in BI (literally distance from camera as opposed to distance along the camera forward axis)


You have to manually save out an AOV.
This is what you are looking for:
Shader Editor - Input - Camera Data - View Z Depth
Its a shame that you have to do that manually, its the same for a position pass (cant believe a such a common used pass is not a standard option). Hope this improves at one point.


But is that a valid solution?

That’s shader related, how do you do that at a scene level without rendering everything twice? We cannot have each shader with a custom AOV pass configured, that would be madness


One possible solution could be to enable a slot to define a specific shader for a custom AOV

What i usually do is to have one multi-purpuse group at the end of each material.
This group can be empty where each material just get piped through, or it can be used to add custom aov passes for all your materials at once, or you can use it for overriding all your materials with a diffuse shader, or you can use it to add fake atmospheric fog to your shaders, …

Im not saying this is the most elegant solution but this worked for me in the past. Just make sure you have your multi-purpuse group attached at the end of each material since the beginning of your project so you dont have to go through all your materials at the end, then its pretty comfortable to use. One could also make a script that makes sure such a group is attached to every material in the scene.

I’d love to have a proper native solution from Blender though :slight_smile:

That’s a possible technique, but again a non-valid one, it’s jumping through hoops, something we cannot afford when we work against a deadline, with some library materials, continuously changing assets, etc… in a long term project… maybe, in a short term project, it’s not a solution at all.

I think the easiest, and maybe most valid solution would be to have custom AOV slots that can be filled with shaders, that may work and maybe it’s easier, not sure from the devs perspective

1 Like

For sure, i’d welcome that! That would be the most straight forward solution.

But until then, i think, inserting a group at the end (probably in an automatic way) IS a valid solution.
Whats your alternative? Stop using Blender?

Changing the depth pass to be more standard and adding a position pass is planned.


cheers, brecht always to the rescue

Awesome @brecht

Thanks :slight_smile:

Oh, thanks! Please! We need a Z-Depth that works with transparency, transmission, SSS, volume…
Thanks for working on this!

1 Like

@EvertonSchneider keep in mind that this thread is 2 years old, we already have a position pass, the Z-Depth was improved and made compatible with other render engines if I recall correctly, but the Z-Depth and the Mist are still not working well with transparency and other things, but I’m not entirely sure.
However I’m not sure how would be a Z-Depth that works with transmission? I don’t remember the Z-Depth working well in such cases in other engines, because how would you treat the Z behind a glass with an IOR of 1.8 for example?
It’s a bigger problem than what it seems I think.


I have a different render layer for Z-depth. The despeckle node used to fix that but since its not a standard solution, I just go with a diffuse material override and render that at 1 sample to get the clean z-depth.