Vray Z-Depth Render Element and Photoshop Depth of Field.
In this tutorial I will explain how to create the vray z-depth render element and then use it to create depth of field in your image in photoshop.
This tutorial refers to 3ds max design 2010 and vray 1.5sp4a. But if you are using older versions its ok...the same principles apply.
What is the Vray Z-depth render element?
Well if you aren't familiar with the vray render elements then you should read our vray render elements tutorial here.
The Zdepth pass basically creates a grayscale image of your scene with objects closer to the camera appearing as a light gray/white and objects that are far away in the distance will apprear as dark gray or black. You can adjust the distance of the zdepth image in the vray render elements rollout.
So firstly go the render setup in max and go to the render elements tab. Then click on the "add" button and choose zdepth. Adjust the zdepth min and max values in the vray zdepth parameters so that the objects you want to be blurry and effected by the DOF (depth of field) are either black or white (depending on how you want to use the DOF).
Now click render - you should be using the vray frame buffer, so the zdepth pass will be available in the drop down box in the top left corner. Now save it along with your RGB color render (the beauty shot).
Above is an example of a the RGB beauty shot.
Above is an example of the vray zdepth pass of the same scene.
Next... open up both the beauty shot and the zdepth pass in photoshop.
With the beauty shot selected, duplicate the background layer. Now with the newly created layer active press the "add vector mask" button down the bottom of your layers box.
Next, with your zdepth image active, invert the image and hit "ctrl A" to select all and then "ctrl C" to copy. Now go back your beauty shot and select the channels tab. You should see the layer mask you created earlier. Select it and press "ctrl V". Now the layer mask you created will use the vray zdepth pass for any effects you will now use on that layer.
Next go to the "filter" tab and select "blur" and choose one of the blur options (I prefer gaussian or lens blur). Now when you adjust the blurriness it will only aplly to those areas of your image that are white or light gray. It will affect the parts of the zdepth image that are lighter more than the parts which are darker. And the parts of the zdepth image that are black will be unaffected.