Template:Archived page history/VMT: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (revert)
Line 1: Line 1:
[http://troniny.ovh.org/gallery/layout/ejhavr.html kids tennis racquets] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/nsxnag.html spanish for police officers] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/fuaeit.html discount ephedrine] [http://aura.c3.hu/thumb/xrumxx.html paint colour charts australia] [http://kristinlyseggen.com/gallery/1documentaries/7travel/asmrti.html annuity florida private trust] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/jxthnm.html free retro ringtones] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/vffusw.html christian ringtones] [http://aura.c3.hu/thumb/xuoqds.html samsung sph] [http://aura.c3.hu/thumb/ntgvlk.html ocean city new jersey beach front rental] [http://maps.my2gig.com/cache/cvrxub.html ragnorak online characters] [http://aura.c3.hu/thumb/ggglgl.html what to do in a blizzard] [http://informer.siam.edu/themes/hm/bdgish.html buy viagra] [http://informer.siam.edu/themes/hm/jjorqt.html download latin ringtones] [http://www.olemissfans.com/chatpro/image/ntolgo.html professional credit counselor] [http://kom-pas.de/3xcms/config/hkatuploads/images/fecjnt.html the male g spot] [http://activeimage.c3.hu/css/lsquoo.html european cycling holidays] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/qgotxh.html toronto fitness clubs] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/pktgpc.html web translator] [http://maps.my2gig.com/cache/sslglr.html 2005 films] [http://2001.c3.hu/mas/oobrcr.html light heavyweight champion] [http://2001.c3.hu/mas/caweql.html accountable held mistake people their who] [http://www.salona-yachts.eu/misc/dlfion.html judges commissions] [http://aura.c3.hu/thumb/lrxflq.html keynote speaker orlando] [http://www.systemsupport.und.edu/cache/avatars/emo/kqbuem.html country ringtones] [http://activeimage.c3.hu/css/eqgnqe.html professional english training] [http://2001.c3.hu/mas/lmadwj.html matrix mechanics] [http://www.stillwaterhomes.com/listings/images/pic/xduhnl.html tco 99] [http://kristinlyseggen.com/gallery/1documentaries/7travel/hkkera.html expensive jewelry designers] [http://informer.siam.edu/themes/hm/veaalg.html mobile ringtones] [http://www.lowell.edu/styles/old_style/css/nxpeuc.html poop comes out] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/irfjrn.html discount carisoprodol] [http://kristinlyseggen.com/gallery/1documentaries/7travel/scgwgl.html elevated creatine level] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/uxjqrc.html this is the moment that you know that you] [http://troniny.ovh.org/gallery/layout/bdmcpw.html sports drink comparisons] [http://www.plurpage.com/classifieds/cache/hbaivm.html indiana realistate] [http://informer.siam.edu/themes/hm/rppmbt.html free tmobile ringtones] [http://www.stillwaterhomes.com/listings/images/pic/trpfeu.html recycling uk] [http://www.olemissfans.com/chatpro/image/ekngjd.html search aol members profiles] [http://activeimage.c3.hu/css/fxqjbj.html laundromat or full or service] [http://informer.siam.edu/themes/hm/ioccfb.html free voice ringtones] [http://kom-pas.de/3xcms/config/hkatuploads/images/quuwrc.html engine makes noise] [http://kom-pas.de/3xcms/config/hkatuploads/images/hmkrhr.html at the end of saw 2] [http://aura.c3.hu/thumb/niamto.html no warning ben cook] [http://ndr.hu/rhodes/jgxwcu.html men only magazine website] [http://activeimage.c3.hu/css/mkfbbr.html sean taylor pic] [http://www.stillwaterhomes.com/listings/images/pic/vcufwk.html memory stick duo 512mb] [http://kristinlyseggen.com/gallery/1documentaries/7travel/rkvnql.html maledetto] [http://www.easypayinfo.com/subscribe/tmp/xtroek.html phone from morocco] [http://aura.c3.hu/thumb/cumods.html electrical workbenches] [http://2001.c3.hu/mas/owckeg.html english name into chinese] [http://kristinlyseggen.com/gallery/1documentaries/7travel/fqwele.html sex uma] [http://www.stillwaterhomes.com/listings/images/pic/aqkdoj.html rolling stone covers posters] [http://aura.c3.hu/thumb/iepltu.html phillies logo] [http://ndr.hu/rhodes/xdpdaj.html outrageous video] [http://maps.my2gig.com/cache/kfogbs.html on a day like today chords] [http://www.plurpage.com/classifieds/cache/gmqeqd.html need for speed ii mp3] [http://www.stillwaterhomes.com/listings/images/pic/momaej.html list of different types of doctors] [http://ndr.hu/rhodes/nkveji.html advanced computer architecture lecture notes] [http://www.olemissfans.com/chatpro/image/gnbwgp.html legal provider service] [http://aura.c3.hu/thumb/fxwrnw.html 7th grade science experiments] [http://www.farmelco.hu/test/css/ijaamb.html string bikini stories] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/itmfvq.html metformin online] [http://www.easypayinfo.com/subscribe/tmp/wbbock.html artificial plants australia] [http://kristinlyseggen.com/gallery/1documentaries/7travel/xkxxtd.html pageant makeup] [http://activeimage.c3.hu/css/rerwsa.html rosmalen] [http://activeimage.c3.hu/css/rmmsmb.html atl credit movie] [http://www.stillwaterhomes.com/listings/images/pic/chklad.html people talk to themselves] [http://aura.c3.hu/thumb/mhajfv.html jack london square berkely] [http://ndr.hu/rhodes/gdorfl.html supermarket delivery ny] [http://www.lowell.edu/styles/old_style/css/lbtbjt.html toddler baseball jersey] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/tplvlq.html window server 2003 hardware requirement] [http://informer.siam.edu/themes/hm/buibii.html sonyericsson ringtone] [http://troniny.ovh.org/gallery/layout/fjpqrc.html xerox printer cartridge] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/xcfujv.html free phone ringtones] [http://troniny.ovh.org/gallery/layout/fttame.html losing a father at a young age] [http://maps.my2gig.com/cache/lukqgt.html song lyrics have you ever seen the rain] [http://2001.c3.hu/mas/imkkfs.html 171 form standard] [http://aura.c3.hu/thumb/cgovsv.html illinois senate district map] [http://www.easypayinfo.com/subscribe/tmp/llfmev.html engine maryland performance] [http://2001.c3.hu/mas/plcwaa.html john lewis complaints] [http://troniny.ovh.org/gallery/layout/ggriit.html 10 most reliable cars] [http://informer.siam.edu/themes/hm/tinqal.html celebrex online] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/eljfrr.html 3 manual mazda service] [http://kristinlyseggen.com/gallery/1documentaries/7travel/qjvhtv.html shake speare poems] [http://aura.c3.hu/thumb/iuwesw.html live nude toons] [http://ndr.hu/rhodes/grlgrh.html ncaa coaches poll] [http://troniny.ovh.org/gallery/layout/abfqng.html pocket polly search] [http://www.easypayinfo.com/subscribe/tmp/koeqsm.html white zombie shirt] [http://www.salona-yachts.eu/misc/qwplbh.html ap world history tests] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/jfhkjq.html vicodin online] [http://2001.c3.hu/mas/krhhec.html alberta edmonton journal] [http://www.easypayinfo.com/subscribe/tmp/uwtrax.html isuzu dealer austin] [http://www.plurpage.com/classifieds/cache/ewpsnt.html academy award winning documentaries] [http://www.plurpage.com/classifieds/cache/wjrgio.html 2 corel drawing] [http://ndr.hu/rhodes/pxjkab.html off site backup storage] [http://ndr.hu/rhodes/tevdov.html ohio state football flag] [http://aura.c3.hu/thumb/gbipse.html pci express video cards nvidia] [http://aura.c3.hu/thumb/ngurpg.html auto body salvage yards] [http://www.olemissfans.com/chatpro/image/folkgt.html university of iowa job net] [http://informer.siam.edu/themes/hm/iadhgk.html free music ringtones]
'''VMT''' (Valve Material Type) file tells the Source 'Graphics Rendering Engine' how the surface of a brush or model should appear in game.
'''VMT (Valve Material Type) file tells the Source 'Graphics Rendering Engine' how the surface of a brush or model should appear in game. '''


* The Source [[Material System]] is built on VMT files.
* The Source [[Material System]] is built on VMT files.
* VMT files are all kept in the '''<code>game_directory/materials</code>''' folder (or sub-folders thereof) and use the '''<code>.vmt</code>''' extension so that the Source Engine knows where to find them.
* VMT files are all kept in the <code>game_directory/materials</code> folder (or sub-folders thereof) and use the <code>.vmt</code> extension so that the Source Engine knows where to find them.
* The contents of a (text-based) VMT file specify which '''[[Shader]]s''' should be used to render the surface, and define a configuration of the various '''Shader Parameters''' for a particular material type surface. For specifics, please see the '''[[:Category:List of Shaders|List of Shaders]]''' and the '''[[:Category:List of Shader Parameters|List of Shader Parameters]]'''
* The contents of a (text-based) VMT file specify which [[Shader]]s should be used to render the surface, and define a configuration of the various Shader Parameters for a particular material type surface. For specifics, please see the [[:Category:List of Shaders|List of Shaders]] and the [[:Category:List of Shader Parameters|List of Shader Parameters]]


Probably the most important Shader Parameter, [[$basetexture]], defines which '''[[VTF]]''' (Valve Texture File) texture to use on that surface.  
Probably the most important Shader Parameter, [[$basetexture]], defines which [[VTF]] (Valve Texture File) texture to use on that surface.  


Almost all Shader Parameters define 'visual' properties of a surface, with the notable exception of [[$surfaceprop]] ('surface properties') which affects such things as the sound made when an object collides with the surface. The more sophisticated 'Physics Interaction' characteristics of a world object (which apply to models but not brushes) are specified within the object's [[QC]] file.
Almost all Shader Parameters define 'visual' properties of a surface, with the notable exception of [[$surfaceprop]] ('surface properties') which affects such things as the sound made when an object collides with the surface. The more sophisticated 'Physics Interaction' characteristics of a world object (which apply to models but not brushes) are specified within the object's [[QC]] file.
Line 19: Line 18:


Here the VMT simply says that the "[[LightmappedGeneric]]" shader should be used to render this material type, and it should apply it to the Shingle_01.vtf (its [[$basetexture]]) which can be found inside the <code>game_directory/materials/Coast</code> directory. (Note that the [[$basetexture]] path is ''always'' relative to the <code>game_directory/materials</code> folder and the <code>.vtf</code> file extension is ''not'' necessary.) The second parameter ([[$surfaceprop]]) tells it to use the sound effects, etc associated with 'gravel' materials.
Here the VMT simply says that the "[[LightmappedGeneric]]" shader should be used to render this material type, and it should apply it to the Shingle_01.vtf (its [[$basetexture]]) which can be found inside the <code>game_directory/materials/Coast</code> directory. (Note that the [[$basetexture]] path is ''always'' relative to the <code>game_directory/materials</code> folder and the <code>.vtf</code> file extension is ''not'' necessary.) The second parameter ([[$surfaceprop]]) tells it to use the sound effects, etc associated with 'gravel' materials.


== Creating a Valve Material (.vmt) file ==
== Creating a Valve Material (.vmt) file ==
There are [[:Category:List of Shaders|many shaders]] that can be used to render a texture. To begin with, we'll use a simple shader: <code>LightmappedGeneric</code>. This shader is used for world surfaces that should receive [[lightmap]]s.
There are [[:Category:List of Shaders|many shaders]] that can be used to render a texture. To begin with, we'll use a simple shader: <code>LightmappedGeneric</code>. This shader is used for world surfaces that should receive [[lightmap]]s.


Line 37: Line 32:


This will render the <code>"test/MyTexture"</code> texture file (.vtf) opaquely and with lightmaps applied to it. This is most generally used for textures applied to brush surfaces (like walls).  
This will render the <code>"test/MyTexture"</code> texture file (.vtf) opaquely and with lightmaps applied to it. This is most generally used for textures applied to brush surfaces (like walls).  


One of the easiest methods of creating new .vmt files is to open an existing .vmt that has similar properties to the material you are creating. Edit the contents of the file and save it with a different name to create a new material.
One of the easiest methods of creating new .vmt files is to open an existing .vmt that has similar properties to the material you are creating. Edit the contents of the file and save it with a different name to create a new material.


== More about material files ==
== More about material files ==
 
Let’s start by looking at an example of a material file:
Let’s start by looking at an example of a material file:


<pre>
<pre>
Line 96: Line 87:
</pre>
</pre>


For information on shader fallbacks, see '''Material choices and rendering performance''' in [[Controlling Geometry Visibility and Compile Times]] and [[Half-Life 2 Shader Fallbacks]].
For information on shader fallbacks, see [http://developer.valvesoftware.com/wiki/Controlling_Geometry_Visibility_and_Compile_Times#Material_choices_and_rendering_performance Material choices and rendering performance] and [[Half-Life 2 Shader Fallbacks]].


One other thing you'll see in Valve Material files is the occasional variable starting with a '%'.
One other thing you'll see in Valve Material files is the occasional variable starting with a '%'.
Line 112: Line 103:
This simply means that the variable is used by tools only and won't be loaded by the engine. The only variables that need '%' are <code>'%tooltexture"</code>, <code>"%keywords"</code>, <code>"%detailtype"</code>, and all of the compile variables like <code>"%compileWater"</code> or <code>"%compileHint"</code>.
This simply means that the variable is used by tools only and won't be loaded by the engine. The only variables that need '%' are <code>'%tooltexture"</code>, <code>"%keywords"</code>, <code>"%detailtype"</code>, and all of the compile variables like <code>"%compileWater"</code> or <code>"%compileHint"</code>.


==See also==
== See also ==
 
* [[Material]]
* [[Material]]
* [[Creating a Material]]
* [[Creating a Material]]
* [[Shader Types and Parameters]]
* [[Shader Types and Parameters]]
[[Category: Glossary]] [[Category: Material System]]
 
[[Category: Glossary]]
[[Category: Material System]]

Revision as of 02:22, 13 November 2007

VMT (Valve Material Type) file tells the Source 'Graphics Rendering Engine' how the surface of a brush or model should appear in game.

  • The Source Material System is built on VMT files.
  • VMT files are all kept in the game_directory/materials folder (or sub-folders thereof) and use the .vmt extension so that the Source Engine knows where to find them.
  • The contents of a (text-based) VMT file specify which Shaders should be used to render the surface, and define a configuration of the various Shader Parameters for a particular material type surface. For specifics, please see the List of Shaders and the List of Shader Parameters

Probably the most important Shader Parameter, $basetexture, defines which VTF (Valve Texture File) texture to use on that surface.

Almost all Shader Parameters define 'visual' properties of a surface, with the notable exception of $surfaceprop ('surface properties') which affects such things as the sound made when an object collides with the surface. The more sophisticated 'Physics Interaction' characteristics of a world object (which apply to models but not brushes) are specified within the object's QC file.

An example of the one of the simplest VMT files:

"LightmappedGeneric"
{
   "$basetexture" "Coast/Shingle_01"
   "$surfaceprop" "gravel"
}

Here the VMT simply says that the "LightmappedGeneric" shader should be used to render this material type, and it should apply it to the Shingle_01.vtf (its $basetexture) which can be found inside the game_directory/materials/Coast directory. (Note that the $basetexture path is always relative to the game_directory/materials folder and the .vtf file extension is not necessary.) The second parameter ($surfaceprop) tells it to use the sound effects, etc associated with 'gravel' materials.

Creating a Valve Material (.vmt) file

There are many shaders that can be used to render a texture. To begin with, we'll use a simple shader: LightmappedGeneric. This shader is used for world surfaces that should receive lightmaps.

The simplest definition of this shader is:

"LightmappedGeneric"
{
    "$basetexture" "test/MyTexture"
}

This will render the "test/MyTexture" texture file (.vtf) opaquely and with lightmaps applied to it. This is most generally used for textures applied to brush surfaces (like walls).

One of the easiest methods of creating new .vmt files is to open an existing .vmt that has similar properties to the material you are creating. Edit the contents of the file and save it with a different name to create a new material.

More about material files

Let’s start by looking at an example of a material file:

"LightmappedGeneric"
{             
    // String values are quoted 
    "$basetexture" "shadertest/LightmappedTexture"
    "$envmap" "shadertest/LightmappedTexture_envmap"

    // Vector values are quoted 
    "$color" "[1 0 0]"
    // Float and integer values are *not* quoted 

    "$alpha" 0.5 
    "$nocull" 1
}

The first line of the material file is the name of the shader to be used. The material variables for the shader are defined inside the curly braces. Note that you should not have '=' between the material variable name and its value. Also note that comment lines use '//'. Any text after the '//' on the same line will be ignored when the material is loaded.

If the shader needs to fallback to a simpler shader because it's running on a lower-end system, you can optionally specify an additional block to override material variable values specified in the original block.

Here's an example:

"LightmappedGeneric"
{               
    "$basetexture" "shadertest/LightmappedTexture"
	
    "$envmap" "shadertest/LightmappedTexture_envmap"

    // If the shader falls back to shader "LightmappedGeneric_DX7",
    // then the environment map defined in this block will be used instead of the
    // one defined above. Since $basetexture isn't defined in this block,
    // the original one will be used.
    "LightmappedGeneric_DX7"
    {
        "$envmap" "shadertest/OverrideEnvMap"
    }
	
    // If the shader falls back to shader "LightmappedGeneric_DX6",
    // then the base texture defined in this block will be used instead of the
    // one defined above. Since $envmap isn't defined in this block, the original
    // one will be used.
    "LightmappedGeneric_DX6"
    {
        "$basetexture" "shadertest/OverrideTexture"
    }
}

For information on shader fallbacks, see Material choices and rendering performance and Half-Life 2 Shader Fallbacks.

One other thing you'll see in Valve Material files is the occasional variable starting with a '%'.

For example:

"UnlitGeneric"
{
    $envmap" "shadertest/shadertest_envmap"
    %tooltexture" "shadertest/shadertest_envmap"
}

This simply means that the variable is used by tools only and won't be loaded by the engine. The only variables that need '%' are '%tooltexture", "%keywords", "%detailtype", and all of the compile variables like "%compileWater" or "%compileHint".

See also