materialAttenuationColor
Provides the volume absorption color for colored transparent materials (e.g., glass, liquid), which determines the color light is tinted after passing through the object.
Core Advantages
Encapsulates the complex Beer-Lambert physical law into intuitive color and distance parameters, seamlessly integrating with `transmission` to greatly simplify the creation of physically accurate colored transparent materials.
Common Uses
Simulating colored glass objects like wine bottles or stained glass.
Rendering colored liquids such as juice, potions, or whiskey.
Expressing the rich, translucent quality of materials like jade, emerald, or resin.
Creating physically-based colored gemstones.
How to adjust
First, set `material.transmission > 0` to activate the effect. Then, set the absorption color with `material.attenuationColor`. Crucially, adjust `material.attenuationDistance`: a larger value results in a lighter, less concentrated color, while a smaller value results in a deeper, more concentrated color.
Code Examples
1// Conceptually, this color is used in the Beer-Lambert law for transmitted light
2const transmittedLight = light.mul( exp( log( materialAttenuationColor ).mul( -attenuationDistance ) ) );