Click or drag to resize
DigitalRuneGraphicsHelperGetDistanceAttenuation Method
Computes the light attenuation factor for a given distance.

Namespace: DigitalRune.Graphics
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public static float GetDistanceAttenuation(
	float distance,
	float range,
	float exponent
)

Parameters

distance
Type: SystemSingle
The distance to the light's origin.
range
Type: SystemSingle
The range of the light.
exponent
Type: SystemSingle
The falloff exponent.

Return Value

Type: Single
The light attenuation factor.
Remarks

The intensity of the light continually decreases from the origin up to range. At a distance of range the light intensity is 0. This method computes the attenuation factor at a given distance.

The attenuation factor is computed as follows:

DistanceAttenuation Factor
distance ≤ 01
0 < distance < 11 - (distance / range)exponent
distance ≥ 10

See Also