DepthOfFieldSettings class final

Depth of field, from a lens rather than from a ramp — gfx-34n.

Every number here is one a photographer already knows. A focus distance, a focal length and an f-number are what a lens is described by, and the circle of confusion that follows from them is the thin-lens formula rather than a curve chosen because it looked right. Open aperture and the background softens by an amount somebody can predict from the three numbers, which a strength slider between zero and one cannot offer.

The depth comes from the surface buffer's alpha, which carries distance along the view axis in metres. That is the same channel the shafts read, and the reason the engine keeps it rather than depending on a sampleable depth attachment: the formula wants a real distance, and a window depth would make the same blur mean different things near and far.

Off by default, with defaults that are a no-op if it is switched on blind — focusDistance is far enough and aperture narrow enough that nothing in an ordinary scene leaves focus until somebody says so.

Constructors

DepthOfFieldSettings({bool enabled = false, double focusDistance = 10.0, double focalLength = 0.05, double aperture = 8.0, int samples = 24, double maxRadius = 16.0, double sensorWidth = 0.036})
const

Properties

aperture → double
The f-number. Eight is a landscape, 1.4 is a portrait wide open.
final
enabled → bool
Off by default: it is a full-screen gather of two dozen taps, and a scene either wants a lens or wants everything sharp.
final
focalLength → double
The focal length in metres — 0.05 is a fifty-millimetre lens.
final
focusDistance → double
What the lens is focused on, in world metres. Things at this distance image to a point; everything either side of it spreads.
final
hashCode → int
The hash code for this object.
no setterinherited
maxRadius → double
The largest circle the gather will draw, in pixels at the render resolution.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
samples → int
Taps in the gather, on a spiral. Bounded at sixty-four in the shader, the rule every loop in this engine keeps.
final
sensorWidth → double
How wide the sensor is, in metres. 0.036 is full-frame 35mm.
final

Methods

copyWith({bool? enabled, double? focusDistance, double? focalLength, double? aperture, int? samples, double? maxRadius, double? sensorWidth}) → DepthOfFieldSettings
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited