Xwad: Difference between revisions
Jump to navigation
Jump to search
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).
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 ?]
Important:Valve's Xwad does not support textures with more than 262144 pixels (ex: 512x512 resolution).
This is increased to 8192x8192 in
's Xwad.
SirYodaJedi (talk | contribs) mNo edit summary |
SirYodaJedi (talk | contribs) (→Optional: -decal is not implied for IndexAlpha. -palette is relative to -basedir, not current directory) |
||
Line 59: | Line 59: | ||
:* {{jbep3}} Treats the input texture as an IndexAlpha texture, with the palette index being used for full 8-bit translucency, and the last index being used to determine color. Creates VMTs using {{ent|$translucent|1}}, {{ent|$decal|1}}, and {{ent|$decalscale|1}}. | :* {{jbep3}} Treats the input texture as an IndexAlpha texture, with the palette index being used for full 8-bit translucency, and the last index being used to determine color. Creates VMTs using {{ent|$translucent|1}}, {{ent|$decal|1}}, and {{ent|$decalscale|1}}. | ||
:: Implied when converting {{code|{}} textures if the input WAD is named decals.wad. | :: Implied when converting {{code|{}} textures if the input WAD is named decals.wad. | ||
::{{warning|Due to how Xwad's Po2 resizing method works, non-power-of-two decals will be slightly larger when using [[infodecal]] in Source vs how it appeared in GoldSrc. If this is a noticeable issue, use {{wadmaker|2}} to convert the decals from their original format, then use an [[image editor]] to pad all edges to the next power of two.}} | ::{{warning|Due to how Xwad's Po2 resizing method works, non-power-of-two decals will be slightly larger when using [[infodecal]] in Source vs how it appeared in GoldSrc. If this is a noticeable issue, use {{wadmaker|2}} to convert the decals from their original format, then use an [[image editor]] to pad all edges to the next power of two.}} | ||
: {{tip|For decals and IndexAlpha sprites, consider using A8 texture format and defining color in the VMT using {{ent|$color}}, as this retains the full original quality while being the same size as a DXT5 texture of the same resolution.}} | : {{tip|For decals and IndexAlpha sprites, consider using A8 texture format and defining color in the VMT using {{ent|$color}}, as this retains the full original quality while being the same size as a DXT5 texture of the same resolution.}} | ||
Line 71: | Line 70: | ||
: Only export the specified texture name. | : Only export the specified texture name. | ||
; {{code|-palfile <file>.lmp}} {{jbep3|only}} | ; {{code|-palfile <path>\<file>.lmp}} {{jbep3|only}} | ||
: What [[palette]] to use for WAD2 files (uses the vanilla {{quake|2}} palette by default). | : What [[palette]] to use for WAD2 files (uses the vanilla {{quake|2}} palette by default). Relative to {{mono|-basedir}}. | ||
: Expects a 768-byte array of 24-bit RGB values ("pallete.lmp"); can be extracted from several formats using {{quakewiki|Fimg}}. Can also be taken from a 8-bit paletted [[PCX]] file by deleting all but the last 768 bytes in a hex editor. | : Expects a 768-byte array of 24-bit RGB values ("pallete.lmp"); can be extracted from several formats using {{quakewiki|Fimg}}. Can also be taken from a 8-bit paletted [[PCX]] file by deleting all but the last 768 bytes in a hex editor. | ||
: {{tip|For {{Quake|2|nt=0}} textures, it is possible to generate accurate [[$selfillummask]] textures based upon fullbrights by using palette with the last 32 indices set as white, and the rest of the indices set as black. A preconfigured palette for this purpose can be found [https://files.gamebanana.com/bitpit/q1_selfillum_palette.lmp here (direct download)].<br>This should ''not'' be done for {{hexen2|2}} textures, as Hexen II does not use fullbrights.}} | : {{tip|For {{Quake|2|nt=0}} textures, it is possible to generate accurate [[$selfillummask]] textures based upon fullbrights by using palette with the last 32 indices set as white, and the rest of the indices set as black. A preconfigured palette for this purpose can be found [https://files.gamebanana.com/bitpit/q1_selfillum_palette.lmp here (direct download)].<br>This should ''not'' be done for {{hexen2|2}} textures, as Hexen II does not use fullbrights.}} |
Revision as of 10:36, 29 July 2024

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.
Todo: The 28 June 2024 update to
Jabroni Brawl: Episode 3 includes a build of xwad with several bugfixes and extra features; document these properly. They include:

- Increases max resolution cap to allow textures up to 8192x8192.
- Add support for WAD2 format (using -palfile param to provide palette, defaulting to Quake 1 palette).
- Fix processing of decals
- Extract sprite groups from SPR files
- Add %CompileWater to VMTs generated for ! textures
- Include approximate values for water fog in generated VMTs
The closed beta build adds even more:
- Remove resolution cap altogether
- Quake SPR support
- Respect -transparent for SPR files
- Automatically add ConveyorScroll material proxy to WAD textures prefixed with scroll
- Automatically add $nocull, %CompileBlockLOS, and commented-out %CompileNonSolid to WAD textures prefixed with @.
- Treat * textures as liquids in addition to ! (for Quake)
- WAD2 liquids do not have fog values generated for them, as Q1 does not use HL1's fog system.
- Put %CompileSlime instead of %CompileWater if a filename starts with !slime or *slime
- Rename illegal characters (like *) in output filenames
- QPIC and Font support
- Special handling of Q1's scrolling skies (via material proxies)
- Extract palette lump from WAD2, if present
Caveats





This is increased to 8192x8192 in

Syntax
Options
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 and $alphatestreference 0.5 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
- Works differently in Valve's Xwad vs Jabroni Brawl's:
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 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.
Treats the input texture as an IndexAlpha texture, with the palette index being used for full 8-bit translucency, and the last index being used to determine color. Creates VMTs using $translucent 1, $decal 1, and $decalscale 1.
- Implied when converting { textures if the input WAD is named decals.wad.
Warning:Due to how Xwad's Po2 resizing method works, non-power-of-two decals will be slightly larger when using infodecal in Source vs how it appeared in GoldSrc. If this is a noticeable issue, use
WadMaker to convert the decals from their original format, then use an image editor to pad all edges to the next power of two.
Tip:For decals and IndexAlpha sprites, consider using A8 texture format and defining color in the VMT using $color, as this retains the full original quality while being the same size as a DXT5 texture of the same resolution.
- -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.
- -onlytex <texture>
- Only export the specified texture name.
- -palfile <path>\<file>.lmp (only in
)
- What palette to use for WAD2 files (uses the vanilla
Quake palette by default). Relative to -basedir.
- Expects a 768-byte array of 24-bit RGB values ("pallete.lmp"); can be extracted from several formats using
Fimg. Can also be taken from a 8-bit paletted PCX file by deleting all but the last 768 bytes in a hex editor.
Tip:For
Quake I textures, it is possible to generate accurate $selfillummask textures based upon fullbrights by using palette with the last 32 indices set as white, and the rest of the indices set as black. A preconfigured palette for this purpose can be found here (direct download).
This should not be done forHexen II textures, as Hexen II does not use fullbrights.
Readme
Help from xwad run without any parameters (some information is inaccurate and/or misleading):
|