Animating Focal Blur

Blend -


I’ve got a camera zooming in and I need to keep the focus on the people as the distance changes (pretend the blocks are people). I’ve tried to do it by animating the focal length of the camera, but I’m either not able to find the sweet spot where the blur is zero, or there isn’t one this close to the camera.


In the camera settings, enable “Limits”. The yellow square is the focal length.

“Limits” is on. I’ve shifted the focal length crosshairs around but haven’t been able to get my people into focus at close distances. It may be because the scene is scaled down so far to fit inside the clipping planes (this is part of a battle scene that extends way off in the distance.)

The DoF node is based on depth buffers. If you have any planes occluding your scene then DoF cannot see past them becausse depth buffers do not contain transparency information, nor are they compatible with transparency.

You may have to set the clipping planes up in a separate scene in order to use them as masks. Just import that scene into the compositor via the little arrows on the bottom left corner of a render layer node. If you z-combine the new scene with the first then you’ll find yourself in an even bigger mess.

Does anyone know if there is a sort of “Track To” constraint or something for the DoF node? IE: Set the DoF to track to the front of the face (or whatever your subject is) so the camera will always be focused on whatever subject, no matter what distance.

If your scene scale is made tiny like you said it was to compensate for a limited clipping plane range in blender, maybe there’s just less focus range for the relatively normal size camera. Tried moving the f-stop up a bit to give a wider range of focus?

Rambobaby - I’m not using clipping planes as masks. My complaint with clipping planes is that there isn’t enough distance between the camera and the max clipping plane distance to have people and capitol ships in the same scene, at correct scale to each other. Once this problem is licked maybe I’ll post about it.

BlackBoe - For the close head shot at the end, I moved the Fstop all the way up to 127.999 (with the focal distance right on the back of her head) and the blur was still waaay too much.

Maybe if I could animate the Maxblur value I could fake it well enough. But that doesn’t seem to be supported.

I know this is probably a really stupid question, but you don’t happen to have ‘no zbuffer’ still toggled on, do you?

EDIT: No wait, it’d have to be off, cause fstop is still visible. I have no idea, but your blend file is down so I can’t look at it.

Link updated. Should be working now.

That is a huge clipping plane of a couple thousand set against an extremely miniature person with the focal point at a distance of millimeters. That big pyramid you see is basically the size of the camera’s lense, at the end. That’s a big closeup. The focal distance is practically inside it.

I tried working on it a bit, and I’ll probably try more, but I don’t suppose you considered doing it the way they did it in the old days–and actually a lot of new movies, I think–and doing the far distance, the middle distance and the close distance as a series of mattes? They could even be animated mattes. You could even store them as separate scenes in the same file, and layer them with the compositor. This is just an amateur talking, so I have no practical idea, but it seems some of the things you do have a tendency towards brute forcing, where things could, so far as I can see, be worked around with relatively little effort.

You should check out the scale file. It’s at least 10X smaller. You can’t even work on the characters close up because their body parts disappear behind the viewport’s near clipping plane.

I think what I’m going to end up having to do is have the foreground elements at a large scale, the mindground elements at a medium scale, and the distant elements at a teeny tiny scale. It would be great to have them all in the same mist, but I think I can eyeball seperate mists well enough to make them look like they are the same.

It is probably a scale problem really, scaling up the entire scene might help. The distance between the head and blocks is rather small.
I suppose another option would be to add a Z scaling parameter. Then you could artificially extend the distance range.

But besides that, I have to say I find it amazing that people find the “quality” of the defocus node acceptable. The ‘transparent edges’ problem would seem to me to be particularly annoying at times

Well, I haven’t seen anything better and I’ve seen some focal blur at the movies that pales in comparison (a frog base jumping off a clip in a CocaCola commercial - I think - is the first thing that comes to mind). I was sad to read that micropoly will be your final contribution, eeshlo. I’m keeping my fingers crossed that you’re just too strung out on Blender to stay away for very long. THANX FOR ALL YOUR HARD WORK!!!