View Full Version : MR Camera depth pass

01 January 2012, 02:43 PM
Hi there

Just wondered if there were any known issues with the camera depth pass and certain types of geometry or shaders. I'm using the mia_material_x_passes shader, frischluft lenscare and AE with open exr's and eXtractor.

If i make a luminance depth pass with maya software i get a correct pass (with nasty artifacts though), but if i use the Mental Ray camera depth pass, the values are incorrect - ie i get sharp objects in the foreground and background.

I've played around with all the clipping planes and remapped the depth values in various ways, but it always gives me an incorrect pass.

Could it be that certain types of geometry (eg subdivision proxies) are being read incorrectly?

I've been fiddling with this for about 4 days now... this is getting rediculous!!

01 January 2012, 08:12 PM
Wowie, only 4 days in and you're making this much progress! Took me 8 years to figure it out, my friend!

Here's my latest tests and techniques ( which may help you, or may at least help you with what not to do.

The luminance depth is not a pass, but a render layer, am I correct? The actual Camera Depth is the pass I've been using successfully. I just remap it to fit my scene in the attributes, which coincidentally I cannot figure out how to ever get back to once they're set, so I just delete the pass and make a new one every time I need to change my depth clipping planes. Maybe you know how to bring up a pass's attributes after the initial creation?

Anyway, by "sharp objects" with the depth pass, do you mean aliased edges? This is the proper way to read and use z-depth, actually. Each pixel represents a "place" in space, and any grayscale blending (antialiasing) will throw off your true depth results. A pixel is either filled by the object (returns a brightness value) or it's not (returns no value, or the value of any objects behind it to be specific). At lower resolutions this can be kinda sloppy at first, but at high resolutions the value in this emerges quickly.

Are you using your depth pass for DOF effects, or for general selection purposes in Photoshop or AE (such as post-produced distance haze/fog, for example, which is what I use it for)?

I believe there may be some issues with AE in this regard, especially concerning .exr files. Nuke is evidently the tool we "need" for stuff like this, but I still do my postwork in Photoshop (for stills) myself.

01 January 2012, 09:00 PM
Ha! 8 years!

It's definitely the main thing that has steered me away from using the MR render passes feature in the past... everything else in the exr workflow works a treat but the depth pass always provides a headache!

Yes thanks i did read through the thread from before, and it was very useful, however my problem is really that the values from the depth pass don't seem to correspond to the object's distance from the camera: ie objects in the distance are in focus as well as objects in the foreground, with blur in between. Some objects seem not to be affected by the depth pass. Visually the camera depth looks ok, but when i use it in conjunction with Frischluft Lenscare it doesn't seem to rack focus correctly. Have you experienced this?

At the moment a luminance depth pass is the best i can do, but when I composite the render passes together and add the frischluft filter i often get nasty artifacts on the very bright areas. However i believe this might be to do with color management as it is only occurring around hot spots. I've tried all the usual AA double rez tricks but none have reduced the artifacts in the very bright areas.

Have you tried Maya Composite? Could be the low cost (free) nuke you need? I've been using that too, but i prefer the dof look from the Frischluft plugin in AE. As for the attributes have you tried saving them as a preset?

01 January 2012, 09:16 PM
Export your depth remapped EXR as 32bit or 16bit.
In extractor, after choosing the Z in the RGB channels, modify the black and white clippings (default is 0-1) until you get the result you want (white is close black is far).
If for some reason it is inverted, flip it with an invert effect.
And dont forget to add all these edits to a precomp and source the precomp to the lenscare plugin.
Do you use cutout opacity? if so, you can read this thread:

01 January 2012, 10:10 PM
Eureka! It was the black point/white point adjustment.

Thanks so much for that!

CGTalk Moderation
01 January 2012, 10:10 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.