VMT: Difference between revisions
TomEdwards (talk | contribs) (otherlang2) |
TomEdwards (talk | contribs) m (cleanup) |
||
Line 5: | Line 5: | ||
}} | }} | ||
A '''material''' is a <code>.vmt</code> text file that defines a two-dimensional surface. It contains all of the information needed for Source to simulate the surface visually, aurally, and physically | A '''material''' is a <code>.vmt</code> ("Valve Material Type") text file that defines a two-dimensional surface. It contains all of the information needed for Source to simulate the surface visually, aurally, and physically. | ||
The contents of a material will fall into some or all of these categories: | The contents of a material will fall into some or all of these categories: | ||
Line 25: | Line 25: | ||
This is a very basic [[Wikipedia:Shingle beach|shingle beach]] material. | This is a very basic [[Wikipedia:Shingle beach|shingle beach]] material. | ||
#The <code>[[LightmappedGeneric]]</code> shader is used, which means that the material is for use on surfaces with [[lightmap]]s | #The <code>[[LightmappedGeneric]]</code> shader is used, which means that the material is for use on surfaces with [[lightmap]]s (i.e. [[brush]]es). | ||
#''The { character opens a set of parameters'' | #''The { character opens a set of parameters'' | ||
#The <code>[[$basetexture]]</code> parameter is given with <code>coast\shingle_01</code> | #The <code>[[$basetexture]]</code> parameter is given with <code>coast\shingle_01</code>, which is the location of a texture. This is what will be drawn on the screen. | ||
#<code>[[$surfaceprop]]</code> gives the material the physical properties of gravel. | #<code>[[$surfaceprop]]</code> gives the material the physical properties of gravel. | ||
#''The } character closes a set of parameters'' | #''The } character closes a set of parameters'' | ||
Line 33: | Line 33: | ||
It's important to remember that this material can only be used on brushes. If it needed to be used on [[model]]s, for instance, another version would need to be created using the <code>[[VertexLitGeneric]]</code> shader. | It's important to remember that this material can only be used on brushes. If it needed to be used on [[model]]s, for instance, another version would need to be created using the <code>[[VertexLitGeneric]]</code> shader. | ||
Most of the time switching materials from one shader to another is as simple as changing their first line, since a great number of parameters are shared between them. | Most of the time switching materials from one shader to another is as simple as changing their first line, since a great number of parameters are shared between them. Some params only work with certain shaders, like [[Phong]] effects, which are only available with <code>VertexLitGeneric</code>, but fortunately you won't encounter any critical errors if a param isn't understood by the shader. It just won't have any effect. | ||
{{tip|If you ever need to use a space or tab character in a parameter value, you must wrap the whole value with "quote marks". You'll often see absolutely everything wrapped like this - save yourself some typing, as that's unnecessary.}} | {{tip|If you ever need to use a space or tab character in a parameter value, you must wrap the whole value with "quote marks". You'll often see absolutely everything wrapped like this - save yourself some typing, as that's unnecessary.}} | ||
Line 45: | Line 45: | ||
== See also == | == See also == | ||
*[[Creating a Material]] | * [[Creating a Material]] | ||
*[[ | * [[Notepad++ VDF languages|Notepad++ syntax highlighting for materials]] | ||
* [[$basetexture]] | * [[$basetexture]] | ||
* [[$envmapmask]] (specular mask) | * [[$envmapmask]] (specular mask) |
Revision as of 08:27, 22 July 2009
A material is a .vmt
("Valve Material Type") text file that defines a two-dimensional surface. It contains all of the information needed for Source to simulate the surface visually, aurally, and physically.
The contents of a material will fall into some or all of these categories:
- Texture names
- Physical surface types
- Shader-specific parameters
- Fallbacks
- Proxies
A simple example
LightmappedGeneric { $basetexture coast\shingle_01 $surfaceprop gravel }
This is a very basic shingle beach material.
- The
LightmappedGeneric
shader is used, which means that the material is for use on surfaces with lightmaps (i.e. brushes). - The { character opens a set of parameters
- The
$basetexture
parameter is given withcoast\shingle_01
, which is the location of a texture. This is what will be drawn on the screen. $surfaceprop
gives the material the physical properties of gravel.- The } character closes a set of parameters
It's important to remember that this material can only be used on brushes. If it needed to be used on models, for instance, another version would need to be created using the VertexLitGeneric
shader.
Most of the time switching materials from one shader to another is as simple as changing their first line, since a great number of parameters are shared between them. Some params only work with certain shaders, like Phong effects, which are only available with VertexLitGeneric
, but fortunately you won't encounter any critical errors if a param isn't understood by the shader. It just won't have any effect.

Finding materials
Materials are stored in the materials\
folder of your game or mod. The best way to browse them is from Hammer's texture selection screen.
If you want to edit or view the code of Valve's material files you will first need to extract them from their GCF package with GCFScape. They tend to be stored in GCFs with 'materials' in their name.
See also
- Creating a Material
- Notepad++ syntax highlighting for materials
- $basetexture
- $envmapmask (specular mask)
- $envmap (environment map)
- $phong (diffuse reflection)
- $selfillum