voxolith

atmosphereFrame()

Lighting and the renderer's atmosphere settings for one frame: overcast dims and flattens the key light and greys the sky (keeping the night dark), fog takes the horizon's colour, wind tilts the rain and snow and drives the clouds and the water. With a clear atmosphere the lighting passes...

function atmosphereFrame(
   lighting: Lighting, 
   atm: Atmosphere, 
   opts?: AtmosphereFrameOptions
): Lighting & AtmosphereParams;

Defined in: engine/src/atmosphere/weather.ts:193

Lighting and the renderer's atmosphere settings for one frame: overcast dims and flattens the key light and greys the sky (keeping the night dark), fog takes the horizon's colour, wind tilts the rain and snow and drives the clouds and the water. With a clear atmosphere the lighting passes through unchanged.

Fog, clouds, precipitation and the ground surface are only set when non-zero, so the renderer skips what is off. Water animates from FrameParams.time, which this does not set.

Parameters

ParameterTypeDescription
lightingLightingUsually timeOfDay's result.
atmAtmosphereThe sky, with the game's own wetness and cover.
opts?AtmosphereFrameOptions-

Returns

Lighting & AtmosphereParams

Lighting plus the renderer's atmosphere fields, to spread into renderer.render.

Example

const sky = atmosphereFrame(timeOfDay(0.45), ATMOSPHERES.rain, { voxelsPerMetre: 100 });
renderer.render({ ...frame(), ...sky, time: now / 1000 });

On this page