VMT: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(redone)
Line 1: Line 1:
{{mergeto|VMT}}
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. VMT stands for "Valve Material Type".
A '''material''' is a <code>.VMT</code> text file in a mod's <code>materials/</code> folder that defines the appearance and behaviour of a surface. Its chief component is usually a [[Valve Texture Format]] image file, but it also includes information about how the surface reacts when walked on, shot, or applied to a physical object, what [[shader]](s) will draw it, what type of reflections to use, and potentially many, many other properties.
 
The contents of a material will fall into some or all of these categories:
 
# [[Texture]] names
# [[Material surface properties|Physical surface types]]
# [[Shader]]-specific parameters
# [[Controlling Geometry Visibility and Compile Times#Material choices and rendering performance|Fallbacks]]
# [[Material Proxy|Proxies]]


== A simple example ==
== A simple example ==
Line 6: Line 13:
  LightmappedGeneric
  LightmappedGeneric
  {
  {
  $basetexture coast/shingle_01
  $basetexture coast\shingle_01
  $surfaceprop gravel
  $surfaceprop gravel
  }
  }


This is an example of a material for use on [[brush]]es.
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 - i.e. [[brush]]es.
#''The { character opens a set of parameters''
#The <code>[[$basetexture]]</code> parameter is given with <code>coast\shingle_01</code> (a texture). This is what will be drawn on the screen.
#<code>[[$surfaceprop]]</code> 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 [[model]]s another version would need to be created using the <code>[[VertexLitGeneric]]</code> shader, for instance.
 
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. But some params only work with certain shaders - for instance, [[Phong]] effects are only available with VertexLitGeneric. The good news is that you won't encounter any critical errors if a param isn't understood by the shader.
 
{{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.}}


*It is drawn by the <code>LightmappedGeneric</code> shader
== Finding materials ==
*It displays <code>materials/coast/shingle_01.vtf</code>
*It has the physical and reactive properties of gravel


A material for use on [[model]]s would be identical except for the shader, which would be <code>VertexLitGeneric</code>. Valve's stock shaders generally support the same set of parameters (commands starting with <code>$</code>), allowing you to easily switch from one to another.
Materials are stored in the <code>materials\</code> folder of your game or mod. The best way to browse them is from [[Hammer]]'s texture selection screen.


See [[Shader Types and Parameters]] for a full list of Valve's shaders, or [[Shader Authoring]] if you are interested in creating your own.
If you want to open 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 ==
== See also ==


*[[Creating a Material]]
*[[Creating a Material]]
*[[:Category:Material System]]
*[[Notepadpp VDF languages|Notepad++ syntax highlighting for materials]]
*[[Notepadpp VDF languages|Notepad++ syntax highlighting for materials]]
*[[Shader Types and Parameters]]
*[[Valve Texture Format]]


[[Category:Material System]]
[[Category:Material System]]
[[Category:Glossary]]
[[Category:Glossary]]

Revision as of 12:04, 12 July 2008

A material is a .vmt 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. VMT stands for "Valve Material Type".

The contents of a material will fall into some or all of these categories:

  1. Texture names
  2. Physical surface types
  3. Shader-specific parameters
  4. Fallbacks
  5. Proxies

A simple example

LightmappedGeneric
{
	$basetexture coast\shingle_01
	$surfaceprop gravel
}

This is a very basic shingle beach material.

  1. The LightmappedGeneric shader is used, which means that the material is for use on surfaces with lightmaps - i.e. brushes.
  2. The { character opens a set of parameters
  3. The $basetexture parameter is given with coast\shingle_01 (a texture). This is what will be drawn on the screen.
  4. $surfaceprop gives the material the physical properties of gravel.
  5. 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 another version would need to be created using the VertexLitGeneric shader, for instance.

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. But some params only work with certain shaders - for instance, Phong effects are only available with VertexLitGeneric. The good news is that you won't encounter any critical errors if a param isn't understood by the shader.

Tip.pngTip: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.

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 open 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