pub struct AutoExposure {
pub stops: f32,
pub middle_grey: f32,
pub max: f32,
pub min: f32,
pub meter: ExposureMeter,
pub brighten_speed: f32,
pub darken_speed: f32,
pub frozen: bool,
}Expand description
The camera’s automatic exposure: the frame’s light is metered (ExposureMeter), compared with middle grey, and the
exposure moved from stops against the difference, by at most max stops down and -min stops up, approaching
those bounds smoothly (AutoExposure::correction). The scene is shown at 2^(stops - correction) times its light
before any tone curve (AutoExposure::scale).
Light is metered in the world’s light unit: where core.directional_light_unit states one, a frame lit in lux is
metered at lux divided by its lux_per_unit (the source’s own radiance unit, which middle_grey is in); where it
states none, in lux. A renderer whose frame differs from the source’s (another sky, other lights) meters another
value, and so settles at another exposure, for that stated reason.
The metered value adapts over time (AutoExposure::adapt); a still frame is shown at the adaptation’s fixed point,
where the adapted value equals the frame’s metered one.
Fields§
§stops: f32The exposure, in stops, of a frame metered at middle grey.
middle_grey: f32The metered value a frame is shown at stops for: a log2 luminance in the world’s light unit.
max: f32The most the exposure is lowered for a frame brighter than middle grey, in stops; at least 0.
min: f32The most it is raised for a darker frame, as a negative number of stops (the source’s minimum); at most 0.
meter: ExposureMeterHow the frame’s light is metered.
brighten_speed: f32How fast the adapted value rises towards a brighter frame’s metered value: per dt seconds it moves the
fraction 1 - 10^(-speed * dt) of the way. At least 0.
darken_speed: f32How fast it falls towards a darker frame’s, the same way. At least 0.
frozen: boolThe adaptation is held: the exposure is stops, whatever the frame.
Implementations§
Source§impl AutoExposure
impl AutoExposure
Sourcepub fn correction(&self, x: f32) -> f32
pub fn correction(&self, x: f32) -> f32
The stops the exposure is lowered by for a frame metered x above middle grey (negative: raised):
max (1 - e^(-x / max)) for x > 0, min (1 - e^(-x / min)) for x < 0, 0 at 0, where that bound is 0, or
where the adaptation is held. It follows x with slope 1 near 0 and approaches max above and min below.