How to enable and control Depth of Field (DoF)?

 


How to enable Depth of Field?


1. When rendering from a Corona Camera:

Simply enable Depth of Field in the Corona Camera's settings (DOF & Motion Blur > Depth of Field). All available Depth of Field options are then available in the Corona Camera UI (focus target, f-stop, bokeh shape, center bias, vignetting). 

See: How to use the Corona Camera?



2. When rendering from a 3ds Max Physical Camera:

Check the "Enable Depth of Field" checkbox in the currently used 3ds Max Physical Camera. Depth of field is then controlled using the provided photographic controls.

Note: we strongly suggest using the dedicated Corona Camera instead of the 3ds Max Physical Camera. 



3. When rendering from a standard 3ds Max camera:

Go to Render Setup > Scene > Camera/Exposure/Tone Mapping > Depth of field and check "Enable". Render setup values can then be used to control the depth of field effect (bokeh shape, sensor width, F-stop).



Note #1: it is not possible to enable Depth of Field for a free (non-camera) view. 

Note #2: using the "Enable" Depth of field checkbox in render setup does not affect DOF settings when rendering from a Corona Camera or a 3ds Max Physical Camera. The camera settings have a higher priority over this. 




Focal point distance

To determine the focal point distance, Corona will either use the current camera's target distance or "Override focus" value from the Corona Camera.

The focal distance can also be set directly from the VFB by activating the "Pick" button and right-clicking on an a point in the render and selecting "Set focus to this point"

This will calculate the distance from the camera to the picked point (not object itself) and insert the value in the camera's depth of field override value.

The camera's depth of field and "override focus" must both be enabled for this to affect visible DOF (otherwise only the camera's target will be moved). The point also has to be placed on geometry.


Photographic Exposure Controls

Depth of field is affected by photographic exposure controls.

See: How to use photographic exposure controls?



Depth of Field Quality

The quality of depth of field is mainly dependent on anti-aliasing (AA samples). To focus computing power more on anti-aliasing than on GI-sampling, you can decrease "GI vs. AA balance" value to about 4-8.

See: Where are supersampling / antialiasing controls in Corona?




Troubleshooting


DoF effect is too weak, everything is sharp even if I set very low F-stop values such as 0,1!

This may be caused by using wrong scene scale (incorrect units). The dimensions of objects in the scene should correspond to the size of camera's sensor width. If you are, for example, using millimeters instead of meters (or vice versa), you need to either rescale the scene or set camera's sensor size to corresponding units (for example meters instead of millimeters).


DoF does not work with 3ds Max 2016 Physical Camera!

Please see this solution: [ link ]




Examples


1. F-stop

As in photography, increasing the F-stop value will make DoF effect more subtle. Decreasing F-stop value will make it more pronounced.

1.1 F-stop = 2 - pronounced DoF effect



1.2. F-stop = 4



1.3. F-stop = 16 - subtle DoF effect




2. Target distance

2.1. Camera target placed in the far end to focus on the blue ball:



2.2. Camera target placed in the center:



2.3. Camera target placed close to camera to focus on the purple ball:





3. Sensor size

Sensor size also affects the appearance of DoF effect. Increasing it makes DoF effect more pronounced.

3.1. F-stop=4, Sensor width=35mm


3.2. F-stop=4, Sensor width=100mm




4. Bokeh type

4.1. Image rendered with no depth of field:



4.2. Circular:



4.3. Bladed:



4.4. Custom:



4.5. Custom, "fake chromatic aberrations":




4.6. Center Bias 1:



4.7. Vignetting 2:



4.8. Center bias 1 and vignetting 2:



4.9. Anisotropy 0,5:


4.95. Anisotropy -0,5: