CreateMaterial
Description
Creates a new material with the specified name and shader.
Materials created with this function can be used in Entity:SetMaterial and Entity:SetSubMaterial by prepending a ! to their material name argument.
This will not create a new material if another material object with the same name already exists. All Materials created by this functions are cleaned up on map shutdown.
This does not work with patch materials.
Arguments
3 table materialData
Key-value table that contains shader parameters and proxies.
- See: List of Shader Parameters on Valve Developers Wiki and each shader's page from .
Unlike IMaterial:SetTexture, this table will not accept ITexture values. Instead, use the texture's name (see ITexture:GetName).
Returns
Example
Alternative to render.SetColorMaterial, mainly for use with Entity:SetMaterial
Example
Sample example of using material proxies. Keep in mind that you can only have 1 instance of each proxy type! This is a limitation of how Lua tables work
Garry's Mod
Rust
Steamworks
Wiki Help