Garry's Mod Wiki

Revision Difference

render.ModelMaterialOverride#513065

<function name="ModelMaterialOverride" parent="render" type="libraryfunc">⤶ <description>Sets a material to override a model's default material. Similar to <page>Entity:SetMaterial</page> except it uses an <page>IMaterial</page> argument and it can be used to change materials on models which are part of the world geometry.</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="material" type="IMaterial">The material override.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Sets the material of all opaque models to the red flashing "ERROR" texture.</description>⤶ <code>⤶ local error_mat = Material("models/error/new light1")⤶ ⤶ function GM:PreDrawOpaqueRenderables(bDrawingDepth, bDrawingSkybox)⤶ ⤶ render.ModelMaterialOverride(error_mat)⤶ ⤶ end⤶ </code>⤶ ⤶ </example>