Skip to main content

Specular reflection

Specular reflection controls the strength and tint of dielectric highlights independently of the base diffuse color.

GitHub
0.0s
Compare the strength and tint of the highlights across the samples.

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.25],
specularIntensityFactor: 0.8,
specularColorFactor: [1, 0.9, 0.8]
}
});

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

Parameters​

ParameterDefaultDescription
specularIntensityFactor1Scales dielectric specular reflection strength.
specularColorFactor[1, 1, 1]RGB tint of dielectric specular reflection.
specularIntensityMapEnabledfalseEnables specular-intensity texture sampling.
specularColorMapEnabledfalseEnables specular-color texture sampling.

Texture bindings​

FieldModel defineDescription
pbr_specularIntensitySamplerHAS_SPECULARINTENSITYMAP: trueTexture resource for the specularIntensity slot.
pbr_specularColorSamplerHAS_SPECULARCOLORMAP: trueTexture resource for the specularColor slot.

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

See Using PBR materials for material setup.

Remarks​