material_set
Defines or replaces the material named ref (glTF metallic-roughness, linear values): baseColor [r, g, b, a] in [0, 1], metallic and roughness in [0, 1], optional emissive [r, g, b] in [0, 10000] and opacity in [0, 1]. Optional textures { texture, texCoord?: 0 } by texture ref: baseColorTexture and emissiveTexture (sRGB, multiply their factor), metallicRoughnessTexture (G roughness, B metallic), normalTexture (+ scale in [-10, 10]) and occlusionTexture (+ strength in [0, 1]); a texture not defined yet samples as absent. Objects with this materialRef use it from the next frame. Returns { ref, changed }.
Usage
surface.execute('material_set', { ref, baseColor, metallic, roughness, emissive?, opacity?, baseColorTexture?, metallicRoughnessTexture?, normalTexture?, occlusionTexture?, emissiveTexture? })Parameters
refstringbaseColornumber[]metallicnumberroughnessnumberemissivenumber[]opacitynumberbaseColorTextureobjectmetallicRoughnessTextureobjectnormalTextureobjectocclusionTextureobjectemissiveTextureobject
Returns
object with ref, changed, in the ok: true envelope.
{
"type": "object",
"properties": {
"ref": {
"type": "string"
},
"changed": {
"type": "boolean"
}
},
"required": [
"ref",
"changed"
]
}