VTEX (Valve Texture Tool): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (add {{vtex}}; also, vtex supports pfm)
Line 14: Line 14:
=== The Drag-and-Drop Method ===
=== The Drag-and-Drop Method ===
The drag-and-drop method is the easy way to use Vtex. Just drag the icon of either the targa image to be converted, or its list of compile parameters (from its <code>materialsrc/</code> folder) on top of the icon of the Vtex executable (''Vtex.exe'') and let go, and Vtex will compile the texture file automatically.
The drag-and-drop method is the easy way to use Vtex. Just drag the icon of either the targa image to be converted, or its list of compile parameters (from its <code>materialsrc/</code> folder) on top of the icon of the Vtex executable (''Vtex.exe'') and let go, and Vtex will compile the texture file automatically.
== Troubleshooting ==
=== Local Steam Service is not running ===
Vtex will give the following error:
SteamStartup() failed: SteamStartup(0xf,0x0012F0E4) failed with error 108: The local Steam Service is not running
Steam must run while Vtex is run. Start Steam to fix this.
=== Problem figuring out outputdir ===
Vtex will give the following error:
Problem figuring out outputdir for <path>
As a first step, check that the texture to convert is really in the <code>\sourcesdk_content\gamedir\materialsrc</code> folder, where ''gamedir'' is the game folder (<code>cstrike</code>/<code>dod</code>/<code>hl2</code>/<code>hl2mp</code>).
If the texture is in the correct folder, the error might instead be caused by a complication with the environment variables. Primarily, this should be able to be eliminated by using [[VConfig]] and ensuring the selected mod has been run at least once. However, there are cases where this doesn't solve the problem.
One solution is to remove the instance of the VProject Environment variable. In Windows XP this can be accomplished by the following:
#Right-click on ''My computer'' and click on ''Properties''.
#Select the ''Advanced'' tab.
#Click on ''Environment Variables'' near the bottom of the window.
#In the ''System variables'' section scroll down and highlight the line ''VProject''.
#Click the ''Delete'' button.
#Click ''OK'' twice to exit.
However, this solution will create the ''Unable to find gameinfo.txt'' error instead. {{TODO|Delete this non-functioning solution alternative?}}
==== Alternative solution ====
vtex.exe cannot understand spaces in the input file. One solution is to create a folder directly on the C:/ drive with the same name as the original one the vtex shortcut was pointing at. For example, create C:/tf instead of C:\Program Files\Steam\steamapps\<account_name>\team fortress 2\tf. Update the vtex.exe shortcut to point to this new folder. In this folder, put the gameinfo.txt from the original folder, as well as an empty materialsrc and materials folder. Place your file to be converted in the new materialsrc folder. Now drag-and-drop the file onto the vtex shortcut, and the output will be in the new materials folder.
=== "Unable to find gameinfo.txt" ===
Vtex will give the following error and instructions:
Unable to find gameinfo.txt. Solutions:
1. Read http://www.valve-erc.com/srcsdk/faq.html#NoGameDir
2. Run vconfig to specify which game you're working on.
3. Add -game <path> on the command line where <path> is the directory that <code>gameinfo.txt</code> is in.
This error will occur after ''VProject'' has been removed using the steps above.
Open Source SDK and change the ''Current Game''.
{{note|The link at step 1 won't provide a solution. (The page is really old.)}}
=== Setup file gameinfo.txt doesn't exist ===
The Nov 7th, 2007 SDK release includes Orange Box with TF2 and trying to use vtex in this new SDK update to create a vtf file for Team Fortress 2 results in the following error message:
"Setup file 'gameinfo.txt' doesn't exist in subdirectory 'C:\Program Files\Steam\steamapps\player name\sourcesdk\bin\orangebox\bin\vconfig'. check your -game parameter or VCONFIG setting.".
Assuming that this is the same error as "Unable to find gameinfo.txt" above, then trying to run <code>vconfig.exe</code> results in this error:
"This application has failed to start because Steam.dll was not found. Re-installing the application may fix this problem."
Solution:
#Create a shortcut to vtex.exe which is located in "C:\Program Files\Steam\steamapps\player_name\sourcesdk\bin\orangebox\bin\vtex.exe" and select Properties.
#At the end of the Target text add -game "C:\Program Files\Steam\steamapps\player_name\team fortress 2\tf" -nop4
Valve intends to fix the problem with requirement of a <code>-nop4</code> argument to be added to the target.
=== TGA is bogus ===
Vtex will give the following error:
TGA <path> is bogus!
The texture image you are trying to convert is not recognized as a valid targa (.tga) file. Make sure that it is, and that it is either 24 bit/pixel or 32 bit/pixel. (16 bit/pixel is not recognized.)
=== "Warning: falling back to auto detection of vconfig" (Windows Vista) ===
Vtex will give the following error:
{{TODO|Please provide an exact quote of the error.}}
Make a shortcut for vtex.exe and add ''-game [path to game directory]''
:'''Example:''' -game c:/steam/steamapps/sourcemods/Awakening
If there are spaces in any of the folders in your path use "
:'''Example:''' ''-game "c:/program files/steam/steamapps/sourcemods/insurgency"''
=== Error loading texture texturename.pfm ===
The byteorder ( endian ) of your .pfm is probably not the correct one.<br>
If you exported your texture from photoshop, this might happen depending on the specific photoshop version you are using.<br>
A workaround for this issue is by converting to .pfm using [https://imagemagick.org/ Imagemagick] ( Make sure to download the version specific to your OS that has HDR imaging enabled! )<br>
Run your texture ( .tif, .hdr, .exr ... ) through the tool with <code>-endian LSB</code> and the resulting .pfm should no longer make vtex complain!


== See Also ==
== See Also ==

Revision as of 21:31, 13 April 2023

English (en)Translate (Translate)
Not to be confused with VTEX (Source 2).

VTEX VTEX, or Valve Texture Tool, is the command-line tool used to convert targa (.tga), portable floatmap (.pfm), or Photoshop (.psd) (Orange box SDK) image files into Valve Texture Files (.vtf) for use in the Source engine. It takes a targa (.tga) image and an optional list of compile parameters, and creates a Valve Texture File (.vtf) from them.

Note.pngNote:It is recommended that you use the third-party tool VTFEdit instead. VTFEdit boasts a user-friendly interface, a wider array of accepted formats, the ability to change most VTF's properties without recompiling, a standalone viewer, and direct GCF access.

Basic Usage

  1. Make sure that Steam is running.
  2. Place the targa image to be converted inside the SteamApps/common/gamefolder/materialsrc/ folder, where gamefolder is the game folder of the current game (cstrike/dod/hl2/hl2mp/tf). You can also place the image within a subfolder of this folder, to make Vtex compile the texture to the corresponding materials/ subfolder. (For instance, placing the image in a materialsrc/metal/ subfolder, will make Vtex compile the texture to the materials/metal/ subfolder.)
  3. If necessary, write a text (.txt) file containing a set of Vtex compile parameters. Give it the same name as the targa image (with the exception of the .txt extension) and put it in the same folder. If you choose to omit this list, Vtex will create an empty one for you during compilation.
  4. The Vtex executable (Vtex.exe) is located in the /Steam/SteamApps/common/gamefolder/bin/ folder, again where gamefolder is the folder that corresponds with the target game. It can be executed in one of two ways: Through the easy "drag-and-drop" method (described below), or the more advanced command prompt method, described here. Steam must run while it is executed.
  5. The resulting Valve Texture File (VTF) will be compiled to the materials/ folder of the current game by default. For instance, if the current game would be Half-Life 2, the texture file would be compiled to the SteamApps/common/Half-Life 2/hl2/materials/ folder. If the targa image resided within a subfolder, Vtex will compile the texture file to the corresponding materials/ subfolder. If that subfolder doesn't exist, Vtex will create it automatically.

The Drag-and-Drop Method

The drag-and-drop method is the easy way to use Vtex. Just drag the icon of either the targa image to be converted, or its list of compile parameters (from its materialsrc/ folder) on top of the icon of the Vtex executable (Vtex.exe) and let go, and Vtex will compile the texture file automatically.

Troubleshooting

Local Steam Service is not running

Vtex will give the following error:

SteamStartup() failed: SteamStartup(0xf,0x0012F0E4) failed with error 108: The local Steam Service is not running

Steam must run while Vtex is run. Start Steam to fix this.

Problem figuring out outputdir

Vtex will give the following error:

Problem figuring out outputdir for <path>

As a first step, check that the texture to convert is really in the \sourcesdk_content\gamedir\materialsrc folder, where gamedir is the game folder (cstrike/dod/hl2/hl2mp).

If the texture is in the correct folder, the error might instead be caused by a complication with the environment variables. Primarily, this should be able to be eliminated by using VConfig and ensuring the selected mod has been run at least once. However, there are cases where this doesn't solve the problem.

One solution is to remove the instance of the VProject Environment variable. In Windows XP this can be accomplished by the following:

  1. Right-click on My computer and click on Properties.
  2. Select the Advanced tab.
  3. Click on Environment Variables near the bottom of the window.
  4. In the System variables section scroll down and highlight the line VProject.
  5. Click the Delete button.
  6. Click OK twice to exit.

However, this solution will create the Unable to find gameinfo.txt error instead.

Todo: Delete this non-functioning solution alternative?

Alternative solution

vtex.exe cannot understand spaces in the input file. One solution is to create a folder directly on the C:/ drive with the same name as the original one the vtex shortcut was pointing at. For example, create C:/tf instead of C:\Program Files\Steam\steamapps\<account_name>\team fortress 2\tf. Update the vtex.exe shortcut to point to this new folder. In this folder, put the gameinfo.txt from the original folder, as well as an empty materialsrc and materials folder. Place your file to be converted in the new materialsrc folder. Now drag-and-drop the file onto the vtex shortcut, and the output will be in the new materials folder.

"Unable to find gameinfo.txt"

Vtex will give the following error and instructions:

Unable to find gameinfo.txt. Solutions:

1. Read http://www.valve-erc.com/srcsdk/faq.html#NoGameDir
2. Run vconfig to specify which game you're working on.
3. Add -game <path> on the command line where <path> is the directory that gameinfo.txt is in.

This error will occur after VProject has been removed using the steps above.

Open Source SDK and change the Current Game.

Note.pngNote:The link at step 1 won't provide a solution. (The page is really old.)

Setup file gameinfo.txt doesn't exist

The Nov 7th, 2007 SDK release includes Orange Box with TF2 and trying to use vtex in this new SDK update to create a vtf file for Team Fortress 2 results in the following error message:

"Setup file 'gameinfo.txt' doesn't exist in subdirectory 'C:\Program Files\Steam\steamapps\player name\sourcesdk\bin\orangebox\bin\vconfig'. check your -game parameter or VCONFIG setting.".

Assuming that this is the same error as "Unable to find gameinfo.txt" above, then trying to run vconfig.exe results in this error:

"This application has failed to start because Steam.dll was not found. Re-installing the application may fix this problem."

Solution:

  1. Create a shortcut to vtex.exe which is located in "C:\Program Files\Steam\steamapps\player_name\sourcesdk\bin\orangebox\bin\vtex.exe" and select Properties.
  2. At the end of the Target text add -game "C:\Program Files\Steam\steamapps\player_name\team fortress 2\tf" -nop4

Valve intends to fix the problem with requirement of a -nop4 argument to be added to the target.

TGA is bogus

Vtex will give the following error:

TGA <path> is bogus!

The texture image you are trying to convert is not recognized as a valid targa (.tga) file. Make sure that it is, and that it is either 24 bit/pixel or 32 bit/pixel. (16 bit/pixel is not recognized.)

"Warning: falling back to auto detection of vconfig" (Windows Vista)

Vtex will give the following error:

Todo: Please provide an exact quote of the error.

Make a shortcut for vtex.exe and add -game [path to game directory]

Example: -game c:/steam/steamapps/sourcemods/Awakening

If there are spaces in any of the folders in your path use "

Example: -game "c:/program files/steam/steamapps/sourcemods/insurgency"

Error loading texture texturename.pfm

The byteorder ( endian ) of your .pfm is probably not the correct one.
If you exported your texture from photoshop, this might happen depending on the specific photoshop version you are using.
A workaround for this issue is by converting to .pfm using Imagemagick ( Make sure to download the version specific to your OS that has HDR imaging enabled! )
Run your texture ( .tif, .hdr, .exr ... ) through the tool with -endian LSB and the resulting .pfm should no longer make vtex complain!


See Also