1
$\begingroup$

I'm trying to use blender render and the defocus node to shift focus over the course of a scene (by moving the empty around). This works fine.

The red bits in this image are out of focus, since the empty is way behind them: (image removed)

In this next image, the red bits are only out of focus where they do not overlap with the structures in the background... why? red bits should look like they do in the above image...

I'm stumped. Anyone have a suggestion?

Thanks! Andrew

Edit: Here's my node editor view (had to remove one of the other images due to lack of "reputation"): (image removed)

Edit2: 3D View (image removed)

Edit3: Cycles renders cycles render

$\endgroup$
  • $\begingroup$ Looks like a "wrong" composite layer order. Could you post your composite setup? $\endgroup$ – Carlo Aug 11 '15 at 11:38
  • $\begingroup$ thank you @Carlo for the swift response. Not sure what you are referring to. Where do I find the composite setup? I've setup the nodes as described in various DoF tutorials with the defocus 'image' output feeding into the composite node (Alpha: 1, Z; 1). $\endgroup$ – user3691130 Aug 11 '15 at 11:55
  • $\begingroup$ I mean the node editor, set to "compositing". Where you can tweak the "Defocus" node. $\endgroup$ – Carlo Aug 11 '15 at 11:57
  • $\begingroup$ ... ok. I've posted the node editor. I only have one layer... $\endgroup$ – user3691130 Aug 11 '15 at 12:28
  • $\begingroup$ Yes, I guessed wrong! May I ask if the rectangles in the render view are "the background"? $\endgroup$ – Carlo Aug 11 '15 at 12:34
1
$\begingroup$

I'm not able to answer your question properly, but I would post some thought about it anyway...maybe they can help.

Z-depth is a pass that stores the height information about what the camera sees.

enter image description here

This pass can be used to fake a lens blur effect. What has the empty's same z-value is in focus, while the other object are blurred. I might be wrong, but I think that the defocus node does not consider wich face is in front of another, but set only the amount of blur by the face z-depth

enter image description here

In the image above, the grey grid is the background. It has no geometry, so it has no-z informations. When the red square is blurred onto, it has no issue, there is nothing behind.

When the red square is upon the white rectangle, which is a face, and has z-info, there is a conflict in the contended area. The border pixel of the square must be blurred, so they should go upon the white square, but at the same time, that pixel should be white and in-focus, so the blur is not visible anymore.

enter image description here

enter image description here

One way to avoid this difference on the border blur is to remove the background from the view by adding a plane behind the white rectangles. You could also achieva a similar result by tweaking z-depth channel with nodes... But while we have obtain a consistent behaviour, I think that is not probably the desired one.


What you probably want is a blurred image upon a not blurred one. One way could be to separate objects in different scene, apply the node only to the geometry you know above and than mix them with alpha over node. But this is not a good solution for an animation.

enter image description here

A second option could be to switch to Cycles render. With his path tracing abilities, you don't need to fake the lens effect, but you can obtain a physically belivable behaviour, at the cost of longer render times.

enter image description here

$\endgroup$
  • $\begingroup$ Thanks again for the detailed explanation. I tried cycles but got the same strange result... I inserted the result in my original post... $\endgroup$ – user3691130 Aug 12 '15 at 5:33
  • $\begingroup$ Thtìs strange! If you could uplad your blend file whith blend-exange, I'll give a further look $\endgroup$ – Carlo Aug 12 '15 at 10:44
  • $\begingroup$ Carlo, thank you for your assistance and offer for further help. Since I don't like the 'look' I get when using Cycles, I decided to use your suggestion with different render layers. The only downside is that I have to set an additional keyframes every time I move the 'empty'... I simply manually keyframe the Z height in the background's defocus node. ... so for me, the problem is solved. $\endgroup$ – user3691130 Aug 12 '15 at 13:46
  • $\begingroup$ I did some experimenting yesterday with the default blender scene (cube, lamp, camera) by simply adding a sphere above the cube and an empty and playing around with things. I got the exact same issue - so it's not something with my blend file, but an intrinsic problem with the strategy blender render uses to 'fake' DoF - as you explained in your answer... $\endgroup$ – user3691130 Aug 12 '15 at 13:49
  • $\begingroup$ ... anyway, thanks again for helping this newbie out ... I learned a lot in the past 24h! $\endgroup$ – user3691130 Aug 12 '15 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.