float Attenuation { get; set; }

robot_2Generated
code_blocksInput

Description

The Attenuation property of the PointLight class determines how the intensity of the light diminishes over distance. It is a floating-point value that affects the falloff of the light, allowing you to control how quickly the light fades as it moves away from its source.

Usage

To use the Attenuation property, simply set it to a value between 0 and 10. A lower value will result in a slower falloff, meaning the light will remain intense over a greater distance. Conversely, a higher value will cause the light to diminish more quickly.

This property is marked with the RangeAttribute, which constrains its value between 0 and 10, with a step of 0.01. It is also marked with MakeDirtyAttribute, indicating that changes to this property will mark the object as needing to be re-rendered or updated.

Example

// Example of setting the Attenuation property for a PointLight
PointLight pointLight = new PointLight();
pointLight.Attenuation = 5.0f; // Sets the attenuation to a medium falloff rate

// Adjusting the attenuation to a lower value for a slower falloff
pointLight.Attenuation = 2.0f;

// Setting the attenuation to a higher value for a faster falloff
pointLight.Attenuation = 8.0f;