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.
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​
| Parameter | Default | Description |
|---|---|---|
diffuseTransmissionFactor | 0 | Fraction of dielectric diffuse energy transmitted into the opposite hemisphere. |
diffuseTransmissionColorFactor | [1, 1, 1] | RGB tint of transmitted diffuse light. |
diffuseTransmissionMapEnabled | false | Enables diffuse-transmission factor texture sampling. |
diffuseTransmissionColorMapEnabled | false | Enables diffuse-transmission color texture sampling. |
thicknessFactor | 0 | Volume thickness scale in model-space units. |
multiscatterColorFactor | [0, 0, 0] | Experimental volume-scattering albedo. |
multiscatterColorMapEnabled | false | Enables scattering-albedo texture sampling. |
scatterAnisotropy | 0 | Henyey–Greenstein scattering anisotropy, ranging from -1 to 1. |
Texture bindings​
| Field | Model define | Description |
|---|---|---|
pbr_diffuseTransmissionSampler | HAS_DIFFUSETRANSMISSIONMAP: true | Texture resource for the diffuseTransmission slot. |
pbr_diffuseTransmissionColorSampler | HAS_DIFFUSETRANSMISSIONCOLORMAP: true | Texture resource for the diffuseTransmissionColor slot. |
pbr_multiscatterColorSampler | HAS_MULTISCATTERCOLORMAP: true | Texture 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​
KHR_materials_diffuse_transmissionsupplies the diffuse transmission factor, color, and their textures.