✔️ Download example file
See also: Tutorial: Displacements
If you've played around with displacements in Source, you've likely noticed a section in the displacement tab marked Paint Alpha
. For those of you unfamiliar with the tool, it allows you to take a blend texture, such as nature/blendrockgrass004a
and paint on a secondary texture to it by 'painting' it over a second layer's alpha channel. This can only be done on a displacement, and is usually used to add variation to an otherwise bland landscape, or make a smooth transition from one material to another. Surely the process of making this work with your own custom materials is some form of complicated black magic, isn't it?
Well actually, no.
Preparing your VTF files
First up, if you don't already have VTFEdit, you can get it here
. While it's not strictly required
in order to make new materials, it streamlines the process and saves a lot of headaches. If you're using your own textures, make two now, and save them as a TGA or PNG; the base, and what you want it to blend into. There is no special process needed for this to work, as long as you keep in mind the dimensions must be powers of 2 and no larger than 4096x4096, the absolute engine limit. Otherwise, locate and extract the VTF files for the base materials you want to use. I will be using wood/woodfloor006a
. (More on this later.)
Use VTFedit to export the two VTFs you are using into a workable file format (PNG or TGA are recommended) or ready the textures you made, and open them in your favorite image editing program. Edit the images together with the base texture in the top left corner, the "alpha" in the bottom right, and some opacity-based blending in the middle. Save this as [Texturename]_tooltexture
Import all three of your textures into VTFedit and save them as VTFs.
(The _tooltexture file is optional, but recommended so you can see the blending options in Hammer.)
Creating a VMT file
Now that you've gotten the essential parts of the blend texture, it's time to make the VMT that turns them into a material. You can do most of this from VTFedit, but some editing after you save it will be required. Your VMT needs to contain the following data minimum: (values have all been filled in, you will likely want to edit some of them)
WorldVertexTransition is the shader type, and also the most vital part of the material - without using this as the shader, the blend texture will not work.
$basetexture is the texture you want your blend texture to default to, while
$basetexture2 is what you want it to blend with.
%tooltexture is the tool texture you made, which will be used as a thumbnail in Hammer's material browser. This is optional, but Hammer will only show the
$basetexture as a preview, which makes it hard to see the blend in the texture browser.
- Unless you want your material to be plastic, you should also have at least one
"$surfaceprop" value, using the second if your other texture is a different surface type.
%keywords simply sets one or two key words you can enter into the material browser if you want to label it as being part of a specific texture set. I generally use my name as a reminder that it's a custom texture I made.
Save your VMT, apply it in hammer, and test it out ingame.
Example usage techniques
Now, you're probably wondering why I used a wood texture in this example. Allow me to show you what inspired me to experiment with making blend textures, and resulted in this tutorial: As it turns out, using blend textures, there is in fact a way to do this. You simply need to make a room with a false floor above a leak-sealing nodraw floor, and convert the false floor into a displacement. Since you don't have to make a displacement have any height variations, you can simply paint the dust/grass/moss (or whatever!) on the floor and be on your way, with a not-even noticeable impact on performance. Cheating, perhaps, but it gets results. There are tons of unconventional uses you could utilize blend textures for in addition to their intended use for terrain, and I look forward to seeing what you come up with.
Additional features of blend textures
Since 2009, all Source engine games can use the
parameter, which essentially changes the smooth gradient-based alpha painting with a gradient using a mask defined with it as a form of stamping, so you can use a design instead of just a standard brush.
parameter only reads in green and red channels, so you will want to use them as separate layers in your image with an alpha channel, and save it directly as a TGA instead of an image format that may result in losing/merging the layers. Valve uses a straight value of 99 in the red channel, and the green channel, used for the actual pattern, is biased towards
In CS:GO (and any other games that may use Source 2014 or newer), the blend functionality was extended to support up to 4 different textures using the
texture. Creating 4 way blend textures follows a similar principle as 2 way blend textures, but is more complicated due to the additional features supported by the newer version of the engine. Check the links below for more details.