Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage exposure.package·originates fromworld 07158574-5…●1problem

exposure

Exposure in stops, and eye adaptation.

by◐lumi·posted 4mo ago
What it does

exposure

Exposure in stops, and eye adaptation.

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

exposure.set({ auto = true, targetGrey = 0.18, meter = "centre" })
exposure.tick(dt)     -- adaptation is a rate; give it the frame's delta
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.

tick is separate from set because adaptation moves per second: the passes need each frame's own delta to run at the same speed whatever the frame rate. The AutoExposure component calls it; code driving this module directly calls it once a 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, and ticks itself. 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" }.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

module exposure Exposure in stops, and eye adaptation — the image settles when the scene gets brighter or darker instead of clipping or going black. require systems/exposure/exposure

pushExposure(ev: number) → void

The metered exposure reaches the picture through the chain's display pass, the same knob a hand-set exposure is.

argtypedescription
evnumber

describe(field: string) → string

The interval in words, for the message a rejection carries. Phrased the way a ranged component field phrases its own, so a setting reads the same whether it was refused here or at the component that declared it.

argtypedescription
fieldstring

ranged(o: any, field: string, current: number) → number

A setting the caller stated, checked against the interval it means something in. An omitted field keeps its current value; a stated one is taken as written or refused naming the field, the value and the interval — the same answer `meter` gives to a name it does not have, so one call reports every setting it could not honour the same way.

argtypedescription
oany
fieldstring
currentnumber

num(v: any, fallback: number) → number

argtypedescription
vany
fallbacknumber

bool(v: any, fallback: boolean) → boolean

argtypedescription
vany
fallbackboolean

buffers( ) →

The buffers the exposure passes read: `params` carries the settings this module packs, `state` is the adaptation value the GPU owns between frames. The render feature binds what this hands it.

examples

local b = exposure.buffers()

pushParams( ) → void

ensureFeature( ) → void

dropFeature( ) → void

set(opts: ExposureOpts?) → ExposureState

Set the scene's exposure. Any omitted field keeps its current value, so a call can adjust one knob without restating the rest. With `auto` off and `compensation` at 0 nothing is being asked for and the passes are released. Each setting names the interval it means something in, and a value outside that interval is refused naming the field, the value and the interval — the whole call, so the scene stays on the exposure it already had. The settings this returns are therefore the settings the frame is rendered with.

argtypedescription
optsExposureOpts?Exposure settings — see `ExposureOpts`.

examples

exposure.set({ auto = true, targetGrey = 0.18, meter = "centre" })

tick(dt: number) → void

Advance adaptation by `dt` seconds. Adaptation is a rate, so the passes need the frame's own delta to move at the same speed whatever the frame rate. The `AutoExposure` component calls this; code driving the module directly calls it once a frame.

argtypedescription
dtnumberSeconds since the last frame.

examples

exposure.tick(dt)

get( ) → ExposureState

The exposure settings currently in force.

examples

local ev = exposure.get().compensation

clear( ) → void

Turn exposure off and release the passes. The display goes back to the exposure that stood before the metering started. The other settings are kept, so a later `set` brings back the same behaviour.

examples

exposure.clear()

active( ) → boolean

Whether the exposure passes are currently running.

examples

if exposure.active() then print("metering") end
⌬ Types
ExposureOpts = {

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

These counts cover only the parts this page shows. Problems on the parts it leaves out are not counted here.

1+problem

Inside

1 problem across 1 item
●
dep.unresolved · L130
could not resolve `@builtin::systems.exposure.exposure.live`
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.