# ModelMaterial

#### new Cesium.ModelMaterial()
Scene/ModelMaterial.js 19

A model's material with modifiable parameters. A glTF material contains parameters defined by the material's technique with values defined by the technique and potentially overridden by the material. This class allows changing these values at runtime.

Use `Model#getMaterial` to create an instance.

##### See:

- Model#getMaterial

### Members

#### readonly id : String
Scene/ModelMaterial.js 52

The index of the material.

#### readonly name : String
Scene/ModelMaterial.js 38

The value of the `name` property of this material.

### Methods

#### getValue(name) → *
Scene/ModelMaterial.js 102

Returns the value of the parameter with the given `name`. The type of the returned object depends on the glTF type of the parameter. It will be a floating-point number, Cartesian, or matrix.

Name | Type | Description
--- | --- | ---
`name` | String | The name of the parameter.

##### Returns:

The value of the parameter or `undefined` if the parameter does not exist.

#### setValue(name, value)
Scene/ModelMaterial.js 73

Assigns a value to a material parameter. The type for `value` depends on the glTF type of the parameter. It will be a floating-point number, Cartesian, or matrix.

Name | Type | Description
--- | --- | ---
`name` | String | The name of the parameter.
`value` | * | optional The value to assign to the parameter.

##### Throws:

- DeveloperError : name must match a parameter name in the material's technique that is targetable and not optimized out.

##### Example:

    material.setValue('diffuse', new Cesium.Cartesian4(1.0, 0.0, 0.0, 1.0));  // vec4
    material.setValue('shininess', 256.0); // scalar