Viewer3DBase.setMaterialParameter() method

Set material paramter for certain material. There are different parameter names available for different types of materials. Here are all the available parameters and the corresponding types:

color: number[] e.g. [1, 0, 0]

opacity: number(0-1) e.g. 0.5

colorTexture: string | HTMLImageElement e.g. "https://modeloapp.com/colorMap.jpg"

roughness: number(0-1) e.g. 0.5

metallic: number(0-1) e.g. 0.5

metallicRoughnessTexture: string | HTMLImageElement e.g. "https://modeloapp.com/metallicRoughnessMap.jpg"

emissiveTexture: string | HTMLImageElement e.g. "https://modeloapp.com/emissiveMap.jpg"

normalTexture: string | HTMLImageElement e.g. "https://modeloapp.com/normalMap.jpg"

Signature:

setMaterialParameter(materialName: string, parameter: string, value: any): void;

Parameters

ParameterDescription
materialNameThe material name queried through api.
parameterThe parameter name.
valueThe parameter value to set.

Returns:

void

Example

// Create a model viewer on mobile platform.
viewer.getScene().setMaterialParameter(materialName, "color", [1, 0, 0]);