Creating a Material
This tutorial is a step-by-step guide to creating a brand new material, including the creation of the material's texture.
Creating a texture
Any image file can be used as a texture, so long as both of its dimensions (height and width) are a power of two: 2, 4, 8, 16, 256, 1024, and so on. Valve's world textures are generally 512x512, but you are at liberty to use whatever resolution you see fit. Higher resolutions lower performance but make an image sharper when viewed up close. Bear in mind though that if you go too high, quality may actually degrade because of the amount of resizing required.
Different classes of object have different standard resolutions (e.g. character models' are very high). Check Valve's choices in source materials.gcf
with GCFScape if you are ever confused.

Converting the texture
Textures must be converted to the Valve Texture Format before Source can use them. The tool Valve provide for this is VTEX. It's a command line tool with quite a few limitations however, and the third-party tool VTFEdit is preferable: it provides a graphical user interface, allows you to change a texture's properties without re-compiling it from scratch, accepts a wide range of image formats, and doesn't require the creation of script files for each and every texture. There are a handful of situations where you'll need to fall back on VTEX — but only a handful.
(The author of VTFEdit has also created VTF plug-ins that let you save to the format directly from Photoshop and Paint.NET, but this tutorial will not cover them as not everyone uses those tools.)
To import your texture with VTFEdit, use File > Import
or press Ctrl+I. Select your image and you will be presented with the import screen:
General settings
These settings are the most important. There are three:
- Normal format
- The sub-format the texture should be stored in if it is opaque.
- Alpha format
- The sub-format the texture should be stored in if it has an alpha channel.
- Texture type
- How this texture will be used; normally as an Animated Texture, even if it doesn't actually have animation.
If you're making a plain and simple world texture you won't need to change any of these. If you're making a texture with fine gradient detail however, you'll need to choose formats that don't compress the image.
Mipmap settings
Mipmaps are low-resolution versions of a texture that swap in when a surface is far away from the camera. They greatly reduce the amount of texture downscaling needed, improving both performance and image quality.
TextureHub has demonstrations of the various filters available. Textures that will appear in the 3D world should have mipmaps; textures that will only be used in a 2D interface should not.

If you want your texture to appear sharp at low texture detail you must instead enable the "No Level Of Detail" option after it has been compiled. Not generating mipmaps is only recommended for UI textures that are never scaled down.
Normal map settings
These (mis-labelled) settings allow you to automatically generate a bump map from your input image. You'll want to do this properly with an image editor for the material you ship, but the automated option is there if you want quick results or a base to work from.
Configuring and saving
When you hit OK the input file is converted (there may be quite a lengthy pause for large images) and the output VTF appears. Now all that is left is configuring the texture with the options in the checkbox list on the left-hand side of the screen. See Valve Texture Format#Image_flags for descriptions of each.
Finally, save the file somewhere under your game or mod's \materials
folder.
Creating a material
Source doesn't access textures directly. Everything goes through a material.
Materials are script files that can be created in any text editor, but it's recommended that you use Notepad++ in conjunction with the community-made syntax highlighting rules. For your material to be detected, you must save it under your game or mod's \materials
folder with the extension .vmt
.

Syntax
A material file looks like this:
<shader> { <parameter> <value> ... }
LightmappedGeneric { $basetexture coast\shingle_01 $surfaceprop gravel }
There are many shaders to choose from, but most materials will use either LightmappedGeneric
(brushes) or VertexLitGeneric
(models). The third most common shader is UnlitGeneric
, which is used for UI materials and the occasional tool texture.
Parameters
- For a list of all documented shader parameters, see Category:List of Shader Parameters.
With a shader chosen you're onto parameters (also called commands). There are hundreds of options for what to put in a material so this article will only cover the most common, which are accepted by more or less all shaders. They are:
