Maya Z-depth vs Mental Ray Z-depth

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2004
Maya Z-depth vs Mental Ray Z-depth

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.
__________________
"Story in a game is like story in a porn movie. It's expected to be there, but it's not that important." - John Carmack
 
  04 April 2004
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.
 
  04 April 2004
Common misconception

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
 
  04 April 2004
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?
__________________
"Story in a game is like story in a porn movie. It's expected to be there, but it's not that important." - John Carmack
 
  04 April 2004
i never got Z-depth to work, maybe it was the file types, but After Effects never properly interpretted my images.

but what did you mean by use ramps or env fog? help me!
__________________
Designer ✦ Developer
 
  04 April 2004
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
 
  04 April 2004
Re: Common misconception

Quote: 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.

Last edited by Jackdeth : 04 April 2004 at 10:11 AM.
 
  04 April 2004
This tutorial could help you
 
  04 April 2004
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
__________________
"A computer program does what you tell it to do, not what you want it to do." — Greer's Third Law.
 
  04 April 2004
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.
__________________
Lazhar Rekik
 
  04 April 2004
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
Attached Files
File Type: zip zdephshader.zip (1.3 KB, 105 views)
 
  04 April 2004
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

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
__________________
"A computer program does what you tell it to do, not what you want it to do." — Greer's Third Law.
 
  04 April 2004
Oh yeah Alexx is stealing the show !!!

 
  04 April 2004


there must be a reason, why ppl call me a smartass
__________________
"A computer program does what you tell it to do, not what you want it to do." — Greer's Third Law.
 
  04 April 2004
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!
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:48 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.