Specular reflection
Specular reflection controls the strength and tint of dielectric highlights independently of the base diffuse color.
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​
| Parameter | Default | Description |
|---|---|---|
specularIntensityFactor | 1 | Scales dielectric specular reflection strength. |
specularColorFactor | [1, 1, 1] | RGB tint of dielectric specular reflection. |
specularIntensityMapEnabled | false | Enables specular-intensity texture sampling. |
specularColorMapEnabled | false | Enables specular-color texture sampling. |
Texture bindings​
| Field | Model define | Description |
|---|---|---|
pbr_specularIntensitySampler | HAS_SPECULARINTENSITYMAP: true | Texture resource for the specularIntensity slot. |
pbr_specularColorSampler | HAS_SPECULARCOLORMAP: true | Texture 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​
KHR_materials_specularsupplies the intensity and color factors and their optional textures.