Version:

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.

Provider

Atom Gem

Dependencies

Camera component

PostFX Layer component

Base properties

Depth of Field component properties

PropertyDescriptionValuesDefault
Camera EntityA reference to an entity that contains a Camera component. It’s required to enable depth of field and configure the following properties.An entity referenceEmpty
OverridesA collection of properties that you can override to compute the depth of field effect.
Enable Depth of FieldIf enabled, depth of field is in effect.BooleanEnabled
Quality LevelControls the quality of blur in the out-of-focus regions. A greater value leads to a higher quality Bokeh, but more performance load.0 to 11
Aperture FControls 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 0, the F-Number is 256. When it’s 1, the F-Number is 0.12.0.00 to 1.000.50
F Number(Read-only) The value that corresponds to Aperture F.256.00 to 0.12
Focus DistanceThe distance in meters from the camera to the focused subject. This requires that Enable Auto Focus property is disabled.-Infinite to Infinite100.0
Auto FocusRefer to Auto Focus properties.
DebuggingEnables coloring to debug the depth of field effect in the scene.
  • Red: Back, large blur
  • Orange: Back, middle blur
  • Yellow: Back, small blur
  • Green: Focused area
  • Blue green: Front, small blur
  • Blue: Front, middle blur
  • Purple: Front, large blur
BooleanDisabled

Auto Focus properties

PropertyDescriptionValuesDefault
Enable Auto FocusEnables the camera to automatically focus on a specified region.BooleanEnabled
Focus Screen PositionSpecifies the screen-space position of focus in XY coordinates. (0,0) corresponds to the top-left corner of the screen; (1,1) corresponds to the bottom-right corner of the screen.XY: 0.00 to 1.00(0.5,0.5)
Auto Focus SensitivitySimulates 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 1.0, there is no lag.0.00 to 1.001.00
Auto Focus SpeedSpecifies the distance that focus moves per second. It normalizes the distance from the view near to view far as 1.0.0.00 to 2.002.00
Auto Focus DelaySpecifies time in seconds to delay the focus when it starts to shift from one target to another.0.00 to 1.001.00

Usage

  1. 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.

  2. 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.

  3. In the Depth of Field component:

    • Set the Camera Entity property to this camera entity.

    • Activate the Enable Depth of Field property

  4. 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.

  5. 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.