# engineCreateMaterial (Client)

> Creates a material: a shader with parameter values, which then replaces or overlays the materials of models.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Materials and shaders
- **URL**: https://wiki.mymp.gg/en/engineCreateMaterial

## Syntax

```lua
material engineCreateMaterial([string|shader|material|false base = nil, string name = nil])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `base` | `string\|shader\|material\|false` | What the material builds on: the name of a shader, preset or named material, a `shader` element or a `material` element. With no base (`nil` or `false`), it starts from the material it replaces and changes only what you set. *(default: `nil`)* |
| `name` | `string` | A name other scripts and packs find the material by. It cannot be empty. *(default: `nil`)* |

## Returns

The created `material` element.

## Example

```lua
local glow = engineCreateMaterial("surface_emissive")
engineSetMaterialValue(glow, "glowTint", tocolor(255, 200, 60))
engineSetModelMaterial("infernus", "*light*", glow)
```

### Note

A base that is not a shader, preset or material is an error. A name another owner's material already has now covers that one, with a warning.

## See also

- [engineSetMaterialValue (Client)](https://wiki.mymp.gg/en/engineSetMaterialValue.md): Sets a material's value: a shader parameter, a static switch or the render target of a TARGET_n output.
- [engineSetModelMaterial (Client)](https://wiki.mymp.gg/en/engineSetModelMaterial.md): Replaces the chosen materials of every instance of a model with a material.
- [engineSetWorldMaterial (Client)](https://wiki.mymp.gg/en/engineSetWorldMaterial.md): Replaces the chosen materials of every model in the world with a material.
- [engineCreateShader (Client)](https://wiki.mymp.gg/en/engineCreateShader.md): Creates a shader from a .shader file or from its source text. The shader compiles in the background.
