Renderer · function

atmosphereFog

The haze an Environment makes at a camera's height, as GpuDrivenView.fog takes it.

Explained in Hello world.

function atmosphereFog(atmosphere: Atmosphere, eyeY: number, underwater: boolean, out: FogTarget): FogTarget
import { atmosphereFog } from '@driftengine/core';

Parameters

ParameterTypeDescription
atmosphereAtmosphere
eyeYnumber
underwaterbooleanThe renderer's underwaterAtmosphere quality, which gates the second medium on the forward path; pass the same.
outFogTarget

In depth

The forward path's own decision, handed over rather than made again. A consumer drawing both pipelines in one frame has one environment and needs one haze from it, and resolveAtmosphere is where the forward path decides which medium the camera is in and what it looks like — the density at the eye, the linear ramp's two radii, how far under water the eye is. This calls it and copies the answer across field for field, so the two pipelines cannot disagree about where the fog begins or whether the camera is submerged. Both mode numbers are the shaders' uFogMode, which is why no mapping stands between them.