natiny.model.set_color
natiny.model.set_color(model [, r [, g [, b [, a]]]])
Sets this model's tint - the per-model form of natiny.render.set_color, which a bulk draw has no way to set per object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
model |
number |
Model handle | |
r |
number |
1 |
Red, 0..1 |
g |
number |
1 |
Green, 0..1 |
b |
number |
1 |
Blue, 0..1 |
a |
number |
1 |
Alpha, 0..1 |
Example
natiny.model.set_color(buoy, 1.0, 0.55, 0.15, 1.0)
Notes
- Three tints multiply: the vertex colors the geometry carries, this model's, and the draw color. The draw color still modulates a whole pass while models differ inside it.
- A model starts white, which leaves the geometry and the draw color to themselves.
- With a custom material the tint reaches the shader only if the material reads the vertex color; the built-in material always does.