Thanks dB Renders for providing this excellent tutorial.
Depth of Field the easy way using getcamera distance of easy way from sketchUcation.com.
Download the plugin and install it.
: Create a scene with objects positioned in different distances from the camera.
Set your camera with high focal length and low field of view; 17deg.
Open VRAY options, access camera tab, and set it to standard parameters e.g f.number to 8 , shutter speed 125.
Tick depth of field (dof) option box.
Access "plugin get camera distance from tools menu", or create a customize shortcut; mine is shift+4.
Set the point you want to focus and get the distance information in inches. (Vray works in inches)
Step 7: Check override option and put there the distance of your focus.
Choose another focal point and do the same as the previous step.
Now is time to play with your f. number to achive stronger DOF effect or subtle one.
Note: Less aperture the f.number the longer depth of field (less DOF effect). The lower the f.number the shorter the depth of field which means stronger DOF effect like in real camera. You need to adjust the other camera values to balance your exposure. Youo can see this in the next images, 11, 12,13
Now is time to get the same effect using z-depth pass from vfb channel. Then we will use the channel in Photoshop.
First untick the dof in the camera tab. This option is faster.
Go to vfb Channels tab and choose z-depth
In z-depth white value put the distance to the nearest point you have in
the scene. Also in inches use the same plugin before the measure the
In z-depth black value, place the distance of the farthest point, check z-depth clamp.
On top left corner of VRAY frame buffer you can see the channels go to z-depth to see the result.
Check the result.
Copy z-depth image
After render, your channels will be saved. You will use both of them in Photoshop.
Paste it in the channels tab as a new alpha channel
Go to Filter, blur, lens blur and search in the depth map , Source your alpha 1, now you can play with the parameters to get nice results.