Volume Scattering
Volume scattering approximates light redirected inside a material using local thickness and a directional phase response.
Configuration​
Enable USE_MATERIAL_EXTENSIONS: true in the compatible model's defines.
The following fields update an existing PBR material; see Materials guide.
material.setProps({
pbrMaterial: {
metallicRoughnessValues: [0, 0.4],
thicknessFactor: 0.6,
attenuationDistance: 0.6,
diffuseTransmissionFactor: 0.7,
multiscatterColorFactor: [0.9, 0.35, 0.18],
scatterAnisotropy: 0.25
}
});
Parameters​
| Parameter | Default | Description |
|---|---|---|
multiscatterColorFactor | [0, 0, 0] | Linear scattering color. |
pbr_multiscatterColorSampler | Unbound | Optional sRGB scattering color texture. |
scatterAnisotropy | 0 | Directional preference, from −1 to 1. |
thicknessFactor | 0 | Local material thickness. |
attenuationDistance | 1e9 | Distance over which light is attenuated. |
attenuationDistance controls the optical distance over which scattering becomes significant,
using the same units as thickness. Set it to a value comparable to thicknessFactor: the
example uses 0.6 for both, giving a scattering probability of approximately 0.63 from
1 - exp(-thickness / attenuationDistance). The default distance of 1e9 makes volume
scattering effectively invisible at this thickness. Increasing the distance weakens scattering
for a fixed thickness; decreasing it strengthens scattering.
Remarks​
- The experimental
KHR_materials_volume_scatterextension supplies scattering color and anisotropy. luma.gl approximates scattering locally using thickness.