firstlight
The hour between deep night and first light on the Parthian ridge, written as a ramp.
firstlight
The hour between deep night and first light on the Parthian ridge, written as a ramp.
local Ramp = require("game.light.firstlight")
local look = Ramp.at(0.42) -- 0 = deep night, 1 = the sun clear of the ridge
M.at(light) reads the whole environment off ONE axis and hands back a
Look:
| Field | What it carries |
|---|---|
sun | the directional light's travel dir, its color and intensity |
ambient | the ambient light's color and intensity |
sky | timeOfDay, stars, exposure, turbidity, sunSize, sunIntensity and the zenith / horizon / ground colours |
fog | the depth fog's density and color |
grade | what the post-process chain runs: exposure, contrast, saturation, brightness, tint, vignette, vignetteRadius, bloomThreshold, bloomIntensity, bloomRadius |
sunAltitude | degrees the sun stands over the ridge; negative is still under it |
Four keys carry the ramp, and M.keys() hands them back for anything that
wants to draw it rather than fly through it:
light | The key |
|---|---|
0.00 | deep night — indigo, stars out, ember the only warm light |
0.55 | the greying — the rim separates from the sky, the stars thin |
0.80 | first blush — rose along +Z, the sun still under the ridge |
1.00 | first light — the disc clears the ridge and the plateau goes gold |
Stage.component owns the axis and pushes what this returns at the scene
every frame. Nothing else writes the sky, the sun, the ambient or the grade.
Two numbers here are measured, not chosen
The sun's heading. ProceduralSky places its own disc from timeOfDay,
and the scene keeps syncSunToLight = false so this ramp owns the directional
light — so the disc and the light agree only where the heading is aimed at the
disc the sky actually draws. It was read off a capture looking up the arena at
the first-light key: 17 degrees right of +Z, 9 degrees over the ridge. Change
timeOfDay on the top keys and the heading has to be re-measured.
grade.contrast is near zero all night on purpose. The colour-correction
pass pivots contrast at mid-grey, and the night frame sits about two per cent
off black — so a contrast of 0.05 takes the whole plateau under zero and the
frame comes back solid black, with no error anywhere and every value reading
back exactly as it was set. The night is shaped with the tonemap's exposure
and the vignette instead. There is room for contrast only once the sky has
enough light in it to take it.
Scoped to this part · feeds back into the world's score.