I have cut-out style sequence with figures comprised of pngs. They have been set up in a multiplane arrangement, and I basically have things working. I want to enhance the multiplane effect by adding a slight depth of field effect, which I am accomplishing in the compositor per the instructions of several tutorials. All is rendering accordingly, except that wherever there is a transparent area in a foreground (in focus) element where the background shows through, the defocus node does not defocus. The defocus node must be seeing the foreground element in the z-buffer and deciding to render the background material as foreground material. I have these big square in-focus halos around the foreground elements.
Is there another approach to this? A way to use alpha channel information maybe?
I have used a mist pass for a proxy zdepth, it seems to respect the alpha where actual zdepth only sees geometry. I will look for my old thread about it.
You can break your scene up using Render Layers so that the Z is calculated without the interference of the transparent objects. One Render Layer has everything but the transparent objects, and that is what is passed to the Defocus node. This is OK for fully transparent objects, but if the defocus has to affect semi-transparent objects as well as the solid ones, you may have to do a few more tricks like using multiple Defocus Nodes. Render Layers are very handy for divvying up scene elements for various special treatments.
Thank you both for pointing me in the right direction(s). I like the idea of the mist as z-buffer approach a lot, but ultimately was hesitant to give up the direct correlation of focus to camera. These are all flat-plane elements in a virtual cut-out multiplane environment, so i decided to try using multiple layers and rendering each of these through a separate defocus filter before combining them for output. It looks nice, and its tied to the camera, but i can also tweak the layers separately. Of course its fairly costly; my render times for these shots goes way up now that i have several defocus filters chugging away at once for what is a pretty subtle effect the way i am using it. But there is at least one shot that i’d like to do a rack-focus from background to foreground and this will do just the trick. Thanks again.
If the multiplane elements in your scene are fairly discrete and well-separated, is it absolutely necessary to use Defocus? One of the Blur filters using the Bokeh setting might suffice & would be lots faster. Maybe even cleaner, as Defocus can have artifacting problems. You’d have to be good at estimating the amount of blur needed, but most viewers aren’t going to be saying "Nope, that’s not the right blur for f/2.8 @ 45deg shutter
I used this “cheat” in a scene in Kata (at approx. 3 minutes) where I also wanted rack focus, but I’d found from earlier shots that Defocus & particle hair don’t always play well together. In the context of the action, it’s not really noticeable that it isn’t true DoF blur.
Indeed most of the shallow DOF tilt focus shots on vimeo are made in post. That is they haven’t used a $1000 tilt shift lens rather just a defocus based on gradient that varies across an image plane. I made one that animates like a rack focus and it is mostly successfull so long as there isn’t to much overlap (as Chipmasque rightly says).
Thanks for your additional thoughts and suggestions. I’ll certainly bear them in mind as I progress. Probably true what chipmasque is saying about using blur instead of defocus, but i’m quickly getting spoiled by the convenience of having this tied to the camera. Since i’m still tinkering around with the dynamics of the scenes, its very nice to be able to make ‘focus’ adjustments in one place and have them effect calculations for all layers.
Yeah, that’s a good point. But if you find artifacts creeping in (overlapping focal planes of great depth difference are areas to watch), keep the cheat in mind as a workaround.