Note:Most first-party games don't have a copy of this tool; the version of the tool found in the old "SourceSDK" depot can still be used for any branch (all 4 included versions of xwad.exe are the same).
A copy of this command-line tool can be found in following folder: 
common\SourceSDK\bin\<branchname>\bin\xwad.exe
. This tool can convert WAD, BMP, and SPR files to TGA and accompanied VMT files, as well as call vtex to generate associated VTF files.
After running XWAD and converting the textures to VTF, use the Convert WAD to VMT... button in
Hammer 4.x's File menu (not in
) to automatically add material paths and fix the scaling of previously non-power-of-two textures.
Caveats
Bug:Xwad always outputs pixels that used index 255 as transparent, even if they aren't flagged as such[Elaborate?]. Only textures that are flagged as transparent will have the transparent pixels modified to work better with texture filtering.
Workaround:Convert the output folder(s) to BGRA8888 using
VTFEdit, then use
VIDE's batch VTF converter to convert the textures that should be opaque to BGR565, BGR888, or DXT1.
[todo tested in ?]
Syntax
Stub
This article or section is a stub. You can help by expanding it.
Options
This Template page is actively undergoing a major edit.As a courtesy, please do not edit this Template while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.
The person who added this notice will be listed in its edit history should you wish to contact them.
Required
- -basedir <path>
- Location of gameinfo.txt.
- If xwad is called from the

materialsrc
directory, then .. will suffice.
- -wadfile <file>.wad
- -bmpfile <file>.bmp
- -sprfile <file>.spr
Convert a WAD, BMP, or SPR, respectively. Accepts preceding file paths and wildcards.
Optional
- -transparent
- Flag input BMP files as having alphatest transparency. For WAD files, this happens automatically for {-prefixed textures, and for SPR file, this happens automatically if the sprite has its transparency mode set to alphatest.
- A texture flagged as transparent will have texels using palette index 255 (the last color) dilated based upon surrounding opaque texels, and $alphatest 1 added to the VMT.
- Palette index 255 is always transparent in the output TGA, but the underlying texels' colors are kept unless the texture is flagged as transparent.
- -decal
- Do not use. Creates VMTs using DecalModulate shader and $alphatest parameter.
- As this is not faithful to how GoldSrc decals work,
WadMaker should be used to convert the decals instead (if necessary, using an image editor to pad all edges to the next power of two), and the VMTs created manually as LightmappedGeneric with $translucent 1, $decal 1, and $decalscale 1.
- -vmtparam <parameter> <value>
- Add the described material parameter to the VMTs of all converted textures.
- To add multiple parameters, use multiple -vmtparam arguments.
- Despite what the readme says, this has nothing to do with
VTEX.
Readme
Help from xwad run without any parameters (some information is inaccurate and/or misleading):
[-AutoDir]
Automatically detects -basedir and -wadfile or -bmpfile based
on the last parameter (it must be a WAD file or a BMP file.
[-decal]
Creates VMTs for decals and creates VMTs for model decals.
[-onlytex <tex name>]
[-shader <shader name>]
Specify the shader to use in the VMT file (default
is LightmappedGeneric.
[-vtex]
If -vtex is specified, then it calls vtex on each newly-created
.TGA file.
[-vmtparam <ParamName> <ParamValue>]
if -vtex was specified, passes the parameters to that process.
Used to add parameters to the generated .vmt file
-BaseDir <basedir>
-game <basedir>
Specifies where the root mod directory is.
-WadFile <wildcard>
-wadfile will make (power-of-2) TGAs, VTFs, and VMTs for each
texture in the WAD. It will also place them under a directory
with the name of the WAD. In addition, it will create
.resizeinfo files in the materials directory if it has to
resize the texture. Then Hammer's File->WAD To Material
command will use them to rescale texture coordinates.
-bmpfile <wildcard>
-bmpfile acts like -WadFile but for BMP files, and it'll place
them in the root materials directory.
-sprfile <wildcard>
Acts like -bmpfile, but ports a sprite.
-Transparent (BMP files only)
If this is set, then it will treat palette index 255 as a
transparent pixel.
-SubDir <subdirectory>
-SubDir tells it what directory under materials to place the
final art. If using a WAD file, then it will automatically
use the WAD filename if no -SubDir is specified.
-Quiet
Don't print out anything or wait for a keypress on exit.
ex: xwad.exe -vtex -BaseDir c:\hl2\dod -WadFile c:\hl1\dod\*.wad
ex: xwad.exe -vtex -BaseDir c:\hl2\dod -bmpfile test.bmp -SubDir models\props
ex: xwad.exe -vtex -vmtparam $ignorez 1 -BaseDir c:\hl2\dod -sprfile test.spr -SubDir sprites\props