attenuationColor
Provides a standard interface to get the final color and intensity of a light source after it has been attenuated over distance. It encapsulates complex physical falloff calculations into a single color value.
Core Advantages
Completely abstracts complex physical light attenuation calculations (involving distance, intensity, decay functions), which are automatically handled by the Three.js engine based on scene lights, allowing shader code to remain standardized, generic, and unaware of the underlying details.
Common Uses
In custom lighting models, multiplied with the base color as the light energy factor.
In toon shading, providing the intensity basis for stepped shadows.
Providing light intensity at sample points for volumetric lighting or fog.
Visualizing a light's range and falloff by directly outputting its color.
How to adjust
The node's value is controlled by the properties of the `Light` object in the scene (e.g., `PointLight`). Adjusting `light.intensity` changes the overall brightness and range; `light.distance` sets a hard maximum falloff distance; and `light.decay` alters the rate at which the light's strength diminishes with distance.
Code Examples
1// Multiply the attenuation color with the direct light contribution
2const totalLight = directLight.mul( attenuationColor );