materialAttenuationDistance
Provides a float value that defines how far light travels inside a colored transparent material before being fully absorbed, directly controlling the "concentration" of the transmission color.
Core Advantages
Translates the abstract physical "absorption coefficient" into an intuitive "distance" parameter, decoupling it from `attenuationColor` and allowing developers to control color and concentration independently in a logical way.
Common Uses
Adjusting the concentration of liquids (e.g., juice, coffee).
Differentiating between various thicknesses or types of colored glass.
Simulating the clarity and color saturation of gemstones.
Dynamically changing the energy concentration of sci-fi effects like energy shields.
How to adjust
Modify the `material.attenuationDistance` property (a number) in JavaScript. A smaller value makes the material's color deeper and more "concentrated"; a larger value makes it lighter and more "diluted". Set to `Infinity` for no attenuation.
Code Examples
1// Conceptually, this distance is used in the Beer-Lambert law for transmitted light
2const transmittedLight = light.mul( exp( log( materialAttenuationColor ).mul( -pathLength.div( materialAttenuationDistance ) ) ) );