Builtin Library
README.md
AutoExposure
The scene's exposure, as a component.
local id = entity.spawn("exposure").id
entity(id).component.add("AutoExposure", {
auto = true,
targetGrey = 0.18,
meter = "centre",
})
The image stops being a fixed mapping from light to pixels: a dark interior opens up, a step into sunlight settles down, and the transition takes the time it takes rather than happening between two frames.
compensation is the manual half — stops applied on top of whatever adaptation
is doing, which is the knob for exposing a shot for its shadows or its
highlights. It works with auto off, as a plain exposure offset.
Every field is live: edit one in the inspector and exposure follows. With
auto off and compensation at 0 the passes are released entirely.
speedUp and speedDown name the direction exposure moves. Exposure rises
when the scene has gone darker, and that is the slower default on purpose: the
eye adapts to darkness far more slowly than to light.
The component ticks adaptation itself, so nothing else has to drive it.
The fields
compensation, minEV and maxEV are in stops, and a stop is a power of
two: +1 doubles the light reaching the image, +8 multiplies it by 256. The
defaults are the neighbourhood to author in; the accepted range is the width of
what the frame can represent, and a value outside it is refused naming the
field and the range.
| field | what it is | default | accepted |
|---|---|---|---|
auto | Whether exposure follows the scene on its own. | true | — |
compensation | Manual exposure in stops, on top of any adaptation. | 0 | -12..12 |
targetGrey | The luminance adaptation aims to put the metered average on. 0.18 is photographic middle grey. | 0.18 | 0.001..1 |
minEV | The floor adaptation may stop the image down to, in stops. | -4 | -12..12 |
maxEV | The ceiling adaptation may open the image up to, in stops. A maxEV of 8 permits 256x of adaptation gain. | 4 | -12..12 |
speedUp | How fast exposure RISES, per second, when the scene has gone darker. | 0.6 | 0 or above |
speedDown | How fast exposure FALLS, per second, when the scene has gone brighter. | 2.5 | 0 or above |
meter | Which part of the frame is read. | "centre" | full / centre / spot |
meterRadius | How wide the metered region is, where 1 reaches the middle of an edge and the corners sit near 1.42, so 2 covers the whole frame. | 0.6 | 0.001..2 |
minEV and maxEV bound the adaptation alone — how many stops it may move
away from the exposure the scene is lit for. A scene stepping between an
interior and daylight is served a stop or two either side of the defaults; a
ceiling several stops above them hands adaptation a gain large enough to carry
the whole frame to white, which is a picture the scene is not lit for rather
than a fault in a material or a render pass.
For code that changes exposure at runtime, reach for
@builtin::systems.exposure.exposure — same options, no component.
The full description of what each knob does and how the passes work is in the
package readme: guides { path = "systems/exposure" }.