Material Basics: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Initial Page...needs work.)
 
m (made redir)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A Basic Material for [[TF2]] consists of a standard image file saved as [[TGA]] and converted into a [[VTF]] file using the [[VTEX]] utility found in the ''sourcesdk\bin\orangebox\bin'' folder.  A [[VMT]] text file is also required for [[Hammer]] to see the .vtf file as a material, and it provides a means of supplying parameters for how the material is used in the [[Source_Engine]] as well as modifying how the underlying object behaves...for more information see [[Material]] and for everything you need to know about materials see [[Category:Material_System]].
#redirect [[Creating a Material]]
 
This page will focus on a basic material consisting of a Valve Texture File (.vtf) and a simple Valve Material Type (.vmt) file.  You must have a program which can edit and save images as a .tga file.  Once you have a .tga file you must place it in the ''.\sourcesdk_content\tf\materialsrc'' folder, so place all .tga files for TF2 into ''C:\Program Files\Steam\steamapps\playername\sourcesdk_content\tf\materialsrc'' where playername is your Steam account name.
 
Next, you must convert the .tga file into a .vtf file using the vtex.exe program.  The current SDK requires that you create a shortcut to the vtex.exe file and in the target text box of the shortcut which has the pathname of vtex.exe in it add to the end of it the pathname to the game folder and -nop4 so that it looks like: ''"C:\Program Files\Steam\steamapps\playername\sourcesdk\bin\orangebox\bin\vtex.exe" -game "C:\Program Files\Steam\steamapps\playername\team fortress 2\tf" -nop4''.  Now you can drag and drop the .tga file onto the vtex.exe shortcut and a console window will appear with information on the conversion process.  Vtex.exe will place a .vtf file in the ''.\team fortress 2\tf\materials'' folder, but you still cannot use it in [[Hammer]] until you create a .vmt text file which has the same name as the .vtf file (with just the extension changed).
 
The most basic .vmt file should look like:
 
LightmappedGeneric
{
  "$basetexture" "''name_of_.vtf_file_without_extension''"
  "$basetexturetransform" "center .5 .5 scale 1 1 rotate 0 translate 0 0"
}
 
So for example if you create an image file named ''sample.tga'' and place it in the ''.\sourcesdk_content\tf\materialsrc'' folder then drag and drop it onto the vtex.exe shortcut then a file named ''sample.vtf'' will appear in the ''.\team fortress 2\tf\materials'' folder.  You must then create a text file named ''sample.vmt'' which has as it's most basic contents:
 
LightmappedGeneric
{
  "$basetexture" "sample"
  "$basetexturetransform" "center .5 .5 scale 1 1 rotate 0 translate 0 0"
}
 
Now you can use the material in Hammer.
 
A discusson of the .vmt content can be found at [[Material]].

Latest revision as of 04:16, 13 July 2008