Iridescence
Thin-film interference produces view-dependent colors, useful for coated glass, soap films, and decorative finishes.
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​
| Parameter | Default | Description |
|---|---|---|
iridescenceFactor | 0 | Strength of the thin-film response, in the range 0–1. |
iridescenceIor | 1.3 | Index of refraction of the thin film. |
iridescenceThicknessRange | [100, 400] | Minimum and maximum film thickness in nanometers. |
iridescenceMapEnabled | false | Enables iridescence-strength texture sampling. |
Texture bindings​
| Field | Model define | Description |
|---|---|---|
pbr_iridescenceSampler | HAS_IRIDESCENCEMAP: true | Texture resource for the iridescence slot. |
pbr_iridescenceThicknessSampler | HAS_IRIDESCENCETHICKNESSMAP: true | Texture 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​
KHR_materials_iridescencesupplies film factors and optional intensity and thickness maps.