Skip to content

Documentation / @ripl/3d / computeFogFactor

Function: computeFogFactor() ​

computeFogFactor(fog, distance): number

Defined in: 3d/src/core/fog.ts:63

Computes how far a surface has faded towards the fog colour.

Mirrored term for term by the WGSL applyFog, so the two backends agree.

Parameters ​

ParameterTypeDescription
fogResolvedFogThe resolved fog.
distancenumberDistance from the camera to the surface, in world units.

Returns ​

number

The blend factor, from 0 (unfogged) to 1 (fully obscured).