Converting Textures

From Valve Developer Community
Jump to: navigation, search

Converting Textures from Half-Life 1 to Source

This document explains how to convert Half-Life 1 WAD file textures to new Source materials. You will want to do this if you wish to use old textures from a map you are converting.

Generally though, converted textures do not look nearly as good as ones made for Source. Old textures are usually always low resolution (128x128 or so), whereas Source materials are higher resolution (512x512). HL2 and Counter-Strike: Source both come with a large number of materials of all types, which you are free to use in any Source map you may make.

For more reading on other aspects of map conversion, see Source Mapping for Half-Life 1 Mappers.

Converting Wads

Valve provides a tool for converting your existing WAD files. It is called xwad. Xwad will make .TGA, .VTF, and .VMT files for each texture in a WAD file. In addition, it will create .resizeinfo files in the materials directory if it has to resize the textures. Then Hammer's File->Convert WAD to VMT command will use them to rescale texture coordinates.

Running Xwad

Run xwad from a command prompt window. Xwad is located in the \bin directory, underneath where you've installed Steam and the Source SDK.

For example, if you've installed the Source SDK here, where username is your Steam login name:

C:\Program Files\Valve\Steam\SteamApps\username\sourcesdk\

The xwad.exe will be located in the \bin directory here:

C:\Program Files\Valve\Steam\SteamApps\username\sourcesdk\bin

To use xwad, you'll need to give it several specific command lines to tell it what WAD to convert and where to put the results.

The command line options you need to give it are as follows:

-BaseDir <basedir>

Specifies the root directory of your game installation. For example if you were converting a wad for Counter-Strike: Source, you would use a path something like C:\Program Files\Valve\Steam\SteamApps\username\counter-strike source\cstrike.

When you run xwad, two folders will be created under the base directory, assuming they don't already exist. One is named materials and will have a new sub-directory named after your wad. xwad will place all the converted texture VTF and VMT files in this directory. The other directory created is named materialsrc and will also contain a sub-directory named after the WAD. Xwad will place TGA versions of each texture in this directory.

-WadFile <wadfilename>

Specifies the name of the WAD file you are converting.

An Xwad Example

Here is a simple example of using xwad. For additional help with xwad, just run it with no arguments, and it will display a list of all command line options available.

xwad.exe -BaseDir "c:\Steam\SteamApps\username\counter-strike source\cstrike" -WadFile d:\Sierra\Half-Life\cstrike\waterworks.wad -vtex

Converts a WAD file named waterworks.wad into a set of new materials in your CS:Source installation. All the new materials (VMF and VMT files) are created in the folder materials\waterworks in your CS:Source installation. An additional folder named materialsrc\waterworks is also created with TGA images of each texture.

Using Existing Source Materials

As mentioned in the introduction to this document, there are a number of very good materials already in Half-Life 2 and Counter-Strike: Source which you may use. You will find many generic textures such as grass, rock, gravel, stone, water, glass, etc. which you can reuse. They will be superior to any texture you convert with xwad. Remember that none of your converted textures will have bump mapping, specularity, or any of those other special features of Source. They also will be a lot lower resolution, and will not look very good in-game.

When you first go to convert a map, go ahead and use all your converted textures. Then make a pass over your map and replace all the old water textures with new existing water materials. Do the same for glass unless you've got a specific need.

Next, you might go over the other more generic nature textures available such as sand, gravel, grass, rock, etc. They will again look much better than your converted textures. The same is true for more generic plaster, stucco, stone and brick materials.

Improving Converted Textures

If you want to rework your textures to be higher resolution or to use other features in Source not set in the automatic conversion, you should read the Material Creation document. It provides extensive details on how to create and work with materials and their properties.

Note:Xwad creates a set of TGA files for your textures, you can use them as a base for modification.

Texture Scaling

It is standard to scale all materials in Source to 0.25 scale, whereas in Half-Life 1 you usually scale textures to 1.0 scale. It may seem odd to use such a small scale at first, but it is the usual method for Source mapping.

Since Source materials are 512x512, a single material scaled to 0.25 will perfectly cover a 128x128 brush. If you construct all your building walls around a standard brush height of 128 tall, you will have no problem using most materials for texturing at this scale.

Using Prop Models to Replace Texture Details

Exploring the models folder in Hammer will show you that there are a large number of prop models available for use. Many of these prop models (such as windows) can be used for very effective replacements of details normally placed on a texture.

For example it is very common in Half-Life 1 textures for details such as windows, doors, trim, etc. to be part of the texture. However Source is capable of handling much higher detail levels. So instead of using textured on windows and other such details, use a more generic texture and then place a prop model on the brush surface to represent the detail. This gives your map a much higher level of detail at very little cost to the engine.

For more information on prop models, see Controlling Geometry Visibility and Compile Times and Prop Types Overview.