timeOfDay()
Every lighting field of the renderer's FrameParams for a time of day: key light, ambient, sun and moon discs, sky colours. By day the key light follows the sun; at night it is a dim blue moonlight and the ambient drops low enough for point lights to carry the scene. The moon disc lights nothing;...
function timeOfDay(phase: number, opts?: TimeOfDayOptions): Lighting;Defined in: engine/src/atmosphere/timeofday.ts:69
Every lighting field of the renderer's FrameParams for a time of day: key light, ambient,
sun and moon discs, sky colours. By day the key light follows the sun; at night it is a dim
blue moonlight and the ambient drops low enough for point lights to carry the scene. The moon
disc lights nothing; the key light does.
Parameters
| Parameter | Type | Description |
|---|---|---|
phase | number | 0..1 over a day (wrapped): 0 midnight, 0.25 sunrise, 0.5 noon, 0.75 sunset. Animate it to animate the sky. |
opts? | TimeOfDayOptions | - |
Returns
The lighting, to spread into renderer.render or pass to atmosphereFrame.
Example
renderer.render({ ...frame(), ...timeOfDay(0.42) });makeAtmosphereTransition()
Change weather smoothly. The game decides when to call set; the transition only blends (see blendAtmosphere: a change of precipitation kind fades one out before the other fades in, and wind turns the short way round).
Atmosphere
A description of the sky and the ground's weather state, all in 0..1 unless stated. Plain data: blend it, store it, send it. Presets are in ATMOSPHERES.