Skip to main content

Base color

Base color sets the diffuse color of a dielectric and the reflected color of a metal, combining a factor, a texture, and vertex colors.

GitHub
0.0s
The spheres share the same geometry, roughness, and lighting. Only their base color changes.

Configuration​

import {Model} from '@luma.gl/engine/api';
import {createPBRMaterial, type PBRMaterial} from '@luma.gl/engine/materials';

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
baseColorFactor: [0.8, 0.3, 0.1, 1],
metallicRoughnessValues: [0, 0.7]
}
});

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

Parameters​

ParameterDefaultDescription
baseColorFactor[1, 1, 1, 1]Linear RGBA multiplier, including opacity in alpha.
baseColorMapEnabledfalseEnables the base-color texture slot.

Texture bindings​

BindingModel defineDescription
pbr_baseColorSamplerHAS_BASECOLORMAP: truesRGB RGB color and linear alpha.

See Using PBR materials for material setup.

Remarks​

  • Core glTF supplies pbrMetallicRoughness.baseColorFactor and baseColorTexture. Vertex colors from COLOR_0 multiply both.