Skip to content

Documentation / @ripl/3d / computeSpotAttenuation

Function: computeSpotAttenuation() ​

computeSpotAttenuation(cosAngle, cosOuter, cosInner): number

Defined in: 3d/src/core/shading.ts:382

Computes the cone falloff for a spot light.

Parameters ​

ParameterTypeDescription
cosAnglenumberCosine of the angle between the cone axis and the surface.
cosOuternumberCosine of the cone's outer half-angle.
cosInnernumberCosine of the cone's inner half-angle.

Returns ​

number

0 outside the cone, 1 inside the inner cone, smoothly interpolated between.