PDA

View Full Version : Maya Z-depth vs Mental Ray Z-depth


yinako
03-31-2004, 12:08 PM
huh, why is depth channel rendered in Maya renderer different from Mental ray?

same scene, no facy stuff, just switched renderes and the result depth is different, what gives?

How am I suppose to composite images rendered from Maya to images rendered in MR if they have different depth?!!

I tried to composite pfx to Iff rendered from MR, and Pfx gets blocked behind the object.

Jackdeth
04-01-2004, 09:21 AM
Heres a tip, don't use Z depth renders. They don't have anti-aliasing so you will never get good comps. Use enviorment fog or a ramp projected through your scene instead.

Much cleaner, and you have much more control.

egoman
04-04-2004, 11:31 PM
It's a common misconception that depth maps should be anti-aliased. This is of course not the case as it would mean that the edge of a foreground object approaches the distance of its backdrop. It's not apparent to me how this very correct behavior could introduce any kind of artifact, but if it did the only solution would be to up the resolution of your render.
Using Mayas built-in fogs, dof, and similar effects would of course not help either as these are post effects making use of exactly the same depth map as otherwise output.

To answer the original question; The problem is a result of Mayas use of inverted distance values for depht maps (-1/z), resulting in 0 representing infinite distance and increasing negative numbers being closer to the camera. With mental-ray, on the other hand, a straight z-map is used (0 is near and distance is a positive float).
Both renderers output the same depth information, they just use a different range of numbers to represent distance. A remapping will be necessary to use both of them in the same compositing system.

If you find this to be old news, your problem might depend on the clipping planes. The Maya Software Renderer will make use of the Auto Render Clip Plane setting for the camera and thereby calculate these values automatically at rendertime, but mental-ray completely disregards this setting and will use what ever clipping plane values might be set. Not noting this could result in the renderers using different far/near ranges, so make sure this option is turned off.


Andreas Karlsson
Ego Studios

yinako
04-05-2004, 05:20 AM
Heres are the ranges

Mental ray Z range: [6.95845 , 8.73089]
Maya Render Z range: [-0.147297 , -0.0001]

Like the guy said distance are inverted, but turning off auto render clip plane made no difference to the z depth.

Also fcheck doesn't save the red channel when converting z depth to a standard format like tif/tga.
Anyway a way to normalise the two would be nice. I'm not a compositor so I don't know much, how would I go about doing it?

Gremlin
04-05-2004, 07:40 AM
i never got Z-depth to work, maybe it was the file types, but After Effects never properly interpretted my images. :surprised

but what did you mean by use ramps or env fog? help me!

egoman
04-05-2004, 09:45 AM
I did not mean that uncecking Auto Render Clip Plane would change the fact that Maya inverts the z-map, just that it could introduce a second problem as mental-ray might clip object that Maya would not. There is however something wrong with your numbers; -0.147297 should correspond to a mental-ray value of 6,7890045, and -0,0001 is a really great distance, much greater than 8.73089. I'm afraid I don't really know what's causing this if not the clipping planes.
To be of even less assistance I must tell you that using Fcheck to convert depth maps is not a good idea as it produces an 8-bit rgb image instead of the 32-bit singe channel image you'd want. This is also what you would get from following thew advice of Jackdeth, and the data-loss is, in most cases, unacceptable. If you should choose to go down that road anyway, I could offer some help with the problems you'll encounter as soon as I get back from work.

When it comes to After Effects, I'm not an expert, but it seems logical that it would interpret the channel correctly as long as you define the proper range. If this isn't possible, then this should be a common problem indeed and I'm convinced that there are plenty of plug-ins which would rectify the situation.
The reason I cannot be of more help here is that I always use Shake to normalize all depth maps as part of the pipeline, no matter what system they will be used for, and therefore these issues have never arisen.


Andreas Karlsson
Ego Studios

Jackdeth
04-05-2004, 10:09 AM
Originally posted by egoman
It's a common misconception that depth maps should be anti-aliased. This is of course not the case as it would mean that the edge of a foreground object approaches the distance of its backdrop. It's not apparent to me how this very correct behavior could introduce any kind of artifact, but if it did the only solution would be to up the resolution of your render.

Andreas Karlsson
Ego Studios

To not have a depth matte file match up perfectly with you render image would cause edge roughness and black outlines. Its simple math to mult images together, but everything needs to be perfectly aligned to work smoothly. What is AA? Its a sampling of a large area that is then scaled down. That pixel can be a blend of the foreground object, as well as the background ojects. Now, if you try to use Maya's lame depth matte, you will find that the depth file can only store ONE depth value per pixel. This means that it can be only the foreground OR the background object's depth stored. This will cause a staircasing jaggy issue on you object's edges when trying to comp a layer in between them.

Render out using white enviorment fog with all black shaders, or project a ramp on a surface shader through all of the objects are cleaner meathods becuase it gives your "super depth pass" with the same AA as your main render. This means all of your plates line up perfectly, allowing you to have nice looking comps.

Raul3d
04-05-2004, 11:24 AM
This tutorial (http://www.gignews.com/artistkapp0700.htm) could help you:wavey:

alexx
04-05-2004, 11:55 AM
i can only double what jackdeth wrote.

maya´s z-channel (basically the z-channel of any 3d app) is basically the "more correct" one, but gives you more problems, since as wrote it is not anti aliased.

but mostly it is not necessary to render out a seperate z-pass, when you have a little knowledge about your comp app and you are able to change the z-channel with nodes like blur dilate/errode and edge detect.
only in very few compositings i really had to render the extra anti aliased pass.

cheers

alexx

lazzhar
04-05-2004, 12:26 PM
What really hurts is the tesselation of nurbs surfaces in the scene, because both MR and Maya Software wont give you the same results until you go doing it by yourself and dont let softwares decide. And I suppose it's not easy to tweak this values.
Jackdeath suggests a very good method that works fine for me, but all the time i'm so lazy and i'm just content with the z-depth channel included with the rendred pictures.

thematt
04-05-2004, 01:27 PM
I usually rather make my own deph map shader and assign it to the object.Just a matter of taste.. :)
I don' t have a server but you can download it here may not stay for ever..if its not on anymore Pm me or if someone want to make a mirror no problem..

cheers

alexx
04-05-2004, 01:37 PM
got one to share too:

- before you run the script, be sure to save
- go to the camera you want to render with and adjust the near and far clipping planes as good as possible
- run the script
- save under a different name (!) (all other shader assignments get overwritten without asking)

z-depth MEL (http://bigott.gmxhome.de/scripts/createFakeDepth.mel )

it automatically sets the output image to IFF16. if you dont want that you have to change manually (which makes not much sense setting it to somthing with 8Bits)

cheers

alexx

thematt
04-05-2004, 02:02 PM
Oh yeah Alexx is stealing the show !!!:p

:beer:

alexx
04-05-2004, 02:34 PM
:blush:

there must be a reason, why ppl call me a smartass

Throbberwocky
04-08-2004, 04:29 PM
VERY interesting ...

But does somebody know of a depth shader which is compatible with mental ray? Or how to set one up?

Thanks a lot in advance!

augustus
04-08-2004, 09:34 PM
Originally posted by GumboYaYa
VERY interesting ...

But does somebody know of a depth shader which is compatible with mental ray? Or how to set one up?

Thanks a lot in advance!

http://www.cgtalk.com/showthread.php?s=&threadid=41932&perpage=15&pagenumber=4

Look at my post at the end.

CGTalk Moderation
01-17-2006, 09:00 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.