Skip to main content

Anisotropic reflection

Anisotropic reflection stretches highlights along a surface direction, useful for brushed metal and directional surface finishes.

GitHub
0.0s
The stretched highlights follow the brushing direction.

Configuration​

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

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
anisotropyStrength: 0.8,
anisotropyRotation: 0.5,
anisotropyDirection: [1, 0]
}
});

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

The shared shader approximates directional highlights and image-based lighting response; results depend on the surface tangent frame.

Parameters​

ParameterDefaultDescription
anisotropyStrength0Strength of directional reflection, in the range 0–1.
anisotropyRotation0Rotation of the anisotropy direction in radians.
anisotropyDirection[1, 0]Two-component direction in the surface tangent frame.
anisotropyMapEnabledfalseEnables anisotropy texture sampling.

Texture bindings​

FieldModel defineDescription
pbr_anisotropySamplerHAS_ANISOTROPYMAP: trueTexture resource for the anisotropy slot.

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

See Using PBR materials for material setup.

Remarks​