Depth of field - the artistic effect of blurring the foreground or background with focus on a specific scene can be done in two ways - use the deph-of-field camera setting or you can get a special Zdepth channel with which to process the image in Photoshop.Consider the first option of obtaining depth of field, namely the depth of field of the camera.I use the Vray camera in my scene.All depth-of-field settings are just for her. For a standard camera, the depth of field is adjusted differently.The depth of field in the Vray camera is triggered if several nuances are taken into account:Turn on the depth-of-field function: It is important to arrange the camera itself, namely - where its target is located, the camera's goal should be in the middle of the object, to which we focus, while the focus range will be the near and far boundaries of the camera. Look at the example below, he explains: At the same time, my camera settings are as follows: In addition, the depth of field does not work, if the value of F-nummer is not reduced, the smaller the value, the more the effect will appear, but as the value decreases, the brightness of the image increases, so together with decreasing F-nummer, decrease the Film speed (ISO) To lower the brightness. I'll do it by sight, but approximately the multiplicity of the values should be one to three.Turning on the depth-of-field option very slows the render, so I hid everything except trees, paths, land and benches and tried setting them, for quick visualization. By choosing the camera position, F-nummer, Film speed (ISO), I decided on the next option.Camera position: Camera settings: Pay attention to the parameter Subdivs in the rollout of Sampling settings - this is the blur quality. For rough rendering I'll leave it as it is, but for the final one this parameter will need to be increased.Here's what happens at the moment: I notice that the render has become MUCH slower - the price for an honest depth of field.Now I turn off the depth of field: I want a little more sun in the scene and a little denser than the shadow, for this I'll select the sun, go to its modifier and change the following parameters: Render area with grass: Render elements.It's time for the final settings, but before, I want to think about some render elements that I can then use for post-processing.The most important element renderer will be VrayMtlID.I'll go to the Render elements and turn on the item - I'll select it from the list of offered elements and change its type to Color (with AA): Now you need to determine which scene materials I want to select for this item. In total, I can assign 15 colors, the amount is limited. I'll go to the materials editor and do the Reserts Material Editor Slots: Next, I will take the required materials from the stage with a pipette and add an element to them.Let's start with clover. We take a pipet from it with the material and go into the first sub-material. Then click on the button 0 and select the number 1: For the second sub-material I will choose the digit 2: In the bushes I'll render the element only for leaves = 3: Trees - render element only for leaves = 4,Forged parts of the bench = 5,Border = 6Road = 7,Birches leaves = 8 (in Front material): Needles Christmas tree = 9 (in the Front material) and so on, choose the materials that you think fit.If we now render the region a scene, we will see: Let's go into render elements and change RGB color to VrayMtlID: We will see a color picture - each element is painted in a certain color, which in post-processing we will serve as a selection mask if necessary: I'll add more render elements: Vray rereflection, Vrayspecular: In order for the elements to be rendered to be saved automatically go to the Vray: Frame buffer tab, check the Save separate render channels check box, click the Browse button and enter the save path. I will save in the format tif 16 bit: Final render settings.Raise the sky resolution to the maximum value of 2048 in the VrayDomeLight modifier: Turn on the map of the display in the material of the road: I'll select the camera, turn back the depth-of-field effect and raise the render quality of this effect (subdivs): Increase the resolution of the desired image: Further render settings on the screenshots (I use over-configured settings not recommended by Renderstuff, for which I will greatly forget the rendering time): I'll save, click on the render and I'll wait. I will have to wait very long.At the end of the render, I save the additional picture to the Open EXR format.RESULT - Render time: 27 hours, 36 minutes, 57 seconds: Below I will show the rendered elements.VrayMtlID: VrayReflection: VraySpecular:
It seems to me that anyone will understand that an honest depth of field should not be done because of a very long time of visualization, this is done in extreme cases, when the quality of the image is much more important than the rendering time. In such cases, it is appropriate to use a render farm, whose capacities are huge and you will get the desired image much faster than on your own computer. Because I'm writing a lesson and I'm not in a hurry, I was interested in comparing two approaches to the depth-of-field effect, so I rendered myself. In addition, I have never used the render-farm before, I had doubts whether the renderer will be in the format that I need, the elements will be preserved, etc. There were a lot of questions and I was just afraid, although probably one day I will use the render-farm services.
Now consider the second option of obtaining the depth of field.
As I said at the beginning of the lesson, there is another method of creating a depth-of-field effect - you need to render an additional Z-Depth channel.
This is not difficult at all. The very first thing we need to do is go to the camera settings and uncheck the depth-of-field:
The second is to connect the renderer element called: VrayZDepth:
Next, you need to measure the distance spreading this very depth of field. Take the Tape tool and stretch it from the camera to the end of the scene, and see the distance from one point to another:
After that, it remains to enter this value in the parameter zdepthmax:
Click on the render and wait. Using this method, do not forget to set the final render settings, as well as prescribe the way to save the render of the elements to the folder you need.
With my render settings, I waited about 2.5 hours:
On this, this lesson can be considered finished. Remains the last important part - image processing, without which the picture looks incomplete. All further work on the processing will take place in Photoshop. Below I will show some basic intermediate results of postprocessing, but I will not emphasize the methods of creating them, so the horses are completely identical to those shown in my lesson "Modeling a room in 3ds Max and rendering an interior in V-Ray", who did not read - welcome; ) As in the aforementioned lesson, for rendering post-rendering and saving the render in HDR fotmats and after simple manipulations with Exposure (zonal clarified some bushes and parts of the bench, as well as darkened asphalt and curb), I convert to LDR: Similar to Exposure, zoned the color saturation with Saturation: The Curves tool has corrected the curves for Red, Blue and Green to your taste: Adjusted Brightness / Contrast: Add depth of field using the Zdepth channel. In order to add or enhance the depth-of-field effect in Photoshop, you need to do the following: Open the channel in Photoshop: Press the key combination Cntr + A - select all, then Cntr + C - copy everything. Switch to the original image, where we will add depth of field and press the combination key Cntr + J - duplicate the layer: Let's create a mask for this layer: We go into the channels, select the line Mask-layer1, turn on the glazik: On the Mask-Layer1 line, press Cntr + V - paste the copied, open the eye: Return to the layers, and select the second layer icon, which we duplicated: Next, go to Filter - Blur - Blur with shallow depth of field: This window opens: In it you need to specify that the depth of field we want to read from the mask of this layer and tweak the blur parameters to your taste. The mask can also be inverted here. All that is black and dark on the mask layer will blur more, white and light - less. If the effect does not seem to be enough, you can twist the contrast of the black and white mask itself, darken it or light it up on the contrary. With all this, turn on and turn off the check mark and compare how it was before and after. Entering the photo in the render. Now, in order to complete what was started, namely, to do something essentially similar to Denis's example with a girl sitting on a bench, I decided to add the girl's clipart to my renderer: Perhaps not entirely fortunately, but to illustrate the example of how it might look - it will do. As for the very reception of the photo in the render, it is pretty standard among the trideshniki and dvideshnikov, the tutorials on which the Internet is flooded, so I will not describe it in the framework of this lesson. In any case, I hope that my work will be useful to you and many of you will be stressed out of this lesson about rendering an exterior that is useful for yourself😉