Documentation / @ripl/3d / computeDistanceAttenuation
Function: computeDistanceAttenuation() ​
computeDistanceAttenuation(
distance,range,decay):number
Defined in: 3d/src/core/shading.ts:362
Computes distance falloff for a positional light.
Matches three.js: a distance of 0 means the light never falls to zero and only the decay applies, otherwise the inverse-power falloff is windowed so it reaches exactly zero at the range.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
distance | number | Distance from the light to the surface. |
range | number | The distance at which the light falls to zero, or 0 for unbounded. |
decay | number | The exponent of the inverse-distance falloff. |
Returns ​
number
The attenuation factor.