# Making sense of the VRayZDepth

**URL:** <https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689>\
**Category:** Issues\
**Created:** [June 16, 2022, 11:35am UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689 "2022-06-16T11:35:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![superrune](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/superrune/32/12717_2.png) [@superrune](https://forums.chaos.com/u/superrune)\
**Post date:** [June 16, 2022, 11:35am UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/1 "2022-06-16T11:35:37Z")

</div>

Hi, I am writing an exporter that combines 3ds Max scene data and information from VRayZDepth to an image processing software. It needs accurate Z-depth values in order to do this correctly. To my surprise, the values rendered by VRayZDepth are inconsistent compared to both the 3ds Max scene and other renderers. An object with a distance of 100 renders with a depth value of 100 in both Corona and Redshift, but in V-Ray this value is instead 0.5. Does anyone know the reason for this, and what unit system V-Ray use when rendering VRayZDepth? Is there a way to change this? I hope someone here can help me out.

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [June 16, 2022, 11:51am UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/2 "2022-06-16T11:51:38Z")

</div>

You have two ways to get the exact distance in units.  
The Z-Depth set up as shown, or the pPos in camera space, for which you’d only use the Z (inverted.)

 ![zee.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/8/4/8438df1ea8d3602bb8c2add4e57277c00c566b64.png)  
 ![ppos.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/6/b/6bb8c64da6fd0b1cc0a8e56ad54d2ee53497fa67.png)

---

<div class="post-metadata">

**Author:** ![superrune](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/superrune/32/12717_2.png) [@superrune](https://forums.chaos.com/u/superrune)\
**Post date:** [June 22, 2022, 10:09pm UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/3 "2022-06-22T22:09:15Z")

</div>

Thanks! I will try pPos instead, that sounds like the exact thing that I need.

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [June 22, 2022, 10:30pm UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/4 "2022-06-22T22:30:48Z")

</div>

A bit more wasteful at 32bpc times three channels, but if you keep the transform matrix of the camera, you can turn the element into world coordinates data, so perhaps it becomes quite useful elsewhere.

---

<div class="post-metadata">

**Author:** ![superrune](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/superrune/32/12717_2.png) [@superrune](https://forums.chaos.com/u/superrune)\
**Post date:** [June 26, 2022, 8:42am UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/5 "2022-06-26T08:42:44Z")

</div>

The VRaySamplerInfo had exactly the kind of scale that was needed for the image processing software, apart from the fact that I need the Z depth to be positive values. The VRaySamplerInfo outputs Z as negative values. There is a multiplier in the Render Element, if I could set that to -1.0 the problem with be solved. Unfortunately, the spinner does not go below 0.0, so I’ve hit the wall on this solution as well. So close!

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [June 26, 2022, 4:06pm UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/6 "2022-06-26T16:06:48Z")

</div>

Indeed, I had assumed you could do the -1 multiplication in post.  
Doesn’t Z setup as i have shown work for you? It was giving me the same values as pPos, but positive.

---

<div class="post-metadata">

**Author:** ![superrune](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/superrune/32/12717_2.png) [@superrune](https://forums.chaos.com/u/superrune)\
**Post date:** [June 26, 2022, 9:18pm UTC](https://forums.chaos.com/t/making-sense-of-the-vrayzdepth/110689/7 "2022-06-26T21:18:03Z")

</div>

You are absolutely right! Z setup is working as it should. I simply forgot to set the min max values as you had done, can’t believe I missed that! Thanks again!
