Sunday, February 25, 2007

Blender 2.43 Depth-of-Field

I recently posted on the Christian Filmmakers Email List - Tech a quick tutorial on how to use Blender 2.43's new Defocus node to create a realistic depth of field. After posting the first tutorial, (which simply doesn't compare with the release notes page at the link below) I was asked to post an example .blend with the node settings for DoF. Here's the original tutorial, with an example frame and the .blend file below.

The DoFDist setting in the Camera Edit menu (F9) feeds a new node, the Defocus node. Turn on Limits in the Camera Edit menu. You will see a yellow X on the sight line where the focus point is set. Adjust the DoFDist slider until the X is at the approximate point where you want sharp focus. Then go to Node view and add a new Defocus node. Wire in the RenderLayer, but do not wire it to a Composite or Viewer until you get the settings in place--else Blender feels the need to recomposite after every change. For some reason, it takes a lot longer to do that while you are changing settings than when you finish. Then turn off Preview Mode and No Zbuffer in the node, verify the Zbuffer from the RenderLayer is wired in as well as the RGB, and adjust the f-stop down. 128 focuses to infinity, so to test it, you might want to change it to 32 or even 16 (half the f-stop doubles the blur). After you have all that set, you can enable Composite rendering in the main render menu (F10) and wire the Defocus node into the Composite output node. Just be sure to unlink it again before changing the defocus settings.



Here is a proof-of-concept render I tried, the classic line-of-spheres scene. I rendered it with f-stop=8 and OSA=16 to HD resolution. The full image render is available at http://www.youngchristianstudios.com/2.43_DOF.jpg.

The .blend file is below. It is a simple scene with 1 light, 1 camera, and 16 spheres. (15,904 verts) It rendered with two threads in 1:44:44 on my 2.8 GHz Pentium 4, though I was running some other programs at the same time. The .blend is available at http://www.youngchristianstudios.com/2.43_DOF.blend (1.1 Mb).

I hope this helps you get out there with 2.43 and render even more photo-realistic scenes!