material.standard#setExtensions¶
Summary¶
material.standard#setExtensions replaces the PBR extension descriptor for an existing standard material. Use it to change effects such as clearcoat, sheen, or transmission without recreating the mesh.
Syntax¶
StandardMaterial.setExtensions(descriptor?: StandardMaterialExtensionsDescriptor): this
readonly StandardMaterial.extensions: StandardMaterialExtensions
material.setExtensions({ clearcoat: { factor: 0.6, roughness: 0.2 } });
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
descriptor |
StandardMaterialExtensionsDescriptor |
No | Complete desired extension descriptor. An omitted descriptor clears the extension settings. |
Returns¶
this - The same material. The extensions getter returns a copy of the normalized configuration. Referenced textures are still the original texture objects.
Notes¶
Each call normalizes the supplied descriptor independently. Include any extension settings you want to keep. The material marks its uniforms dirty and invalidates binding state when the texture resources or layout change.
Example¶
const material = wgpu.material.standard({ color: [0.4, 0.2, 0.1] });
material.setExtensions({ clearcoat: { factor: 0.6, roughness: 0.2 } });
material.release();