HDDepthOfField

Classes

HDDepthOfField : NativeComponent

This component provides control over depth of field (DOF) properties in HD Renderer.

Depth of field simulates camera lens focus, blurring objects that are closer or farther than the focus range. Objects within the focus range (between focusRange.x and focusRange.y) are sharp, while objects outside are gradually blurred proportionally to nearAmount and farAmount.

To use this component, add the following line to your project file:

require engine.core_components.hd_depth_of_field_component // or require engine.core

Usage example:

let renderSettings = create_render_settings()
add_component(renderSettings, new HDDepthOfField())
get_component(renderSettings) $(var dof : HDDepthOfField?) {
    dof.active = true
    dof.focusRange = float2(2.0, 50.0)
    dof.nearAmount = 100.0
    dof.farAmount = 100.0
}
Properties:

HDDepthOfField.active: bool
HDDepthOfField.active =(value: bool)

Active flag. Allows for toggling depth of field on and off without removing the component.

Arguments:
  • value : bool

HDDepthOfField.focusRange: float2
HDDepthOfField.focusRange =(value: float2)

Focus range. x = near focus boundary (objects closer than this are blurred), y = far focus boundary (objects farther than this are blurred). Objects between x and y are in focus.

Arguments:
  • value : float2

HDDepthOfField.nearAmount: float
HDDepthOfField.nearAmount =(value: float)

Blur intensity for objects closer than focusRange.x, in range [0, 100]. At 0 near blur is disabled.

Arguments:
  • value : float

HDDepthOfField.farAmount: float
HDDepthOfField.farAmount =(value: float)

Blur intensity for objects farther than focusRange.y, in range [0, 100]. At 0 far blur is disabled.

Arguments:
  • value : float