Skip to content

material.standard#baseColorTextureTransform

Summary

material.standard#baseColorTextureTransform adjusts which UV coordinates sample the base color texture. The standard material exposes the same controls independently for metallic–roughness, normal, occlusion and emissive textures.

Syntax

get baseColorTextureTransform(): TextureTransform
set baseColorTextureTransform(value: TextureTransformDescriptor | null)
material.baseColorTextureTransform = { texCoord: 1, offset: [0.25, 0] };

Parameters

The same getter and setter types apply to metallicRoughnessTextureTransform, normalTextureTransform, occlusionTextureTransform and emissiveTextureTransform. Each assignment replaces that slot's transform. Defaults are offset: [0, 0], rotation: 0 radians, scale: [1, 1] and texCoord: 0. Use texCoord: 1 for the second UV set or assign null to restore defaults.

Returns

TextureTransform - A copy of the normalized settings for that slot. Reassign edited settings to apply them and mark the uniforms dirty.

Example

const material = wgpu.material.standard();
/** @type {import("@zushah/wasmgpu").TextureTransformDescriptor} */
const base = { scale: [2, 2] };
/** @type {import("@zushah/wasmgpu").TextureTransformDescriptor} */
const normal = { texCoord: 1, rotation: Math.PI / 2 };
material.baseColorTextureTransform = base;
material.normalTextureTransform = normal;
material.release();

See Also