DOF Tutorial by STRAT
DOF (Depth Of Field) simply put, is the lens effect that shows different areas of an image to be in sharp or blurred focus.
It's a well loved and highly used (and over-used) render technique that helps to bring forward and emphasize different areas of your imagery. Used prolifically in architectural rendering and photography it's a great way of portraying depth and atmosphere in a design or picture.
The trouble is, more often than not, it's a great drain on render resources and render times. A massive drain. Slowdowns can cripple a project's time budget to the point that it's not used at all. Because of this most pros and render studios will opt for the 'post' method of applying DOF. Applying DOF in post isn't 100% true, but super fast and efficient. And of course, it should generally only be used in subtle doses to be effective.
The trouble is, not all can afford the luxury of such post editing tools.
This tutorial describes a method of DOF that uses VRAYforC4D (any version) to render out and apply DOF to your imagery without all the long render times and massive slowdowns that ensue, and without the need for any post production software.
Basically it follows the concept of frontal mapping, using C4D as its own 'in-house' post editor so to speak.
You can download the basic C4D file I used for rendering this tutorial. Please experiment as much as you want. (min spec - VRAYforC4D 1.2)
1. First, render out your scene in VRAYforC4D as per normal, without any camera DOF. My example scene took a little under 3 minutes to render -

2. Next remove all properties from your file, ie, delete all lights, object tags, all materials etc etc. All you want to end up with is just a plane stripped down mesh and camera (mass removal of like elements in a null is a fast and painless operation).
3. Turn off GI completely and put a very low AA on (ie, aDMC 1x4x0.01).
4. Return all Colour Mapping settings to factory default (ie, no LWF, no colour modes etc etc).
5. Your camera needs a Vray Camera Tag but don't activate the exposure controls. Only DOF needs to be switched on (under the camera's 'sampling' tab). Give it a nominal sample rate, ie, 12.
6. Your initial render must now be applied to the model with 'frontal' mapping - create a new VrayforC4D Advanced material and assign your render plate image into the illum channel. Now, drag this material onto your mesh. As can be seen in the example download file, I've optimised the mesh by connecting it all together into a singular object. This makes it easier to texture. Change the material's mapping projection to 'frontal'. Now when you render you should (almost) instantaneously get your initial render on the screen. Frontal mapping is a very convenient and flexible method to help photographic and post editing within C4D. Your frontal mapped mesh -

7. Now comes the interesting part, DOF control. First off, consider the area in your image you want to either blur our or remain in sharp focus. Let's say you want some subtle blurring in the background. This will help bring out the mid-foreground ranges.
Begin by adjusting the distance spinner in the 'camera depth' tab. We want a sharp focal area in the foreground, fading to a small blur in the back, so let's adjust our focus distance to 120cm.
Next, we need to determine the strength of DOF. In the 'object manager', click on the camera object then click in the 'object' tab. This brings up the camera's properties - 'focal length', 'aperture width' and 'field of view'.
Most importantly we MUST keep the camera's 'field of view' a running constant. This must not change. I suggest you immediately select and copy this value into the memory buffer, as you'll need to paste this value back into the 'field of view' slot every time you change the 'aperture width'.
To change the strength of the blur you need to change the 'aperture width' value. For a very gently blur I suggest a value of 2-4. Higher values just increase the blur amount, to the point that both foreground and background of the focal point become blurred and the effect is most undesirable and unrealistic.
Notice that as soon as you change the 'aperture width' value the camera view port changes it's 'focal length' and 'field of view'. All you need do is paste the original 'field of view' value, 66.021 ° in our case, back into the appropriate slot. Our viewport changes back to normal whilst retaining a new 'focal length' and 'aperture width'. Hit render and you should see a sharp near distance and blurred out rear distance.
The same theory applies for a distant focal point with a near frame blur; let's change the camera's 'target distance' to 355cm and the 'aperture width' to 15 (remembering to paste the original 'field of view' back in afterwards). Hit render and you should now see a rather strong distant DOF. Here are a few examples from the download file



My example download file also has the camera's 'Depth' value adjusted over 100 frames.
Conclusion
The following images compare the two render methods; the DOF effect is most similar but the render speed difference is huge. The Frontal Mapped method is well over twice as fast when you include the pre-cache render time, and several times faster again when you use a pre-rendered pre-cached file when using similar sample settings. This rough'n'ready method should only be used most subtly to get the best out of it and the stronger the DOF is the more likely you'll have to clip a couple of pixels from the edges of your final image, due to the nature of how frontal mapped DOF calculates.


This Frontal Mapped DOF method obviously isn't as good or accurate as it's correct DOF rendered or post applied equivalents, but considering it's super fast render times, ease of use and flexibility and it's visual effect when used subtly and correctly, it's certainly an extra method worth considering when time is up against it and you need a quick fix.