engineSetElementStencil
Client
Marks a vehicle, ped or object with a stencil value, which post shaders read for outlines, highlights and similar effects.
bool engineSetElementStencil(element element, int value [, bool seeThrough = false, int priority = 0])
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | A vehicle, ped, player or object. |
| 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
local outline = engineCreateMaterial(engineCreateShader("shaders/outline.shader"))
engineAddPostProcess(outline)
local vehicle = createVehicle("infernus", 2495.0, -1680.0, 13.4)
engineSetElementStencil(vehicle, 1)NoteThe 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. An element that is not a vehicle, ped, player or object is an error.