IN THIS ARTICLE
Depth of Field Component
The Depth of Field component simulates the lens effects of real world cameras that focus on a specific area and blurs the out-of-focus areas.
|Camera Entity||A reference to an entity that contains a Camera component. It’s required to enable depth of field and configure the following properties.||An entity reference||Empty|
|Overrides||A collection of properties that you can override to compute the depth of field effect.|
|Enable Depth of Field||If enabled, depth of field is in effect.||Boolean||Enabled|
|Quality Level||Controls the quality of blur in the out-of-focus regions. A greater value leads to a higher quality Bokeh, but more performance load.|
|Aperture F||Controls the shallowness of the depth of field effect, which corresponds to the range of depth in the scene that’s in focus. Aperture F is measured by 1/F-Number. When this property is |
|F Number||(Read-only) The value that corresponds to Aperture F.|
|Focus Distance||The distance in meters from the camera to the focused subject. This requires that Enable Auto Focus property is disabled.||-Infinite to Infinite|
|Auto Focus||Refer to Auto Focus properties.|
|Debugging||Enables coloring to debug the depth of field effect in the scene.||Boolean||Disabled|
Auto Focus properties
|Enable Auto Focus||Enables the camera to automatically focus on a specified region.||Boolean||Enabled|
|Focus Screen Position||Specifies the screen-space position of focus in XY coordinates. (||XY: ||(|
|Auto Focus Sensitivity||Simulates a hysteresis in focus, such that when the focus changes, there is a lag before the depth of field changes. A higher value leads to more responsiveness. A lower value requires a greater difference in depth before it can refocus. When the value is |
|Auto Focus Speed||Specifies the distance that focus moves per second. It normalizes the distance from the view near to view far as 1.0.|
|Auto Focus Delay||Specifies time in seconds to delay the focus when it starts to shift from one target to another.|
Create an entity and add a Camera component. This will be referred to as camera entity in the following steps. If you already have a camera entity, use that instead.
Add a Depth of Field component to the camera entity. Depth of field depends on the properties of the Camera component. This will also prompt you to add the PostFX Layer component, as the Depth of Field component depends on it.
In the Depth of Field component:
Set the Camera Entity property to this camera entity.
Activate the Enable Depth of Field property
Configure the depth of field effect. The blur depends on two properties: the Depth of Field component’s Aperture F property and the Camera component’s Field of view property. The greater the Aperture F and the less the Field of view, the more blur.
You can see the blur level by enabling the Enable Debug Color property. Refer to the Debugging property in the Base Properties section for the color levels.