Z-depth in mental ray - Best way for instancing, methods, passes?

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
Old 12 December 2010   #16
I also thought of this method that could be a lot simpler, extract Z Depth with MR using an Mib_Volume shader attached to the camera's volume input.

Set this Mib_Volume to white and set the Max value which is distance, to whatever works for your scene. For objects with a cutout...use mia_material_x, leave it completely black with no reflections and map your desired alpha to the cutout_opacity on the shader and for everything else put a black surface shaders on all the objects in the pass.
__________________
TUMBLR
BEHANCE
VIMEO




Last edited by LinchpinZA : 12 December 2010 at 12:45 PM.
 
Old 12 December 2010   #17
@M0z:
I am unable to get the passes method (Camera depth Remapped) to work properly. I get a visible .rla file (in Fcheck, nothing else will open it), which has no beauty pass, a nice clean alpha, and the depth pass is plain black. In Fcheck it says there's a depth render there, but I can't see it.

Here's the alpha, I've only turned on one distant set of grasses to be sure instancing is working:



And when I click Z in Fcheck, this text comes up:



This of course takes 44 minutes to render. Not sure what I'm doing wrong here, M0z? Do I have to somehow remap the depth render to get visible values, since it's output in 32-bit? Photoshop can't open the file itself...
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
Old 12 December 2010   #18
Wow that's strange.
I can open the RLA in After Effects, it works. I have the beauty pass as a RLA file and the depth pass as a RLA file.
I set the near and far clip planes in the camera to my desired values like 0.1 and 40, activated Depth in Output Settings (furthest visible depth) and just hit render.



If you like, I can take a look at it for testing. I'd need the scene only with the landscape and the camera.
__________________
mathiasmarkovits[dot]com
 
Old 12 December 2010   #19
Yep, I only get one file output, which would be fine if it were say an actual, working, multi-layered .exr file with a master beauty pass, a nice alpha, and of course the depth pass. But instead, I get only an alpha, although both other channels are present in Fcheck, just pure black. And I don't have After Effects at home, alas...

Otherwise I set up the scene how you said to, far as I can tell. Is there something wrong I'm doing with my Render Passes tab in the Render Settings, perhaps?

I'd have no problem sending you my scene file as it's just a personal work, 'cept it's simply too damn big to fit in an email or anything like that. I may make yet ANOTHER test project, though, in which case we'll continue exploring things and can trade files.

So far, that's two of you (at least) with working depth methods, although with that level of noise the pass would be troublesome in post m0z? I'm just going to keep trying.
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
Old 12 December 2010   #20
absolutely @ the noise. Until I found out how to fix that it's a useless method for me. I'll keep trying too.

I just created the Camera Depth pass and hit "associate pass with currend render layer" which was the master layer. No magic there. Hmmmmmm

edit:
Quote: Z-depth values can't be anti-aliased because they necessarily must represent one pixel's position on the screen. Their color represents that pixel's depth from the camera.

interesting...
__________________
mathiasmarkovits[dot]com

Last edited by m0z : 12 December 2010 at 08:04 PM.
 
Old 12 December 2010   #21
Perhaps that's my problem, right there.

Quote: I just created the Camera Depth pass and hit "associate pass with currend render layer" which was the master layer. No magic there. Hmmmmmm


I have no idea where that "Associate Pass with Current Render Layer" option is. It would appear I'm not getting a depth pass, perhaps because the CameraDepthRemapped isn't associated with anything? Would that also explain why I'm getting one rendered .rla file and you're getting two?

Quote: Z-depth values can't be anti-aliased because they necessarily must represent one pixel's position on the screen. Their color represents that pixel's depth from the camera.


This is correct, but not terribly useful, since our beauty renders ARE anti-aliased. So some sort of selection-blurring or culling must occur in post to make depth passes useful?
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
Old 12 December 2010   #22
connectAttr -nextAvailable defaultRenderLayer.renderPass depth.owner;

or

__________________
mathiasmarkovits[dot]com
 
Old 12 December 2010   #23
Originally Posted by InfernalDarkness:
This is correct, but not terribly useful, since our beauty renders ARE anti-aliased. So some sort of selection-blurring or culling must occur in post to make depth passes useful?


Well, if you are using the depth passes from the mental ray passes tab those depth passes are not anti aliased even if the beauty pass is. They are raw values. You can tell because the edges on those are always nasty even if the edges on the beauty pass are nice and soft. If you render the depth pass yourself with a shader obviously you can control the AA however you would like using the normal methods. I assume you are usually doing just that. I have no idea how each of the post z depth plugins work behind the scenes, but I assume they are doing some edge magic to take those jaggy edges in the depth pass and make them look nice when used to do the blur.

I'll repeat what I posted earlier and offer the option of rendering out the depth pass at double or triple res with no AA and then scaling down in post for depth based selections.

But if you use the Lenscare plugin (which is the best depth plugin I've used) it seems to work best with a no AA render. I did quite a few tests and every one of those tests the AA renders were terribly artifacty compared to the no AA renders.

Also its good to note that not all depth plugins in post are created equal. Each one works a little differently. I've tried the depth blur plugin that comes with Nuke and Lenscare. Lenscare totally won out over the depth blur plugin that came with Nuke. Hands down. It also rendered A LOT faster. If anyone is interested I can post up some tests I did that demonstrate all this. The Nuke z blur plugin seemed to do some really strong blurring to the alpha that looked really nasty to me. Lenscare handled that much nicer.

In my experience the plugin you use in post in just as critical as the depth render you output from your 3D package to get a decent result for post DOF. Some plugins work better than others in certain situations. So I think it's pretty important to experiment with different plugins.
__________________
If animation is the illusion of life, then life is the illusion of reality.


"On ne sort pas DU REVE."


Last edited by Redsand1080 : 12 December 2010 at 09:14 PM.
 
Old 12 December 2010   #24
absolutely correct. We used the Frischluft plugin for a commercial project lately and it's wonderful.

I'll have to do a proper Zdepth with 10thousand firs soon but I guess I'll just convert my mia_materials to surface shaders with the cutout opacity.

This all isn't worth the hassle imho.
__________________
mathiasmarkovits[dot]com
 
Old 12 December 2010   #25
Thanks so much for your input, Justin and Mathias!

I'll give the depth pass another shot when I get home, M0z, and hopefully properly associate it this time. I am still very new to passes and have never really used them successfully before. There is almost zero help in the Maya docs about passes, contribution maps, etc. It's still all a mystery to me, so I fumble through it by trial and error. Thanks again for the screenshot, although the buttons look totally different in Maya 2009 I think I'll try the depth pass again and see how it goes.

As for plugins and whatnot for Zdepth, I don't have any. I'm using just Photoshop for compositing (since I'm only doing stills). My typical pre-Maya workflow (in Bryce) was to click "Depth Render", render my depth perfectly and painlessly after my main beauty render, then some alphas and object ID renders, and then take it all into Photoshop as Channels for easy selection.

So in Photoshop, I would simply go to my depth channel and use "Select by Color Range".

So to select a distant hill for example, I would pick that hill's color in my depth render, and then fuzzy it a bit so that either than entire hill was selected or however much distant area would be selected. This would base the selection on a falloff-by-color radius, so that some pixels would be 100%, but most would be less than 100% selected.

Then I would go back into my Layers and create new ones, apply fog and haze and other effects, which would then sit below my foreground layers but over my background layers, obviously, and it all worked fine. I would use the object ID matte renders to add to or subtract from my depth selections as necessary. This has worked well for me since 1997, but in 2004 I decided to shift to Maya and make a profession out of it all, and for the past 6 years have been missing this huge, huge element to my workflow.

I don't need zdepth for DOF effects or anything usually, just to be able to apply filters and effects based on this range of selection falloff. Hope this explanation describes what I'm working towards a bit...

...now back to more depth tests! Any critique of my workflow would be much appreciated as well, outside the depth render stuff we're discussing.
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
Old 12 December 2010   #26
Must be something else I'm doing wrong. Now I get two new folders (proper output, so that's helpful) with one MasterBeauty render and one depthRemapped render. The .rla file in the Beauty folder is identical to my previous .rla; it has no RGB, a nice clean Alpha, and a black Zdepth channel (in Fcheck) but it is present. The .rla file in the depthRemapped folder has the Alpha as its RGB channel, a pure white render as its Alpha, and a "no z buffer" empty z-channel. Slayed here on this one, M0z. Perhaps it works better in newer versions of Maya? I'm stuck with 2009 for now.

If I seem like an idiot here, you must also imagine that I feel like more of one.

Going to launch into another surface shader (luminanceDepth) test once patience returns!
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
Old 12 December 2010   #27
Fyi: I used the "camera depth" pass, not the remapped one. Not sure if thas he reason though
__________________
mathiasmarkovits[dot]com
 
Old 12 December 2010   #28
Well I found out that (evidently) you have to have LIGHTS on in a scene, before you can see anything in your beauty pass! Must have turned them off some time ago testing the surface shader method or something... I'm a fool. But still no depth pass. This is what Fcheck looks like in all three channels now:



(most of the plant layers are off for the sake of speed... rendertimes down to 11 minutes, so 9 minutes translating and 2 minutes rendering now)

So I learned a lot about passes so far, and fixed one of my obvious mistakes by turning on the sun/sky so as to be able to see anything in the beauty pass. I'm hoping there's yet another imbecilic mistake made somewhere along the way, too.

Gonna hold off on pass-testing for now and focus on the surface shader (luminance depth) method to isolate why I couldn't get that to work previously. Possibly some other rookie mistake along the way.

So far the three methods I can see are:

1. Depth pass - quicker and more painless, 'cept no visible results yet. (Edit) Going to try a non-remapped test next instead, and fix my camera's near and far clipping first.

2. Surface shaders - ....pending re-research. Lum_depth would fall into this slot, except no support for cutout opacity that I could see, so manual surface shaders are up next.

3. Puppet_z - only respects alpha cutout opacity in some cases, gotta isolate why/when still. If Puppet's still around, feel free to stop by and mock/berate me for misusing your shader.


Any other ideas to help understand this topic would also be very helpful!
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."

Last edited by InfernalDarkness : 12 December 2010 at 04:00 AM.
 
Old 12 December 2010   #29
Originally Posted by InfernalDarkness: 1. Depth pass - quicker and more painless, 'cept no visible results yet. (Edit) Going to try a non-remapped test next instead, and fix my camera's near and far clipping first.


This may be a stupid question and I may have accidentally skipped over where you specified you did this, but just in case, did you set the far clipping plane value for the remap to the edge of your scene? The 'ole method of grabbing a distance node to go from the camera nodal point to the edge of the scene gives a good value for that. Again, that may be a stupid question, but just in case.

And if you are getting no visual results for the remapped version and you did set the planes up correctly you're definitely not going to get any visual results for the non-remapped version in fcheck. That version comes out in floating point space and 9 times out of 10 requires some tone mapping to actually see anything at all even if all the data is present.
__________________
If animation is the illusion of life, then life is the illusion of reality.


"On ne sort pas DU REVE."

 
Old 12 December 2010   #30
Not a stupid question - gotta explore all angles to solve complex problems like this one, with what appears to be almost infinite variables. My depth is set to .01 near and 300 far, which fits my scene well for scale, and also worked initially with the Puppet_z. Like I said, I can get a depth render - just not with all instances and cutout opacity working:



For the second part of your post...

Quote: And if you are getting no visual results for the remapped version and you did set the planes up correctly you're definitely not going to get any visual results for the non-remapped version in fcheck. That version comes out in floating point space and 9 times out of 10 requires some tone mapping to actually see anything at all even if all the data is present.


How do I go about tone-mapping any of these files, and which one should I be trying to do this to? With the passes method, I get a MasterBeauty folder file and a depthRemapped folder file for each render, but there's no z-channel in my depthRemapped file at all, and no alpha. The RGB channel of this file is identical to the alpha from my MasterBeauty file, and the alpha is plain white. No Z-information in this file. Should I be working with the MasterBeauty file's black (but present) Z-depth information? And how would I save this out to a format that Photoshop recognizes?
__________________
Commodore 64 @ 1MHz
64KB RAM
1541 Floppy Drive


"Like stone we battle the wind... Beat down and strangle the rains..."
 
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 11:07 AM.


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