# engineSetModelStencil (Client)

> Marks every instance of a model with a stencil value, which post shaders read for outlines, highlights and similar effects.

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

## Syntax

```lua
bool engineSetModelStencil(string|element model, int value [, bool seeThrough = false, int priority = 0])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `model` | `string\|element` | The model's name or a `model` element. |
| `value` | `int` | The mark, an integer from 1 to 255. |
| `seeThrough` | `bool` | An extra flag post shaders read with `stencil_see_through`. *(default: `false`)* |
| `priority` | `int` | When several resources mark the same target, the highest priority wins; between equals, the newest. *(default: `0`)* |

## Returns

`true` when the mark was applied.

## Example

```lua
local outline = engineCreateMaterial(engineCreateShader("shaders/outline.shader"))
engineAddPostProcess(outline)
engineSetModelStencil("kmb_atm1", 3, true)
```

### Note

The value takes 1 to 255, but post shaders read only its low 7 bits (`stencil` gives 0 to 127): from 128 on the top bit is lost, and 128 reads as unmarked. A name that is not a model is an error.

## See also

- [engineGetModelStencil (Client)](https://wiki.mymp.gg/en/engineGetModelStencil.md): Gives the stencil value a model is marked with.
- [engineRestoreModelStencil (Client)](https://wiki.mymp.gg/en/engineRestoreModelStencil.md): Removes the stencil mark this resource set with engineSetModelStencil.
- [engineSetElementStencil (Client)](https://wiki.mymp.gg/en/engineSetElementStencil.md): Marks a vehicle, ped or object with a stencil value, which post shaders read for outlines, highlights and similar effects.
- [engineAddPostProcess (Client)](https://wiki.mymp.gg/en/engineAddPostProcess.md): Turns on a post process on the screen: a material whose shader is #type post.
