Skip to main content

Iridescence

Thin-film interference produces view-dependent colors, useful for coated glass, soap films, and decorative finishes.

GitHub
0.0s
Orbit the surfaces to see the reflected colors change with the viewing angle.

Configuration​

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

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
iridescenceFactor: 1,
iridescenceIor: 1.3,
iridescenceThicknessRange: [100, 400]
}
});

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

The stock shader uses a view-dependent thin-film approximation rather than a complete spectral simulation.

Parameters​

ParameterDefaultDescription
iridescenceFactor0Strength of the thin-film response, in the range 0–1.
iridescenceIor1.3Index of refraction of the thin film.
iridescenceThicknessRange[100, 400]Minimum and maximum film thickness in nanometers.
iridescenceMapEnabledfalseEnables iridescence-strength texture sampling.

Texture bindings​

FieldModel defineDescription
pbr_iridescenceSamplerHAS_IRIDESCENCEMAP: trueTexture resource for the iridescence slot.
pbr_iridescenceThicknessSamplerHAS_IRIDESCENCETHICKNESSMAP: trueTexture resource for the iridescenceThickness slot.

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

See Using PBR materials for material setup.

Remarks​