Skip to main content

Texture coordinates and transforms

Independent texture coordinate sets and transforms let each surface map use its own placement, rotation, and scale.

GitHub
0.0s
Follow the texture pattern to see where its scale, offset, and rotation change.

Configuration​

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

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
baseColorUVSet: 0,
baseColorUVTransform: [2, 0, 0, 0, 2, 0, 0.25, 0, 1]
}
});

// Pass material to a compatible Model through its material prop.

The example matrix doubles texture tiling and offsets U by 0.25. Runtime transforms must not be combined with duplicate loader-side UV baking. Animated texture-set switches and TEXCOORD_2+ slots are unsupported.

Parameters​

ParameterDefaultDescription
baseColorUVSet0Selects UV set 0 or 1 for the base-color texture.
baseColorUVTransformIdentity matrixColumn-major 3×3 transform of base-color texture coordinates.

Each supported texture slot has its own UVSet and UVTransform fields, including normalUVSet, normalUVTransform, metallicRoughnessUVSet, and metallicRoughnessUVTransform. Transforms and coordinate-set selection are independent per slot.

See Using PBR materials for material setup.

Remarks​

  • Core glTF texCoord selects a UV set for each texture. KHR_texture_transform adds offset, rotation, scale, and an optional UV set override.