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. 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 standard or physical camera, or perspective view:

Go to Render Setup > Scene > Camera/Exposure/Tone Mapping > Depth of field and check "Enable"




Focal point distance

To determine focal point distance, Corona will either use camera's target object, "Override focus" value from CoronaCameraMod or "Perspective view focus distance" value from render settings if you are rendering from a perspective view or a free camera.



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 may be used. 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. Circular:



4.2. Bladed:



4.3. Custom:




4.4. Custom, "fake chromatic aberrations":