Skip to content

Kuesa::Qt3D::DepthOfFieldEffect

Module: Kuesa Qt 3D API

Post-processing effect implementation of a depth of field. More...

#include <Kuesa/Qt3D/api/fx/depthoffieldeffect.h>

Inherits from Kuesa::Qt3D::AbstractPostProcessingEffect, Qt3DCore::QNode

Public Slots

Name
void setFocusRange(float focusRange)
void setRadius(float radius)
void setFocusDistance(float focusDistance)

Public Signals

Name
void focusRangeChanged(float focusRange)
void radiusChanged(float radius)
void focusDistanceChanged(float focusDistance)

Public Functions

Name
DepthOfFieldEffect(Qt3DCore::QNode * parent =nullptr)
~DepthOfFieldEffect() override
float focusRange() const
float radius() const
float focusDistance() const

Public Properties

Name
float focusRange
adjusts the breadth of the area which will be in focus.
float focusDistance
adjusts the focal distance.
float radius
adjusts the radius of the depth of field effect.

Additional inherited members

Public Types inherited from Kuesa::Qt3D::AbstractPostProcessingEffect

Name
enum Type { Custom}
using QSharedPointer< Qt3DRender::QFrameGraphNode > FrameGraphNodePtr

Public Functions inherited from Kuesa::Qt3D::AbstractPostProcessingEffect

Name
~AbstractPostProcessingEffect()
Type type() const

Protected Functions inherited from Kuesa::Qt3D::AbstractPostProcessingEffect

Name
AbstractPostProcessingEffect(Qt3DCore::QNode * parent =nullptr, Type type =Custom)

Protected Attributes inherited from Kuesa::Qt3D::AbstractPostProcessingEffect

Name
const Type m_type

Detailed Description

1
class Kuesa::Qt3D::DepthOfFieldEffect;

Post-processing effect implementation of a depth of field.

Since: Kuesa 2.0

DepthOfFieldEffect implements an effect which simulates a more realistic camera behaviour, where only part of the scene is in-focus, and very far & very close objects are out-of-focus and thus blurred.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <Qt3DExtras/Qt3DWindow>
#include <ForwardRenderer>
#include <SceneEntity>
#include <DepthOfFieldEffect>

Qt3DExtras::Qt3DWindow win;
Kuesa::Qt3D::SceneEntity *root = new Kuesa::Qt3D::SceneEntity();
Kuesa::Qt3D::ForwardRenderer *frameGraph = new Kuesa::Qt3D::ForwardRenderer();
Kuesa::Qt3D::DepthOfFieldEffect *dofEffect = new Kuesa::Qt3D::DepthOfFieldEffect();

dofEffect->setRadius(10.5f);
dofEffect->setFocusDistance(100.0f);
dofEffect->setFocusRange(25.0f);

frameGraph->addPostProcessingEffect(dofEffect);

win->setRootEntity(root);
win->setActiveFrameGraph(forwardRenderer);
...

Example

dof_distance_5.pngDepth-of-field effect applied on a Kuesa scene.

Public Slots Documentation

slot setFocusRange

1
2
3
void setFocusRange(
    float focusRange
)

See: DepthOfFieldEffect::focusRange

Sets the focal range to focusRange.

slot setRadius

1
2
3
void setRadius(
    float radius
)

See: DepthOfFieldEffect::radius

Sets the blur radius to radius.

slot setFocusDistance

1
2
3
void setFocusDistance(
    float focusDistance
)

See: DepthOfFieldEffect::focusDistance

Sets the focus distance to focusDistance.

Public Signals Documentation

signal focusRangeChanged

1
2
3
void focusRangeChanged(
    float focusRange
)

signal radiusChanged

1
2
3
void radiusChanged(
    float radius
)

signal focusDistanceChanged

1
2
3
void focusDistanceChanged(
    float focusDistance
)

Public Functions Documentation

function DepthOfFieldEffect

1
2
3
DepthOfFieldEffect(
    Qt3DCore::QNode * parent =nullptr
)

function ~DepthOfFieldEffect

1
~DepthOfFieldEffect() override

function focusRange

1
float focusRange() const

function radius

1
float radius() const

function focusDistance

1
float focusDistance() const

Public Property Documentation

property focusRange

1
float focusRange;

adjusts the breadth of the area which will be in focus.

See: DepthOfFieldEffect::focusDistance

This adjusts the size of the part of the scene which will be in focus. At 0.0, everything will be blurred. The bigger the value, the more of the scene will be in focus, centered on the focusDistance.

Range 2.0 Range 8.0
dof_range_2.pngdof_range_2.pngdof_range_2.pngdof_range_2.pngdof_range_2.png dof_range_8.pngdof_range_8.pngdof_range_8.pngdof_range_8.pngdof_range_8.png

property focusDistance

1
float focusDistance;

adjusts the focal distance.

See: DepthOfFieldEffect::focusRange

This adjusts the focal distance, that is, the objects at this distance from the camera will be focused; those too close or too far away will be blurred.

Distance 5.0 Distance 8.0
dof_distance_5.pngdof_distance_5.pngdof_distance_5.pngdof_distance_5.pngdof_distance_5.png dof_distance_8.pngdof_distance_8.pngdof_distance_8.pngdof_distance_8.pngdof_distance_8.png

property radius

1
float radius;

adjusts the radius of the depth of field effect.

The bigger the radius is, the more the out-of-focus objects will appear to be blurred.

Radius 4.0 Radius 42.0
dof_radius_4.pngdof_radius_4.pngdof_radius_4.pngdof_radius_4.pngdof_radius_4.png dof_radius_42.pngdof_radius_42.pngdof_radius_42.pngdof_radius_42.pngdof_radius_42.png

Updated on 2022-10-18 at 11:12:51 +0200