Difference between revisions of "Material"

From Valve Developer Community
Jump to: navigation, search
m
Line 1: Line 1:
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".
+
'''Материал''' это текстовый <code>.vmt</code> файл содержащий описание двумерных текстур. Это описание содержит всю необходимую движку информация для визуализации, рендеринга, построения физики. VMT расшифровывается как "Valve Material Type" (Тип Материала Valve) .
  
The contents of a material will fall into some or all of these categories:
+
В описание материала могут входит все или некоторые следующие данные:
  
 
# [[Texture]] names
 
# [[Texture]] names
Line 9: Line 9:
 
# [[Material Proxy|Proxies]]
 
# [[Material Proxy|Proxies]]
  
== A simple example ==
+
== Простой пример ==
  
 
  LightmappedGeneric
 
  LightmappedGeneric
Line 17: Line 17:
 
  }
 
  }
  
This is a very basic [[Wikipedia:Shingle beach|shingle beach]] material.
+
Это очень простой [[Wikipedia:Shingle beach|shingle beach]] материал.
  
#The <code>[[LightmappedGeneric]]</code> shader is used, which means that the material is for use on surfaces with [[lightmap]]s - i.e. [[brush]]es.
+
#Этот  <code>[[LightmappedGeneric]]</code> код использует шейдеры, и означает что он предназначен для использования на поверхностях с [[lightmap]]s (лайтмапы) то есть на [[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> (a texture). This is what will be drawn on the screen.
 
#The <code>[[$basetexture]]</code> parameter is given with <code>coast\shingle_01</code> (a texture). This is what will be drawn on the screen.

Revision as of 13:50, 21 February 2009

Материал это текстовый .vmt файл содержащий описание двумерных текстур. Это описание содержит всю необходимую движку информация для визуализации, рендеринга, построения физики. VMT расшифровывается как "Valve Material Type" (Тип Материала Valve) .

В описание материала могут входит все или некоторые следующие данные:

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

Простой пример

LightmappedGeneric
{
	$basetexture coast\shingle_01
	$surfaceprop gravel
}

Это очень простой shingle beach материал.

  1. Этот LightmappedGeneric код использует шейдеры, и означает что он предназначен для использования на поверхностях с lightmaps (лайтмапы) то есть на 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, 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. 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.

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