Depth Of Field, or abbreviated as DOF, is a powerful technique that can add realism to your renders or create specific focus on a part of your render. It is known as a post processing technique, but in 3D renders it can also be implemented in the rendering itself. In my opinion, implementing it in the 3D render itself gives a better result, but it increases render time by a lot. The benefit when using it as a post processing technique, is that you have more flexibility to afterwards change the amount of blur created by the DOF, and what will stay in focus in the image.
In this article I will show you how much extra realism and charm DOF adds to your renders. I will also quickly show you the 2 different methods of generating an image with DOF using Keyshot. The 2 methods are:
- implementing DOF in the render itself,
- and by post processing it in Photoshop.
The added benefit of DOF
So lets have a look at the following comparison example below. It is part of the circuit bord of a mini computer. It shows some connector pins and a little reset button. The before render shows the image without DOF. The desire is to put focus on the reset button.
By rendering out the same image, but implementing a DOF with the focus point being the reset button, we are able to obtain the after image. You can see that it adds extra realism to the image, and it also helps perfectly guide the viewers eye:
The following example show you how adding DOF is almost essential in creating an image that properly puts focus on what you want to display. In the comparison image below you can see a production skid with a lot of tubing. The image comes across as very cluttered due to the proximity of all the tubing. Now the goal of the image is to actually focus on the black steam outlet that is in frame. By adding DOF we can put the focus exactly on that. By adding the DOF the image not only serves its goal, but it also becomes more gentle on the eyes.
Creating DOF in the render with Keyshot
Adding DOF to a render in Keyshot is very easy. If you have your whole scene set up, it is a simply matter of going to the camera tab and scrolling all the way down. You end up at a section with the name Depth of Field. To activate DOF, hit the check box in front of it.
Focus Distance – This will determine what is in focus. By clicking the little aim icon in front of the numeric value, you can click in your scene what you want to have in focus.
F-Stop – This value will determine the strength of the blur. The lower the value the more blur.
The 2 examples earlier in this article were created using this method of DOF.
Creating DOF by post processing with Keyshot
The second method to add DOF to your render is by using a depth map and using that as an input channel in Photoshop to add lens blur to your image.
Now you can easily create a depth map. This is simply done by checking the Depth box in the Layers and Passes section of the Render Settings.
When you check this box and you perform your render, you will end up with an additional file, ending with the name _depth.exr. This is a 32 bit image file that looks completely white when opened in Photoshop. Now the trick is to HDR tone this image to make the actual depth info visible. To do this go to Image>Adjustments>HDR Toning… in Photoshop. The HDR toning options window will open. Set its settings similar to the image below and press OK.
After you press OK you should end up with an image like this:
This is the corrected Depth map image. It ranges from absolute black (the closest point to the camera) to absolute white (the furthest point from the camera). This image will need to be copied and pasted into a new
After that we can apply a Lens Blur to our color image, using the black and white color data from our Depth map channel to determine what will be in focus in our image. So go to Filter>Blur>Lens Blur in Photoshop (be sure that before you do this you have reselected the RGB channels again in the previous step, and not the newly created alpha 1 channel with the black and white data, otherwise Photoshop will keep showing the Depth map in the work window, instead of the color image). The lens blur options window will open.
In the Depth map>Source drop down, select your Depth map (this will probably be named Alpha 1 if you didn’t change the new channel layer’s name).
Blur Focal Distance – This value will determine what will be in focus and what not. You can actually change this value by clicking in your image what you want to have in focus.
Radius – This value will determine the strength of the blur.
I personally never change any of the other settings, but I would recommend you to just play around with them a little, so you see how they change the aesthetic of the DOF.
Using this method I created the image below. The main benefit of adding DOF in post processing, is that the amount of blur, and what will be in focus, can be changed post rendering (but rendering the blur immediately into the render often does give a cleaner result). Being able to tweak the DOF post rendering is a powerful benefit to have compared to rendering the DOF in the image during rendering.
If you would like to know more, please get in touch. Or leave any questions or remarks in the comments below?