Skip to main content

Transmission, volume, and dispersion

Transparent materials transmit light through a surface; thickness, absorption, and wavelength separation describe glass and colored volumes.

GitHub
0.0s
Look through the surfaces to compare how much of the background is visible.

Configuration​

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

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
metallicRoughnessValues: [0, 0.05],
transmissionFactor: 1,
ior: 1.5,
thicknessFactor: 0.5,
attenuationColor: [0.8, 0.95, 1],
attenuationDistance: 2,
dispersion: 0.1
}
});

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

The inline viewer captures opaque scene color before drawing transmissive surfaces. Thin glass shows the background in place. A volume with nonzero thickness displaces the background according to its IOR.

See the focused guides for volume absorption and dispersion for separate reference tables and curated sample subsets.

Parameters​

ParameterDefaultDescription
transmissionFactor0Fraction of light transmitted through the surface, in the range 0–1.
transmissionMapEnabledfalseEnables transmission texture sampling.
ior1.5Index of refraction of the dielectric material.
thicknessFactor0Volume thickness scale in model-space units.
attenuationColor[1, 1, 1]RGB transmittance color at the attenuation distance.
attenuationDistance1e9Distance through the volume associated with the attenuation color.
dispersion0Chromatic transmission spread, expressed as 20 divided by the Abbe number.

Texture bindings​

FieldModel defineDescription
pbr_transmissionSamplerHAS_TRANSMISSIONMAP: trueTexture resource for the transmission slot.
pbr_thicknessSamplerHAS_THICKNESSMAP: trueTexture resource for the thickness slot.

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

See Using PBR materials for material setup.

Remarks​