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 ​
| Parameter | Type | Description |
|---|---|---|
fog | ResolvedFog | The resolved fog. |
distance | number | Distance from the camera to the surface, in world units. |
Returns ​
number
The blend factor, from 0 (unfogged) to 1 (fully obscured).