Defocus problem -- nasty lines

I’m trying to do a macro-like shot with very intense DOF. Only problem is, I get a very sharp transition between in focus and out of focus. See this picture:

And nodes:

Any ideas to eliminate that line?

different bokeh and fstops is all I can think of.
Well, okay, you could also blur the Z buffer.

Thanks. Do you think DOF distance has much to do with it?

I am pretty sure BThreshold has to do with this. Can you try 0, or a larger value like 5?

A high value can definitly fix the line, but will bring more leaves into focus.

It definitely is the bthreshold value, it will not defocus the objects within the specified threshold radius. So if you set it to 0 it will blur everything, but there is a chance that background objects start to ‘bleed’ too much into foreground objects, though sometimes that is less of a problem than the sharp differences in the amount of blur.

EDIT: wait a minute, I see now in the settings picture that bthreshold is set to 0…
Do you perhaps have some alphamapped object(s) in that scene?
Transparent objects are still visible to the zbuffer. If the leaves are texture mapped planes than try to make as tight cutouts as possible, so that there is no chance of transparent objects overlapping.

Can you post an image of your Z channel? That’d tell us a lot about whether there’s something unusual affecting the Defocus effect. I’ve run into edge artifacts on objects but never anything this severe, it does look as if some part of your scene isn’t being properly “solved” for Z value, which would affect the Defocus calculations.

my guess would also be the alpha-textures. there is a solution for this, i found it somewhere here, but i can’t find it at the moment. so i attached the method i use. i put the alpha-textured objects on different render-layers, according to there place in foreground / background. then i filter there alpha-value through some nodes and put them together. someone will surely be able to exlpain this better or find the correct node-setup- for the moment, look in the attached file.


blurring the zbuffer might mess up the nice hard edges tho (the ones that are supposed to be there.

I’ve got this same problem, but no BThreshold value helps… I’ve also tried every bokeh type, still nothing. Only seems to happen when using lots of blur.

I think you’re right on this. In my case, the z buffer shows the hard edges explaining the awkward blur. My only question is, how to get the z buffer to act properly…

A very very long shot: are the clipping planes and the distance to your objects set to reasonable values? Z-buffers (with float variables) have more precision closer to the camera than far away…

right…Try to increase the size of the clip-start( to 0.5 or 1): this will usually remove many Z-related problem :smiley: