Garry's Mod Wiki


IMaterial CreateMaterial( string name, string shaderName, table materialData )


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.
.pngs must be loaded with Material before being used with this function.
This does not work with patch materials.
This will not create a new material if another material object with the same name already exists.


1 string name
The material name. Must be unique.
2 string shaderName
The shader name. See .
3 table materialData
Key-value table that contains shader parameters and proxies.

Unlike IMaterial:SetTexture, this table will not accept ITexture values. Instead, use the texture's name (see ITexture:GetName).


1 IMaterial
Created material


Alternative to render.SetColorMaterial, mainly for use with Entity:SetMaterial

CreateMaterial( "colortexshp", "VertexLitGeneric", { ["$basetexture"] = "color/white", ["$model"] = 1, ["$translucent"] = 1, ["$vertexalpha"] = 1, ["$vertexcolor"] = 1 } )

Page Links

Special Pages



Render Time: 53ms

Session 0
DB GetPage 5
Generate Html 24
SaveChanges 10
Render Body 0
Render Sidebar 12