Skip to main content

Dispersion

Dispersion separates transmitted wavelengths, producing colored fringes through refractive glass.

GitHub
0.0s
Look through the glass at a high-contrast edge to see the colors separate.

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,
thicknessFactor: 0.5,
ior: 1.5,
dispersion: 0.5
}
});

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

The inline viewer supplies the opaque scene-color texture used by the shader. See transmission and volume absorption.

Parameters​

ParameterDefaultDescription
dispersion0Chromatic spread, expressed as 20 divided by the Abbe number; 0 disables it.
transmissionFactor0Transmitted light fraction; dispersion requires transmission.
ior1.5Base dielectric index of refraction.

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

See Using PBR materials for material setup.

Remarks​