How to enable and control Depth of Field (DOF) in Corona for 3ds Max?

This article explains how to enable the Depth of Field (DOF) effect in Corona and how to control its appearance. 

on-givsaa4-hc10-denoise.png

 

Table of Contents:

 

Enabling Depth of Field

When rendering from a Corona Camera:

Simply enable the Depth of Field checkbox in the Corona Camera you are rendering from (DOF & Motion Blur > Depth of Field):

dof-checkbox.png

Once the checkbox is enabled, all Depth of Field options become active in the Corona Camera and are considered when calculating the Depth of Field effect (bokeh shape, center bias, vignetting, etc).  

See: How to use the Corona Camera?

 

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. 

 

When rendering from a standard 3ds Max camera:

Go to Render Setup > Camera > Camera > Dept of Field and check the "Enable" checkbox. You can then use the settings available in the Camera tab of the Render Setup window to control the Depth of Field effect (bokeh shape, sensor width, F-stop): 

 

mceclip0.png

 

Notes: 

  • It is not possible to enable Depth of Field for a free (non-camera) view.
  • The "Enable" Depth of Field checkbox in the Camera tab of the Render Setup window does not affect DOF settings when rendering from a Corona Camera or a 3ds Max Physical Camera. The in-camera settings have a higher priority over this. 

 

DOF Settings, Quality, Performance

Focal point distance

To determine the focal point distance, Corona uses either the current camera target distance or its "Override focus" value:

dof-override-focus.png

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

This calculates the distance from the camera exactly to the point on the surface picked (not the object pivot!) and inserts the value into the camera's target distance or focus override (if enabled). 

 

Photographic Exposure Controls

Depth of field is affected by the photographic exposure controls. Changing the f-stop value affects the appearance of the DOF effect, just like in real life. 

See: How to use photographic exposure controls?

 

 

DOF Highlights Solver

When enabled, the DOF Highlights Solver greatly improves the quality of the blurring of any highlights in the rendered image (both reflections, and directly-viewed lights):

dof-solver-on.png

[Click here to see interactive comparison]

 

You can find it in Render Setup > Performance > Performance Settings and enable it with a single checkbox:

dof-solver.png

 

Important notes: 

  • The DOF Highlights Solver improves the quality of highlights at the cost of other rendering effects. This means that when rendering an image within a specific time limit (e.g. 10 minutes) with the DOF Highlights Solver enabled, the quality of some image effects, such as GI or anti-aliasing, may become slightly worse than in the case of rendering the same image for the same time with the DOF Highlights Solver disabled. 
  • Regular (non-highlights) DOF blurring is unaffected by the DOF Highlights Solver. This means that if you are rendering a scene with DOF, but there are no visible highlights in the image, enabling this option may not be beneficial. 
  • The Budget and Reprojection count settings are set to optimal values by default. Usually there is no need to change them. 
  • At the moment, the DOF Highlights Solver is listed as "experimental" as there may be some niche situations where it does not work as expected. 
  • The DOF Highlights Solver works optimally with the High Quality image filter. It can be used with other filter types, such as Tent, but it may produce more noise and generally perform worse. 
  • The DOF Highlights Solver can only be used with non-VR perspective cameras without any distortion.
  • For further information on DOF Highlights Solver limitations, see: DOF Highlights Solver Error Messages

 

DOF Quality

The DOF Highlights Solver can greatly improve the quality of highlight blurring, but the overall quality of  the depth of field effect (dark areas, object edges, etc) is mainly dependent on anti-aliasing.

Even when using the DOF Highlights Solver, to focus computing power more on anti-aliasing than on the GI sampling, thus increasing the rendering speed of DOF at the cost of other effects, you can decrease the "GI vs. AA balance" value to about 4-8. Values lower than 4 should be avoided as they usually increase render times without further quality improvement. 

See: Where are supersampling / antialiasing controls in Corona?

 

DOF Quality - Examples with different render settings:

DOF Highlights Solver:

Render time: 10 minutes

GI vs AA set to 16 (default value)

DOF Highlights Solver on and off

on-default.png

Click here to open the interactive comparison

Conclusion: the DOF Highlights solver improves the quality of out-of-focus highlights. Enabling it does however result in slightly lowered quality of other effects, such as GI. 

 

Lowering the GI vs AA value: 

Render time: 10 minutes

DOF Highlights Solver on

GI vs AA set to 16 and 4

on-givsaa4.png

Click here to open the interactive comparison

 

The differences are subtle (they are mainly visible at the central points of the DOF highlights), but the render stamp shows 69 passes rendered with GI vs AA set to 16 and 146 passes rendered with GI vs AA set to 4. With GI vs AA set to 4, roughly twice as many passes were rendered, which can be translated to "two times better anti-aliasing quality". 

We can check the Indirect Illumination render element to confirm that increasing the quality of the DOF highlights comes at slight expense of GI quality. More noise is visible mainly close the the light source in the lower-right corner of the image. Click here to see the Indirect Illumination render element. 

Conclusion: lowering the GI vs AA value results in increased quality of the DOF highlights. This is again at some expense of GI quality. 

 

Increasing the GI vs AA value: 

Render time: 10 minutes

DOF Highlights Solver on

GI vs AA set to 16 and 64

on-givsaa4.png

Click here to open the interactive comparison

 

This example demonstrates how increasing the GI vs AA value makes the DOF quality worse. This is clearly visible on the DOF highlight edges and centers and is confirmed by the number of rendered passes - 69 with GI vs AA set to 16, but only 23 with GI vs AA set to 64. 

Conclusion: the higher the GI vs AA value, the lower the quality of DOF highlights. 

 

Highlight Clamping: 

To make the blurred highlights even "easier" to render for the DOF Highlights Solver, thus increasing the rendering speed at the cost of some realism and dynamic range in your image, you can enable highlight clamping

Render time: 10 minutes

DOF Highlights Solver on

GI vs AA set to 4

Highlight Clamping off (value set to 0) and on (value set to 10)

on-givsaa4-hc10.png

Click here to open the interactive comparison

 

Enabling Highlight Clamping slightly increases the quality of DOF effects, mainly by removing "fireflies" (single bright pixels). In this example, after changing the Highlight Clamping value from the default 0 (disabled) to 10, the number of passes also rose from 143 to 146. Note that because of highlight clamping, the brightest parts of the image became darker.

Note: if you wish to save your output to a high dynamic range format, such as 32-EXR or HDR, by enabling Highlight Clamping you lose some of the dynamic range. 

Conclusion: Highlight Clamping can be used to further increase the quality of DOF highlights, but the price is lowered brightness of the highlights and lack of high-dynamic range in the rendered image. 

 

Denoising:

Finally, you can enable denoising to reduce noise in the DOF highlights and all other areas of the image. 

Render time: 10 minutes

DOF Highlights Solver on

GI vs AA set to 4

Highlight Clamping on (set to 10)

Denoising on (Intel AI Denoiser) and off 

on-givsaa4-hc10-denoise.png

Click here to open the interactive comparison

 

Denoising smartly blurs noise in the rendered image. Remember that too strong denoising may blur too much detail. In this example, the Intel AI Denoiser was used. 

 

 

Fisheye Camera and DOF

Starting with Corona 9, it is possible to enable the Depth of Field in a Fisheye Camera. Simply create a Corona Camera, open the Projection & VR rollout, and set the Type to "Fisheye":

Corona9_VR.jpg

Then enable depth of field as usual: 

dof-checkbox.png

 

Scene Setup:

Corona_Camera_Fisheye_DOF_Scene_Setup.jpg

 

Render:

Corona_Camera_Fisheye_DOF_Example_01_Render.jpg

 

 

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 the 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 the camera's sensor size to the corresponding units (for example meters instead of millimeters).

 

 

Examples

DOF Highlights Solver

Render time: 10 minutes. DOF Highlights Solver disabled: 

off-default.png

Click here to open the interactive comparison

 

Render time: 10 minutes. DOF Highlights Solver enabled: 

on-default.png

Click here to open the interactive comparison

 

Render time: 5 minutes. DOF Highlights Solver disabled: 

dof-solver-off.png

Click to see interactive comparison

 

Render time: 5 minutes. DOF Highlights Solver enabled: 

dof-solver-on.png

Click to see interactive comparison

 

F-stop

Just like in photography, increasing the F-stop value makes the DoF effect more subtle. Decreasing F-stop value makes it more pronounced.

 

F-stop = 2 - pronounced DoF effect

f2.jpg

 

F-stop = 4

f4.jpg

 

F-stop = 16 - subtle DoF effect

f16.jpg

 

 

Target distance

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

k3.jpg

 

Camera target placed in the center:

k1.jpg

 

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

k2.jpg

 

 

Sensor size

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

F-stop=4, Sensor width=35mm

f4__1_.jpg

 

F-stop=4, Sensor width=100mm

f4sensor100.jpg

 

 

Bokeh type

Image rendered with no depth of field:

bokeh-nodof.jpg

 

Circular:

bokeh-default.jpg

 

Bladed:

bokeh-bladed.jpg

 

Custom:

custom1.jpg

bokeh-custom1.jpg

 

Custom, "fake chromatic aberrations":

custom2.jpg

bokeh-custom2.jpg

 

Center Bias 1:

bokeh-center-bias-1.jpg

 

Vignetting 2:

bokeh-vignetting-2.jpg

 

Center bias 1 and vignetting 2:

bokeh-vignetting-2-bias-1.jpg

 

Anisotropy 0,5:

bokeh-anisotropy-05.jpg

 

Anisotropy -0,5:

bokeh-anisotropy-minus05.jpg

 

 

 

Was this article helpful?
1 out of 1 found this helpful