DOF-render takes f-o-r-e-v-e-r

well, i just saw this thread and it reminded me of the reason i skipped learning DOF a long time ago. the renders just DONT RENDER. this is in yafray btw. I render a simple scene (one lamp, ray shadows turned off, 15 duplicated cubes) in about 1.1 seconds

then with DOF and random sampling (1.7 seconds)

then DOF and QMC instead of random sampling (cut off at four hours)

what do i have to do to get a decent DOF?

Use the nodes Luke!

yea i know about the nodes…here’s what i said in the other post:
“however, IIRC you cant quite get DOF working correctly with nodes due to the unnatural edge blurring of close objects but i could be wrong.”
guess i wasn’t wrong:) i’ve seen DOF before…just dont know how they got it to work. i followed a yafray tutorial PRECISELY but it still didn’t render.

If you render Z pass in Blender’s internal renderer, you can use Defocus node.

yea, i’ve seen that before but i’ve never got it to work. i even downloaded the .blend file and replicated EXACTLY what it had but never got it to work for some reason. even the composite had a focus blur in its preview but whenever i hit F12 it never did any of the post-processing.

  • Make a render in Yafray.
  • Render Z pass in Blender.
  • Feed Yafray render and Z pass to Defocus node and tweak till you are happy.
  • Save the image you see in Viewer Node (see image editor).
    Defocus is post processing effect. There is no need to attach it to the Yafray render process.

sorry but i have no idea what you mean in 2 and 3. i’ve always tried to go though node tutorials but i never got the same results and always gave up. i’ve wasted lots of life hours trying to get nodes working.

To render the Z pass you need to set Z on in the Render Layers panel. That’s only pass you will need.

Once you have that and your Yafray image rendered, you can use Defocus as if you had rendered the whole thing in Blender Internal (see for reference). Remember that you can set the DoF distance in active camera (use Limits button to show where it is).

Try to keep it simple at first (render cube or something) till you get it.

Here is one example using Indigo:

it didn’t work. in fact, z was enabled by defalt…so i’ve always been rendering the z pass and linking it to the defocus node. like i said…i have the node setup EXACTLY THE SAME as the .blend file example. what could i be doing wrong?

edit: oh the z buffer input is rendered with blender internal? let me try that

wait, how do i get two renders without saving jpeg and reopening the file in the render layer node?

You can use Image input node to get the Yafray render in the node editor. Just save the render and open it in image input.

still didn’t work:(

The node setup looks just fine. Now you need to find nice values for Defocus. Remember to check the DoF distance setting of the camera to set the focal point. Take a look at the example .blend found in the wiki and try to mimic it.

Note that “Preview” setting is good only for previews. Disable it once you are happy with the settings. Calculating without preview takes a bit longer but it is worth it.

no cigar

Your fStop is quite small. Try making it bigger (to 3 or so) till you are happy. If you already haven’t, take a look at and tweak the values to see what they do.

thanks for trying to help but this is getting nowhere. i’ve already seen that blend file and it’s gotten to the point where you cant even tell the difference between mine and the doftest.blend example. i’ve also tried so many defocus variations that the defocus node isn’t even a question.

HOWEVER, i did notice one tiny difference between the two files.

the layer menu has a “composite”

but mine doesn’t

This may be obvious, so sorry if you’ve already tried it.

If you’re rendering and getting a image with no DoF, yet your nodes are setup correctly, then the problem is that Blender is not using the nodes to process the image. Right underneath the “Anim” button, there is another button that says “Do Composite.” You must have this enabled if you want Blender to use nodes on your image. When you enable this, you get “composite” as a layer choice in the image editor.

Alternatively, you could add a “Viewer” node - if you click on it, the image it is displaying will appear in the image editor and you could save it that way.


You haven’t selected ‘Do Composite’ button, below the large ANIM button. Without this you wont be rendering the composite window in the nodes editor.


Googleplexer - You beat me to it.

thank you guys sooooooo much!!!

i’m too lazy to upload an image because i’m sure you guys dont care too much for a bunch of cubes:)

so i guess i’ll never get real DOF?

At this point in time, not in Blender Internal. You’d have to go to something like Yafray or Indigo - something that places a higher emphasis on physically correct rendering. And if you go that route, you’ll spend more time rendering - and I know that I couldn’t help with anything that went wrong.

Really, though, there is very little reason to want “real” depth of field. In CG, it’s mostly used for artistic appeal, in which case it’s important that it looks good, not that it looks absolutely real.