natiny.material.set_texture
Lua
natiny.material.set_texture(material, texture_name [, texture [, min_filter [, mag_filter]]])
Assigns a texture to a named texture slot and configures its filtering. The
assigned texture overrides one supplied by a model or draw for the same slot.
Parameters
| Name |
Type |
Default |
Description |
material |
number |
|
Material handle |
texture_name |
string |
|
Texture name declared in the shader |
texture |
number |
0 |
Texture handle; 0 selects the built-in white texture |
min_filter |
number |
FILTER_LINEAR |
Filter used when the texture is minified |
mag_filter |
number |
min_filter |
Filter used when the texture is magnified |
Filtering
| Constant |
Description |
natiny.material.FILTER_LINEAR |
Blends neighbouring texels; minification also blends mip levels |
natiny.material.FILTER_NEAREST |
Selects the nearest texel and mip level |
Example
Lua
natiny.material.set_texture(material, "albedo", texture)
Notes
- A slot that has not been assigned by this function can receive a texture
from the model part or draw command.
- Passing
0 still assigns the slot; it does not restore texture inheritance.
- An unknown
texture_name is reported and ignored.