Garry's Mod Wiki

render.ModelMaterialOverride

  render.ModelMaterialOverride( IMaterial material )

Description

Sets a material to override a model's default material. Similar to Entity:SetMaterial except it uses an IMaterial argument and it can be used to change materials on models which are part of the world geometry.

Arguments

1 IMaterial material
The material override.

Example

Sets the material of all opaque models to the red flashing "ERROR" texture.

local error_mat = Material("models/error/new light1") function GM:PreDrawOpaqueRenderables(bDrawingDepth, bDrawingSkybox) render.ModelMaterialOverride(error_mat) end