Skip to main content

Clearcoat

Clearcoat adds a secondary glossy layer over a base surface, useful for varnish, lacquer, and automotive paint.

GitHub
0.0s
A second highlight reveals the clear layer over the base material.

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.5, 0.4],
clearcoatFactor: 1,
clearcoatRoughnessFactor: 0.1
}
});

// 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
clearcoatFactor0Strength of the secondary clearcoat layer, in the range 0–1.
clearcoatRoughnessFactor0Roughness of the clearcoat layer, in the range 0–1.
clearcoatMapEnabledfalseEnables clearcoat-strength texture sampling.
clearcoatRoughnessMapEnabledfalseEnables clearcoat-roughness texture sampling.

Texture bindings​

FieldModel defineDescription
pbr_clearcoatSamplerHAS_CLEARCOATMAP: trueTexture resource for the clearcoat slot.
pbr_clearcoatRoughnessSamplerHAS_CLEARCOATROUGHNESSMAP: trueTexture resource for the clearcoatRoughness slot.
pbr_clearcoatNormalSamplerHAS_CLEARCOATNORMALMAP: trueTexture resource for the clearcoatNormal slot.

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

See Using PBR materials for material setup.

Remarks​