Simply Maya User Community

Simply Maya User Community (
-   Maya Basics & Newbie Lounge (
-   -   Keyframe Depth of Field? (

mindbend 07-01-2004 06:00 PM

Keyframe Depth of Field?
How does one Keyframe the Depth of Field attributes?

I have a little test sequence where I have three primitive shapes lined up. I set the camera to focus on the middle shape. I then animated the camera to move through and around the shapes. Much to my dismay, I could not keyframe the focus distance to stay focused on the center object.

How is this accomplished? Thanks.

Pony 07-01-2004 11:23 PM

wandering to clear something up. you could not keyframe the Field attribute at all or you key framed it but its dificult to get the field to stick right whare you want ?

ragecgi 09-01-2004 05:05 AM

Good points as usual Pony!

Also, just an fyi, to my knowledge, depth of field is not keyable in an "axial" sense.

However, you should be able to key it for distance from cam.

Alan 09-01-2004 09:52 AM

this would be much simpler in post. You could animate a fade in shake (or similar package assuming you have access to it) to control z depth image. I did this on my masters project and it worked a treat. It would mean you only need to render one image.

Do you have access to any comping software?

mindbend 09-01-2004 02:54 PM

I do have After Effect production bundle 6.0, which of course supports z-depth. I have yet to do any 3D work in AE, but I imagine it's pretty easy as I'm pretty comfortable in AE in general.

It just seems to me that keyframing the camera parameters would be easier. You know, set a keyframe on frame 1 with focal distance = 15, move to frame 50 and set a new keyframe of focal distance 25, etc. But apparently it doesn't work that way?

Someone on another forum mentioned to use a locater and tie the focal distance to the locater. Seems overkill to me, but I admit I'm just learning this, so I'll reserve analyzing it until I'm more familiar.

Thanks for the input, I'll try the post-production method. Presumably that's going to have a slightly different look, right? Not that it really matters for what I'm doing, but I could see where someone would prefer one render look over the other.

Alan 09-01-2004 04:28 PM

no it should look the same, and the beauty is that if you dont like the look you can tweak it without re-rendering the scene... and that's the time saving beauty of it ;)

mindbend 09-01-2004 04:39 PM

Interesting. So is it safe to say that in general one would NOT render in Maya with depth of field, but rather just render with Z-depth and do it in post. Thus allowing the flexibility as well as time savings in renders?

I'm going to have to play with that this afternoon.

Alan 09-01-2004 06:01 PM

damn right! I would never trust maya's DOF it takes too long and when you're done you've got dof whether you like it or not! ;) if you do it in post you can remove it, tweak it do whatever the hell you want with it. Much much more flexible ;)


andymcbride 20-07-2009 07:07 PM

I would like to see if there IS a way to keyframe the depth of field within maya...i just doesnt make sense that you couldnt. But doing it in after effects SEEMS like a solution...but for some reason i dont like the idea of doing it in AE. hmm..i will read into that too. If anyone has good links for this process please post..I will aswell.

honestdom 20-07-2009 07:13 PM


Originally posted by Alan
damn right! I would never trust maya's DOF it takes too long and when you're done you've got dof whether you like it or not! ;) if you do it in post you can remove it, tweak it do whatever the hell you want with it. Much much more flexible ;)


this is your answer.

Chirone 23-07-2009 01:17 AM

A DOF in after effects or other compositing packages takes all of 2 seconds, doing it in maya takes all of... not sure how long it takes, but its certainly more than 2 seconds to see something, as stated above

you just need to have a zdepth pass rendered

whitecrow1986 29-05-2018 09:52 PM

Okay I know it's been a LONG time since this post was created but I ran into this issue last night in Maya 2017 where I could for the life of me animate the DOF from in camera or with a mental ray lens bokeh. Though after much trial and error, I found a way to do it....EXPRESSION DRIVEN!

In the camera itself, if you create a new attribute called something like "dofAnimate" you can link it directly to the camera DOF focus distance or mi_lens_bokeh plane with a simple expression like this:

perspShape1.focusDistance = persp1.dofAnimate;

for an mi_lens_bokeh it would look something like this:

mi_lens_bokeh1.plane = persp1.dofAnimate;

Now you can simply keyframe the dofAnimate attribute on the camera and it forces Maya to actually animate the DOF.

On a side note, I could have easily rendered out a Z pass, but let's face it, without rendering out multiple layers of objects with their own passes, Zdefocus in Nuke looks terrible and can have broken or choppy edges especially on really deep scenes with lots of bokeh. Rendering DOF directly out of Maya always looks better even if you have to sacrifice a lot more time to do so. I hope this is helpful for anybody who runs into this issue in the future.

All times are GMT. The time now is 03:24 PM.

Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Simply Maya 2018