Skip to main content

Diffuse transmission and scattering

Diffuse transmission lets light emerge from the opposite side of a thin or scattering surface, useful for leaves, paper, and translucent ceramics.

GitHub
0.0s
Light passing through the leaves illuminates their shaded faces.

Configuration​

import {Model} from '@luma.gl/engine/api';
import {createPBRMaterial, type PBRMaterial} from '@luma.gl/engine/materials';

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
diffuseTransmissionFactor: 0.7,
diffuseTransmissionColorFactor: [0.6, 0.9, 0.4],
thicknessFactor: 0.2,
multiscatterColorFactor: [0.8, 0.9, 0.6],
scatterAnisotropy: 0.2
}
});

// modelProps contains your existing shaders, geometry, and buffer layout.
const model = new Model(device, {
...modelProps,
material,
defines: {...modelProps.defines, USE_MATERIAL_EXTENSIONS: true}
});

Scattering is a local, thickness-aware single-scattering approximation. Screen-space diffusion and random-walk multiple scattering are not implemented.

Parameters​

ParameterDefaultDescription
diffuseTransmissionFactor0Fraction of dielectric diffuse energy transmitted into the opposite hemisphere.
diffuseTransmissionColorFactor[1, 1, 1]RGB tint of transmitted diffuse light.
diffuseTransmissionMapEnabledfalseEnables diffuse-transmission factor texture sampling.
diffuseTransmissionColorMapEnabledfalseEnables diffuse-transmission color texture sampling.
thicknessFactor0Volume thickness scale in model-space units.
multiscatterColorFactor[0, 0, 0]Experimental volume-scattering albedo.
multiscatterColorMapEnabledfalseEnables scattering-albedo texture sampling.
scatterAnisotropy0Henyey–Greenstein scattering anisotropy, ranging from -1 to 1.

Texture bindings​

FieldModel defineDescription
pbr_diffuseTransmissionSamplerHAS_DIFFUSETRANSMISSIONMAP: trueTexture resource for the diffuseTransmission slot.
pbr_diffuseTransmissionColorSamplerHAS_DIFFUSETRANSMISSIONCOLORMAP: trueTexture resource for the diffuseTransmissionColor slot.
pbr_multiscatterColorSamplerHAS_MULTISCATTERCOLORMAP: trueTexture resource for the multiscatterColor slot.

Enable USE_MATERIAL_EXTENSIONS on custom models. The glTF importer enables it automatically.

See Using PBR materials for material setup.

Remarks​