Creating Depth Of Field With 3DSMax & Photoshop
Depth of Field is a cool effect that lets you bring focus to particular objects in the scene and blurring the 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'm just going to show the compositional way for simulating this effect with 3ds Max and Photoshop. In this way you just need to render your scene and then you can try out different distances for DOP. This way can be useful for style rendering and save a lot of time if you want to show different distances to your client.
Please Note: While I used the mental ray renderer for this tutorial, you can use VRay or Scanline as well.
So let's start!
Open the following file (using the downloadable resources below) or use your own scene:
This downloadable scene is ready for rendering. In the camera viewport hit Render. Then save the rendered image with a format that can support the alpha channel, such as TGA. Now need to get some information about depth of the scene. For this I used the 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.
Open the Render Setup dialog. In the Render Elements tab, hit Add. From the Render Elements list choose Z Depth (mostly at the end of list) and click OK (Fig.01).
Now that Z Depth element has been added to your list, choose it and in bottom of Tab you will see the Z Depth Element parameters rollout. Here there are two fields that let you setup the minimum and maximum distances. For this scene, I changed Z Min to 20 and Z Max to 150. If you are using your own scene, you should render it several times and keep changing the Z Min and Z Max values until you get the right numbers (Fig.02).
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 hitting the render button, firstly the scene will be rendered and then it will give you Z Depth in another rendered frame window. Save it (Fig.03).
Open both rendered pictures in Adobe Photoshop. While the Z Depth picture is active press Ctrl+A to select all the frames. Then press Ctrl+C to save them.
Now choose the scene picture. In the Channel tab select Alpha channel. Press Ctrl+V to paste the Z Depth picture into it (Fig.04).
If you zoom into the picture you may find there are some hard edges in the Z Depth picture. We need to smooth them before moving to the next step (Fig.05).
While the Alpha channel of the picture is selected, in the Filter menu choose Gaussian Blur from the Blur submenu. Change the Radius size until you're satisfied with the result. In this tutorial I used 0.9 in the Radius field (Fig.06).
Now in the Channel tab select the RGB channel. It will show your original picture (Fig.07).
Go to the Filter menu and this time choose Lens Blur from the Blur submenu.
In Depth Map Source select Alpha channel. Now if you click on each object or place in your picture you will find that the camera will focus on it and the rest of scene will be blurry. You can also change the distance with Blur Focus Distance. The Radius value will set the maximum and minimum amount of blurring. And in the Noise group you can add noise to the blurry area (Fig.08).
So simply you can create DOF effect in any area of your picture with compositing 3ds Max and Photoshop. Just keep in mind that this composition cannot always work accurately!