Using Depth of Field with VRay in Cinema 4D
Using the DOF effect in Cinema 4D can be a little tricky for beginners, and it was no different for me when I had just started using VRay. So I've prepared this tutorial to show you how easy it can be once you understand the fundamentals. Creating a scene lighting setup from scratch, and using object based lighting techniques will also be covered.
Create a rectangle (Objects > Spline Primitive > Rectangle).
Under the settings of this spline, select the "Object" tab, turn on the "Rounding" option, and set the "Radius" value to "100 cm".
Add an "Extrude NURBS" to the scene (Objects > NURBS > Extrude Nurbs).
Drag the Rectangle object over the Extrude NURBS to make it child.
Change the "Movement" section, under the "Object" tab of the Extrude NURBS settings.
Select the Extrude NURBS object and make it editable (C key).
Click the little plus symbol near the Extrude NURBS object and delete the "Cap 1" and "Cap 2" objects.
Switch the viewport to Top view (F2 Key).
Select the "Use polygon tool" and then select the "Live selection" Tool.
Un-check the "Only select visible elements" section under the live selection tool settings.
Now select and delete only the faces which create the right side of geometry.
Switch to Perspective view (F1 key), and select the "use edge tool".
Select the long edge at the bottom and pull it to create a long face.
Now create a "Sphere" (Objects > Primitive > Sphere) with 40 segments and a 30 cm Radius.
Copy it two times, and place randomly from near to far (in the viewport).
Create a "Cube" (Objects > Primitive > Cube) with the dimensions 380 x 200 x 15 cm.
Place this cube object above the spheres (as it will be a light source to illuminate them)
Copy this cube object and place it on the opposite side.
Add a Camera object (Objects > Scene > Camera).
Select "Cameras > Scene Cameras > Camera" to make it the default camera.
Position the camera so you can see all of the spheres.
Switch to the Top view (F2 key), and select the camera object. Under the "Depth" tab, adjust the "Target Distance" value. As you change the value, the front part of the camera will move. Align it with the object you want to focus on (in other words, the object that you want to be clear).
Select all of the sphere objects, and under the "Object" tab, un-check the "Render Perfect" option.
To add a VrayPhysical camera tag to the camera object, select the camera, right click, and go to "VrayBridge Tags > VrayPhysical camera".
Select this tag, and under the "Sampling" tab, turn on the "DOF on" option and change the "Subdivision" to 12 (Higher values make the DOF effect clearer).
To create a new Vray material, go to "File > VrayBridge > VrayMaterial".
In the Material Editor, turn on the "Luminosity Layer", and choose a color (I used bright yellow).
Copy this material and change the color (i used light blue this time).
Now drag and drop one of these materials onto one cube object, and the other one onto the other cube.
Enter the "Render Settings" (Cmd+B).
Select "VrayBridge" under the "General" Tab.
Under the "Indirect Illumination (GI)" tab, choose a final render quality from the "Presets" (I used medium quality).
Select the "VrayPhysical camera" tag (added to camera object earlier), and under the "Lens Parameters" tab, change the "F-stop" value to "1", and the "Shutter Speed" to "100". To reduce the strength of the DOF, use higher "F-stop" values. Note: If you use a higher "F-stop" value, you will have to reduce the "Aperture" value, which will lead to a darker render because you will be blocking the light from entering the camera. To balance that problem, you can then use a lower "Shutter Speed" value to allow more time for light to enter the camera.