Patch

From Valve Developer Community
Jump to navigation Jump to search
English (en)Español (es)Translate (Translate)


Patch is a Pixel shader available in all Source Source games. It is a special shader that inherits every single parameter of the vmt file defined in the include string. Allowing for the addition of new parameters or changes to existing ones by writing into the Insert section.

Some uses for patch is to have a "Master" material for all player models, weapons, or for all materials that belong to the same model that should have the same settings.
This way, you would not need to alter the same parameters in several vmt files should you need to make changes across them.

Patch's only limitations are that it cannot change a material's shader, and a Patch material cannot use include to inherit from another Patch material.

Note.pngNote: Patch material including other Patch materials seems to work fine in Source Filmmaker, Left 4 Dead 2 and Portal 2.
Seen in Left 4 Dead 2; Wounded L4D1 infected materials, include their default materials, which in turn include the shared material.
Icon-Bug.pngBug:If the inherited material uses Cubemap VBSP will not able to replace it to patched version that link to the nearest cubemap  (tested in: Source 2013)


Parameters:

include
The base material from which to inherit.
Note.pngNote: The complete path is required, including materials\ and .vmt.
insert
The parameters to add, inside { and }. Those that already exist are overridden.
Tip.pngTip: <parameter> "" can be used to remove an established value.
replace
The parameters to replace, inside { and }.


Example

patch
{
	include materials\models\infected\common\common_infected_shared.vmt
	insert
	{
		$basetexture models\infected\common\military_national_guard\common_military_upper_01
	}
}