Log inGet started
Package

exposure.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

exposure

Exposure in stops, and eye adaptation.

local exposure = require("@builtin::systems.exposure.exposure")

exposure.set({ auto = true, targetGrey = 0.18, meter = "centre" })
exposure.get()        --> the settings in force
exposure.active()     --> are the exposure passes running
exposure.clear()      --> off, settings kept for the next set()

set takes any subset — omitted fields keep their current value. With auto off and compensation at 0 nothing is being asked for, and the passes are released rather than run at identity.

Each setting names the interval it means something in, and set refuses a value outside it — the whole call, naming the field, the value and the interval, so the scene stays on the exposure it already had. What set and get report is therefore what the frame is rendered with.

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. Each accepts -exposure.STOP_LIMIT .. exposure.STOP_LIMIT — the width of what the frame can represent — and starts at 0, -4 and 4 respectively, which is the neighbourhood a scene is usually authored in.

Adaptation moves per second of wall-clock time: the adapt pass advances by the seconds since the renderer's previous drawn frame, so it runs at the same speed whatever the frame rate, paused play included, and nothing has to call the module each frame.

speedUp and speedDown name the direction exposure moves, not the scene. Exposure rises when the scene has gone darker, and that is deliberately the slower one — the eye adapts to darkness far more slowly than to light, and matching that is what makes walking into a cave read as a moment rather than a switch.

meter decides which part of the frame is read. The thing a viewer is looking at is rarely the thing filling the most pixels, so a bright sky over a dark street would otherwise stop the street down until it is unreadable.

For exposure a scene should simply have, author the AutoExposure component instead — it carries the same settings, persists with the scene, edits live in the inspector. This module is for code that changes exposure at runtime: a cutscene, going underwater, a photo mode.

The full description of what each knob does and how the passes work is in the package readme: guides { path = "systems/exposure" }.