Depth of field

When I am assigning an empty as my camera’s focal point and add a defocus node, everything on the same distance from the camera gets the same amount of focus as the objects where I placed my empty gets. Is there any way to simply focus on the precise spot where I place my empty? Thanks in advance!

I think you need to clarify your question…

How should the result you want look like?

But if i understand you right, the answer is: yes and no, yes, possible, no not “simply”.

The Defocus Node is not intended to do that, it does simulate real Camera physics.
You can either alter the Z Depth (in Comp) before Defocus Node or use another Blur, like Directional Blur(zoom), Blur and use size input. But unless you show me what you want everything further is guessing…

Quite often the best way to get the effect that you want is to “fake it” with render-layer nodes. Use these to isolate foreground, subject, and background data from one another, then blur or defocus each one separately. This gives you control over the outcome … more control than you’d get if you attempted to mimic an actual lens. (“This isn’t ‘reality,’ anyway… this is CG. Let us make the most of it.”)

The viewer’s eye is going to understand, and believe, the effect that it is seeing, and won’t care that it isn’t precisely “real.” As a visual storytelling device, you want control to get clarity. There will be no question as to what should be the object of attention. You can even get a nice “follow-focus” effect.

You can also do other things in this way … a little tweak of hue/saturation, for example, for one layer but not another. This is especially useful if the objects are fairly crowded into the same general (x,y) areas of the viewport. You do it subtly, not enough to draw the viewer’s eye to what you’ve done, but enough to make the shot more clear and easier to visually follow.

Are you referring to something like this image? You can control the shape of the texture by playing with the x,y dimensions on the texture node. (.blend attached below image):


DoF with blurry edge on focal plane.blend (956 KB)

No. I would simply place the different objects-of-interest into distinct RenderLayers, then, in a compositing node-network, treat each one of the layers separately as I pleased. Then, merge all the outputs together, perhaps using Z-Depth to help me.

The final visual result “plainly isn’t” true (photographic …) depth-of-field. Instead, it’s layering, with (by my count) about 5 or 6 layers in-play, each one being treated differently. The general treatment of this layering might be “fairly consistent with that of a photographic narrow-field focus on the blue dog,” yeah, but … “never mind that, let’s feature the name of the artist!” The far-back text is blurred; the red cog is blurred; the blue dog isn’t; the first line of text is sharp; and the foremost line of text has some kind of a “ring” controlling its focus-point. And, it all works, and it’s all cool.

“Depth of field? We don’ need no schtinkin’ depth of field! This is CG! The Almighty Customer is happy!”

Ahh, but the blue dog is blurred…look closer at his tail and back feet. It’s just an example file to show how a blur map can be applied to a blur node. Defocus is the only blur node in Blender that currently has the ability to use an image map or texture map as input to control the level of blur. I only discovered this because I researched the node to answer this post. I never really cared much for the Defocus node until just now. The lack of image based blur mapping is one of the few things about Blender’s compositor that had driven me nuts for years and now I know it was just due to my own ignorance.

There are only four levels of depth in the image (IF and only IF you consider the dog to be two levels, otherwise there are only three), not five or six. The name of the artist isn’t featured in the image and if you had opened the file you would have noticed that the first two lines of text are on the same plane as the dog’s nose which, by the way, IS the focal point in the image. Although one line is in focus the other line is out of focus only on the edges of the frame. This is directly attributable to the texture based blur map mentioned above. Placing objects on separate render layers works but this is a more elegant way of achieving the result because you get the objects blurred on a horizontal, smoothly transitioning gradient. Separate render layers has a static, crappy look which is why I never liked the node. I’m not sure if this is the way it works in camera but it sure works this way in my eyes.

If I understood what Blenderguy97 was asking it was something akin to this, “How do I get DoF to Blur objects on the periphery of the in-focus plane because that’s how it works in the real world? All objects in focus on the plane for the entire width of the screen really looks crappy.” If I’m wrong then please clarify your post.

Happy Blending

Edit: I spent a couple of hours figuring a solution for this one and it works quite like I’ve always wanted it to but I never had the patience to solve this for my own personal Blending. Posts like this one are precisely why I answer help calls on this forum: they push my boundaries and make me better at compositing in the long run.