View Full Version : Renderpass depth doesnīt work for me.

08 August 2011, 02:16 PM
I just canīt get it to work. Here are my exact steps:

I have a scene with a camera, no lens shaders. I use linear workflow, so I have output as .exr and 32-bit FB. In my file name prefix I have <renderpass> to seperate the depthpass to its own file. I created a depthRemapped pass and associated it with my renderlayer. In the attributes I set filtering off and far cliping plane to a value that fits my scene. And then I press render.

Open the resulting file in PS and itīs all black. Messing with exposure, doing local adaption etc, it shows nothing at all in the whole 32-bit range.

I normally use puppetshaders depth, and it works on this scene, but I just thought I should learn how to use maya-depth just in case. And I canīt get it to work. What am I doing wrong??

Thanks for answers.

08 August 2011, 04:25 PM
Are u using the normalized version?

08 August 2011, 05:08 PM
I donīt know? I can only choose from camera depth and camera depth remapped, Iīve tried both. I donīt see a normalize option.

08 August 2011, 05:33 PM
Remapped is the normalized one (you can also choose Camera Depth then check the Remapped box, I guess that's the same).

Play with the values according to your scene scale.

08 August 2011, 06:14 PM
I've found z-depth to be very tricky with passes, but it's entirely possible to do. Perhaps first try it as a different file-format, something visible (.bmp or even .jpg), until you get your settings balanced. Once you see a usable range in your output, try switching to .exr from there?

08 August 2011, 06:47 PM
I think Iīm giving up, mayas zdepth is too complex for me :p p_z works so...

Tried all fileformats, tried different FB bit-depths, tried very different far clipping plane values (my scene is 100 units, tried 10, 100 and 1000). Then I tried in a new fresh scene, with a simple plane, 40 units, and tried the same stuff there. In PS the plane is white and the empty background is black. What I expect is a gradient but this looks like an alpha. And yes, Iīve checked the entire range of color data :) no info, and when doing local adaption to compress the range, it is still white.

08 August 2011, 08:55 AM
I understand your frustration, believe me I do. But once you get it down, it works much easier than most other methods. And the puppet_z is awesome, but there are some features it doesn't support and also it's not a pass, but a separate render obviously. In many cases that's fine, but if you're doing an animation it's best to extrapolate your passes of course all at once instead of re-rendering the image with a different shader.

Here ( is a long thread in which I learned a lot, perhaps it will help.

08 August 2011, 10:25 AM
Thanks for the thread, looks interesting. Are there exampels of what p_z does not support in that thread? If not, maybe you can tell me here so I now when I will get trouble :)

08 August 2011, 09:41 PM
Puppet_z appears not to work with BSP2 instancing sometimes. I can't isolate it, but this can be an issue if you forget to set it to Regular BSP in that render layer's override settings. Basically, if you have a billion krillion instances, puppet_z doesn't treat them as instances in BSP2. But that test was with Maya 2009; I haven't done a new test using 2012, might be fixed internally already.

08 August 2011, 06:33 PM
Here is an example of a relatively complex scene working (Maya 2012) with the render pass depth (not depth remapped, in this case).

The depth pass:

And the main render WIP:

Note the cutout opacity from the mia_mat_x_passes working properly with the leaves and foxtail lilies. Granted, this isn't a 32-bit depth pass, as I haven't yet mastered .exr files inside Photoshop, but it's a serviceable starting point for certain. Knowing that the .bmp version is visible for me is the starting point, so I know it's all working proper and my camera's near and far clip is set properly at least. If it's invisible in the .exr I render out next, then it's just gotta be tonemapped into a visible range, but the data should be there.

08 August 2011, 09:18 PM
By default the clipping planes decide the range of depth in a 32 bit Depth pass.

So if you have values between .01 to 1000 in your camera clipping plane....your depth pass is going to output floating point values up to 1000.

Compositing apps like Nuke wont have any issues with this (forget photoshop)

08 August 2011, 09:25 PM
So is it only the far-clipping plane that defines the gradation? In the above depth pass, my settings were .05, 150. So is that why there are so few variations? My levels seemed striated, but I assumed this was because it was an 8-bit .bmp file initially, and knew there were barriers with this file type, but wanted to be sure (visibly) that the z-depth was rendering at all.

Also, I'm certain we'll be at a disadvantage without Nuke or whatever, but one cannot "forget Photoshop" when one is not an animator and doesn't work on animation and likely never will. It is entirely doable in Photoshop; just gotta tweak things and know your tools.

There's really no reason to add yet another (expensive) tool just for the depth masking, is there? ProEXR should be enough, I would think.

08 August 2011, 08:57 AM
If your far clipping plane was 150, then default depth would give a maximum pixel value of 150. 150 would be the camera Z value within Maya

8 bit is 0-1, so if your compressing values from 0-150 into 0-1, there is a great loss of data which will give you banding.
Photoshop is lame duck anyways once you try to work in 32bit color space, nearly all of the tools are unaccessable.

You can still edit 32bit EXR in Photoshop, but its a very poor implementation. The Exposure control is intended to do this...but you have to eyeball it, whereas in a compositing app you can you get precise pixel values. So you are stuck with color correcting the depth map in 32bit, and saving the result and work in 8 bit if you want access to filters and layer masks.

08 August 2011, 07:17 PM
It was my understanding that 8 bits = 256 levels. My .bmp files are 32-bit of course, but only 8 bits of that data exists for any particular color or channel. And this is clear in my last depth pass (posted above). That is, 8 bits for Red, Green, and Blue, and another 8 bits for alpha/transparency/whatever.

The .exr file type on the other hand has 32 bits across any number of channels, as far as I'm aware. The good news is that it's entirely unnecessary for my purposes to have such a high variation. 16-big half-float would be plenty, and since I am only using z-depth for selection and masking, the conversion down to 8-bit can happen after this selection process, in Photoshop.

MasonDoran, what would be an alternative tool to Nuke that handles such things better, if any exist?

09 September 2011, 07:41 PM
If your far clipping plane was 150, then default depth would give a maximum pixel value of 150. 150 would be the camera Z value within Maya.

I'm not sure this is accurate at this point, my friend. Re-rendering the above z-depth with a far clip of 300, out to a 16-bit .tif file instead of .bmp, yielded nearly identical results. Running a Difference in Photoshop yields only a slight amount of visible data:

A couple issues here: perhaps this is twice as much depth information, and the 8-bit file conversion is losing the additional depth data. Also, I rendered to 16-bit half-float, and somehow Photoshop only reads the .tif file as an 8-bit file. Perhaps .tif is not a valid format for such things?

Still not sure how to use .exr files in Photoshop to any avail.

CGTalk Moderation
09 September 2011, 07:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.