Depth of Field with Composition by Hani Mohammadi

Depth of field is a cool effect that let you bring focus to particular object in the scene and blurring rest of the background and foreground. Depth of Field (DOF) works according to Z so distance is one of the important settings.
In this tutorial I am not going to talk about DOF technique in Mental Ray or Scanline. I just show the compositing way for simulating this effect with 3DS Max and Photoshop. In this way you just need to render your scene once and as much as you like try different distance for DOF. This way can be useful for style rendering and save a lot of time if you want show different distance to your client.
Notice that in this tutorial I used Mental Ray renderer but it can work in Vray or scanline as well.
So let’s start…
1- Open the downloaded file or create your own scene.
2- This scene is ready for the rendering. In camera viewport hit render button. Then save the rendered image with a format that can support alpha channel such as TGA.
Now need to get some information about depth of the scene. For this I used Z-Depth element. This element shows depth of scene in grayscale. The nearest objects appear in white, and the depth of the scene in black. Intermediate objects are in gray.
3- So open Render Setup dialog. In Render Elements tab, hit add button. From Render Elements list choose Z Depth (mostly in the end of list) and Click on OK button.
4- Now Z Depth element added to your list, choose it and in bottom of Tab you will see Z Depth Element parameters rollout. Here are two fields that let you setup the minimum and maximum distances. For this scene is changed Z Min to 20 and Z Max to 150. If you are using your own scene, should render it several times and change Z Min and Z Max values to get right numbers.
5- Now render the scene again. But first uncheck Final Gather because we don't need to use it now and it will cost render time. After pressing the render button, firstly scene will be rendered and then will give you z depth in another rendered frame window. Save it.
|