View Single Post
# 12 29-05-2018 , 09:52 PM
Registered User
Join Date: May 2018
Posts: 1
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.