Need Help making Guide

  • Site Migration: See bugs? Report them here. Want something changed or have an idea? Suggest it here.


May 12, 2013
Since November 2015 I've been trying to write a guide on the proper creation of VTF and VMT files. My slight language barrier and especially the fact that I'm terrible at writing things means that I have no idea how to do this properly. I have made 4 textfiles filled with random information so far.
Maybe somebody can help me structure this and remove pointless things or add to more important parts?

This first page is a simple explanation of this project
Textures and Materials will be explained
It should cover a lot, but not too much detail in less usefull parts
Links to the VDC, and possibly other places will be provided

I’m not sure about the structure yet. Maybe you can help by copy+pasting and then giving me a link to what you got?

Comments are enabled for everybody.

Quick Info

What is a texture?
	A bunch of values placed on a predefined grid
		red, green, blue, black/white, alpha, frame
			animation, cubemap, volumetric, mipmap

What types of textures are there and what are they used for?
	diffuse/albedo, bumpmap/normalmap, envmap, masks, lightwarp, …

What is a material?
	A textfile telling the game how to use the textures
	Specifies many other properties

What makes materials different from another?
		LightmappedGeneric, VertexLitGeneric, UnLitGeneric, ...

What file types are used and how are they special if at all
	Textures: .vtf
		stores a ton by itself
	Materials: .vmt
		a simple text file

What programs are used
	VTFEdit to convert to .vtf + edit properties
	Notepad++ to create and edit .vmts

File locations, naming, ?
	tf/materials/, nature, concrete, other
	tf/materials/models/, props_xyz, other
	as short and descriptive as possible
		numbers for identical names
		letters for similar materials


Valve Texture Format
Stores any type of texture
Stores other special information like reflectivity color
VTFEdit creates one per drag+drop
	Settings on texture creation are important to understand
			Compression method?
					DXT1 with one bit alpha
			Alpha Y/N?
			Mipmap Filter
			Sharpen Filter
			What happens without a mipmap?
		VTF Version
		Compute Reflectiviy Y/N?
		Generate Thumbnail Y/N?
		Should other settings ever be changed?
	Can also edit some of the properties
		Point Sample
		No Mipmap / No Level Of Detail

Texture creation and explanation
		image editors

		programs (image editors, 3D-software, other)
		Cubemaps and Skyboxes


Valve Material Type
	brackets "{ }"
		shows a collection of information
		the word right before the bracket specifies the type of information
					{ } or [ ]
	tab character "		"
		at the start of a line to better visualise brackets
		inbetween words to give even spacing
		makes reading/editing a lot easier for everybody
		ignored by the game
	space character "  "
		to seperate things
	quotation marks """"
		"keeps words or numbers together"
		"mostly not required"
		"a good habit to wrap them around everything"
		Nothing is case sensitive - Can Be Used Whenever You Want To
		MostlySeen when youCantUse spaces or_underscores
	Line breaks
		also ignored by the game
		helps greatly in reading and editing
		not using line breaks is the most horrible thing anybody could do
	Create a .txt file and change file extension to .vmt
	You might need to enable the ability of changing file extensions
		Phong and Rimlighting
		Fake parameters (for proxies)
			tool parameters


Strange words and their meanings:
	A single point that holds color related information
	Pixels appear on your screen and are what images made out of
	A Pixel that has been placed in a 3D-environment.
	considering size, they almost never appear 1:1 with a pixel on your screen.

What is a texture?

A texture stores a lot of information in a grid-like space.
The stored informations are usually called "channel". Red-channel, Green-channel, Blue-channel, Alpha-channel. There also exists a special Black/White channel.
	Red, Green and Blue are simply colors.
	Black/White is used when only one channel is needed.
	The Alpha-channel is usually seen for transparency, but games use it for all sorts of things.
This grid is usually two-dimensional but can also be three-dimensional.
In the source engine, the height and width are both limited to 2^n, where n is a whole number from 0 to 12. (1 pixel to 4096 pixels)
The third dimension "length" has no limitations. However, the increase in filesize can be a limitation.
Making use the third-dimension results in the texture being one of the following types:
	An animated texture. Used for animations, like fire
	A cubemap. Used for reflections. Mostly seen on glass and weapons.
	A volumetric texture. Rarely used, if at all. I don't know how to make use of this myself.
Almost every texture also stores another dimension: Mipmaps.
Mipmaps are required for lower graphic settings, they make things look pretty from a distance and they reduce GPU-load.

What types of textures are there and what are they used for?

There are many different types of textures.
Most common is the diffuse map, also called albedo. It simply stores an image to be projected on a surface. Here is an example:
The second most common is the normalmap. In source, it is often refered to as "bumpmap". These are two different things, but the intention is the same: Three-Dimensional lighting on a two-dimensional surface.
The normalmap stores in what direction a pixel of the surface is pointing to, giving the engine enough information to fake the lighting. The different color-channels are used to the X Y and Z coordinates. Z always stays above 128, otherwise the surface would be pointing backwards, which is not possible.
Another quite common thing is the envmap. It stores a 3d image that represents the inside faces of a cube, making it 6 images. It is used for pre-made reflections on various surfaces.
There are also various types of "masks". They are used so that things like reflections appear in different intensity on a single surface. Most masks only require a single channel, which is why most of them are included in other textures as the Alpha-channel.
Examples of masks are the envmapmask,
the blendmodulate,
and the phongmask (only seen as the alpha-channel in albedos and normalmaps)
Lastly I want to show you the type of texture that has helped the most in making TF2 look like what is, while being be simplest texture of them all:
The lightwarp texture. It is a one-dimensional texture, meaning its just a row of pixels. Lightwarps tint a texel depending on how bright they are.
If you would try to make a lightwarptexture that doesnt actually affect anything, meaning you are trying to find the "default state", you would have a single grey pixel.
The tinting works like this: On the left, we have the color for the dark pixels. On the right, we have the color for the bright pixels.

What is a material?

Materials are simple textfiles. They tell the game what textures to use and how to use them.
They also tell the game more than just visual information. The type of surface, meaning what sound it makes when you walk on it or shoot it, is also specified in the material.

LightMapped- //Hammer brushes
VertexLit- //Models
UnLit- //Anything; No lighting
-Generic //standart texture
-TwoTexture //enables $texture2
WireFrame //No textures; just a colored wireframe
EyeRefract //Eyes on models

"$color2" "[1 1 1]" //R,G,B; works by multiplying; [1 1 1] does nothing; [0 0 0] makes black; [2 2 2] doubles brightness
"$basetexture" "FILEPATH STARTING AFTER (mod)/materials/" //The basis of the texture; the albedo
"$bumpmap" "FILEPATH STARTING AFTER (mod)/materials/" //normalmap
	"$ssbump" "1" //Is the normal map actually a ssbump? 1 = yes
"$texture2" "FILEPATH STARTING AFTER (mod)/materials/" //Used by -TwoTexture; Multiplied onto albedo

What is VTF
Valve texture format, saves textures and some extra data about them.
Textures must be 2^N in both X and Y. (X and Y are usually refered to as U and V)
Multiple images can be stored in a single vtf. These are used mostly for animations and cubemaps.

What is VMT
Valve material type, saves properties of a surface.
This means which textures to use and how to use them.
Also controls how a surface is lit and other special effects.

Usefull Programs and Stuff
Notepad++ Plugin
Windows VTF Shell Extension

Making a VTF
Drag PNG or TGA in VTFEdit
You are greeted by a window with 3 tabs: General, Advanced, Resources
	There are 4 sections here: General, Mipmaps, Resize, Normal Map
		Normal Format and Alpha Format
			Always pick the same for both to counteract any potential errors that might happen.
			Look up the "What texture compression to use" part of this guide.
		Texture Type
			Most cases you will want "Animated Texture". Considering you only have a single frame, it will not actually be animated.
		When viewed in low texture resolution, from an angle or from far away, the texture will switch to a lower resolution of itself. These are called "Mipmaps".
		You should always have "Generate Mipmaps" checked unless you have a very good reason not to! Preventing texture seems on a model is not a valid reason.
		Mipmap Filer and Sharpen Filter are something you are gonna have to play around with. Some texture look better with a strong sharpen filter, others look better with a smoothen filter.
			I generaly use Quadratic + Sharpen Soft
		Don't even bother with this. It doesn't even seem to work anyways(?).
	Normal Map
		Don't bother with this either. Automated creation of normal maps is always a bad idea.
		Pick 7.3 and never change it. Do not pick 7.4!
	Gamma Correction
		I dunno if that's a good idea to have checked. I have it unchecked.
		Check "Compute Reflectivity" and "Genereate Thumbnail". Uncheck if you are making a texture that is not meant to be an albedo/diffuse/colormap. (Although keeping it checked won't hurt anybody)
	DXT Compression
		Always leave it on High.
	The other settings here are weird and don't need to be touched.
	Ignore this stuff unless you really wanna include information in the VTF, like "Hey look I made this texture".

Press "Ok"

There are 4 tabs on the left: File System, Image, Info, Resources.
Most of these are read-only. You will only ever need "Image" and "Info"
			The frame of the animation. Click the arrows to look at the different frames or click "Play" below to have VTFEdit do the clicking for you.
			Look at a different side of a cubemap.
			Look at a different slice of a volumetric texture.
			Look at smaller version of the texture. Use this to check if your mipmaps settings are good or not.
		Key, Shift, Gamma
			These always appear greyed out for me, no idea what makes them useable.
		Some important information is stored in these flags. Click the little box to place or remove a checkmark. Some flags are determined when the VTF is created, you can not change these afterwards!
		Look up the "What do these flags do" part of this guide.
	Here you can find information about the texture, like the resolution, the file size and the compression format used.

Making a VMT
Try to copy existing VMTs and slightly edit them if you are having trouble understanding this stuff.
Every VMT starts with a Shader. Most common are LightmappedGeneric, VertexlitGeneric and UnlitGeneric.
	Look up the "Which shader do I use" part of this guide.