View Full Version : Depth of Field Using Z-Depth Question
02-15-2010, 11:33 AM
For hours, I googled the best I could about how I render out a frame or frames in Maya with Z-Depth and enable Depth of Field in After Effects. From my understanding, if i render it out as a .iff, I need to manually go to fcheck and save the Z layer as a separate image, which I don't think is a big problem. My other choice is to render as something like a Targa file, and use the two tga files in After Effects. All this aside, I don't seem to understand how I'm supposed to join the two images (the actual render, and the depth render) after i import them in After Effects. Basically, I'm completely clueless as to what I should do in AE after importing the 2 images in a blank project. Any advice on what I'm supposed to be doing would be greatly appreciated! Also, from experience, does anybody know if the DOF of after effects on 3d objects will achieve the same look as DOF through a mentalray render? The reason I'm trying it out in AE is because it should take much less time (hopefully).
02-15-2010, 02:24 PM
In short, yes the DOF field effects work differently between your 3D package and a 2D compositing package. Done properly, the 3D package should be superior but then the comped 2D approach will be much faster and allow you to refine the result after rendering.
As far as After Effects DOF filter goes, my understanding is that it is for use with 3D layers so I avoid it and use the Tinderbox plug-in from the Foundry instead.
Thats probably not the answer you were looking for but I have to make extremely heavy use of DOF in my work and the extra control over bokeh, blur radius, gain etc has saved my sanity. It is a 2D effect and will make use of a Z pass in the manner you are looking for. Unfortunately, its not exactly cheap but it makes commercial sense for me when you consider that in the past 18 months I have only had one project that didn't require blur.
02-16-2010, 12:03 AM
This might help; it's a link to a tutorial that talks about using RPF files as the control for the AE depth of field effect. In the tutorial, the RPF files were created with Carrara, but I don't think that matters for how the effect is used.
sub7th AE DOF tutorial (http://www.sub7th.com/community/index.php?topic=28.0)
02-16-2010, 01:37 AM
If I understand your question correctly youre able to render a beauty pass and a zdepth pass in Maya fine, but its the compositing thats puzzling you? Anyway if so, what I do when I composit them is : drag both of them into a new comp. Add effects > lens blur to your beauty pass, then under depth map layer, change from none to your beauty pass. You will most likely have to check inverted as well. Play around with your blur focal distance etc.
02-16-2010, 02:40 AM
Thanks everyone for your input. Kyron, my question was about how to composite the effect as you guessed. The lens blur you explained worked perfectly as you described it, however, would the "Depth of Field" filter under the 3D Channel effects work any better? I was not aware that I could have used the lens blur, and had just heard about the depth of field filter. But if its about the same result, than I'm happy with that. Also, CaptainJack1024 (http://forums.cgsociety.org/member.php?u=375085), the tutorial you linked was very informative for other question I had about this process!
02-16-2010, 07:04 AM
If you read the AE Help about "3d channel effects" it tells you that you need to have the Z in the same image (rla, rpf, exr ) not a seperate z image to get these effects to work.
Lens Blur does not need this since you can specify what layer to use as depth map. But Lens blur only blur from white to black so it will be a problem if you want to have focus somewhere in the middle, which is not a problem with the 3d channel DOF
02-16-2010, 09:12 AM
Thanks for the advice. I rendered a test scene in .rla format. AE seems to be detecting that there is a depth, but its at very small numbers, like .01 and .02. When I try to apply the Depth of Field, either everything gets blurred or nothing. Is there anything I can do to make these values larger?
02-16-2010, 09:23 AM
I had forgotten all about the lens blur filter!
You will get more control over the effect if you keep your Beauty and Z passes seperate for the time being so try following Kyrons MO for now but set the Z pass as your depth layer - I know thats what he meant to put. If you need better range between near and far values you can do add a levels/contrast filter to the Z pass more easily if you keep your passes seperate. Have a play, see if that works any better. If its still not happening, post some passes and we can have a look for you.
02-16-2010, 10:37 AM
Thanks for your input Lightwell. The lens blur currently works fine, but I wasn't able to sweep through the far and near planes. The curves idea sounds brilliant, I'll have to try that and see how it goes. As far as the look of the lens blur goes, is it realistic in terms of how an actual lens would blur objects, or would the Depth of Field filter theoretically give me better results?
02-16-2010, 03:28 PM
Good question and not one that I am really qualified to answer but from what I do understand, I would say that it was an approximation of the effect rather than being an accurate reproduction of it. Real depth of field is influenced by a host of factors including lens choice, aperture, film gate/sensor size etc and i don't really see any of the AE filters coming close to that. That said, if you are just trying to simulate the effect and add some cinematic style depth cues then its probably not a bad substitute.
The AE DOF filter is designed for use with 3D layers so doesn't really apply to your situation as described i.e. you are using a Z pass to describe depth in a flat 2D layer rather 3D layers arranged in 3D space.
Personally I find the AE lens blur a bit limited especially with respect to bloom and bokeh but unless you are dealing with strong highlights or contrast it might not necessarily be an issue. If you want to see how real DOF works, if you have a DSLR then open the aperture as wide as you can and take some shots of close to camera elements with distant backgrounds. Scenes with bright highlights or strong contrast will provide more interesting results.
02-18-2010, 06:49 PM
I usually use the Maya Depth Pass pre-sets
Adjusting Maya Depth Pass Pre-Sets
Once selecting the preset Depth Pass then open the hyper shade. Expand the Multiply and Divide / adjust the input 1 and input 2/ play with these to get the desired effect.
Using Maya Depth Pass in After Effects
Option A – Make a composition / place RGB Files, Depth pass, and create a adjustment layer. Turn eye off on depth pass. On the adjustment layer apply effect of “Lens Blur”. Under the Lens Blur parameters select your depth pass as source.
Option B – Compound Blurr
Hope this helps..
02-18-2010, 08:22 PM
Ive actually started to play around with an AE plugin called Frischluft instead of the lens blur. Ive been told that its a bit more realistic, and gives a better sense of DOF as well. Might be worth checking out :)
02-27-2010, 04:23 PM
It might be better for the OP to checkout http://www.frischluft.com/lenscare/index.php they have some great examples , very top notch stuff there.
You cant compared what AE LensBlur give you. Is just there to add some subtle DOF but that is all.
As well is very much comparable to what a 3d app will give you, is even better than what a 3d app will give you since you can modify the lens to add that special look not just blur images.
Check it out.
02-27-2010, 04:23 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.