Texture Modification

From P2SR Wiki

Texture Modification

Couldn't parse video from https://youtu.be/qiMP7rWOXWM

Video tutorial by Jaio

You're able to change textures in Portal 2 by extracting texture files from a packed .vpk file, converting the textures from .vtf to a more easily editable file format, like .jpg or .png, then editing your texture as you wish and reversing the file conversion process. Follow either the video guide or this text guide to change textures.

Required Programs

Three programs are required for editing textures. Here are their download links, and their purposes.

  • VPKEdit - A tool for opening and extracting files from .vpk files. Download here.
  • VTFEdit Reloaded - A tool for creating .vtf and .vmt files. Download here.
  • vpk-compress - A small program for packing a folder into a .vpk file. Download here.

Ensure all three of these tools are downloaded and installed (vpk-compress only needs download) before continuing.

Extracting and Editing Textures

Open VPKEdit and head to File -> Open, and open the file Portal 2/portal2/pak01_dir.vpk. Find the textures you wish to change (ending in .vtf), and drag them to your desktop.

Texture paths for commonly changed textures can be found at this document.

Open the .vtf file you extracted using VTFEdit 2.0, and select File -> Export. Change the file type to .jpg, as a .png can cause transparency issues. From there you can open your newly extracted file with your personal favorite image editor, and change it to your liking.

If you wish for the texture to be animated, check out this guide.

Re-Packing Textures

Open VTFEdit, head to File -> Import, and select your file. An Options box will appear, do not change any of the settings, simply hit "OK". Once the file loads, go to File -> Save As..., and rename the newly saved .vtf file the same as your original extracted one.

Place the new .vtf file into a set of folders mimicking the file path from the original pak01_dir.vpk file. You can use the above paths document as reference for this. For reference, a portal gun texture will be placed in pak01_dir/materials/models/weapons/v_models/v_portalgun/v_portalgun.vpk.

When you have all of your texture changes placed into the set of folders, drag the pak01_dir folder into the vpk.exe application. A new pak01_dir.vpk file should appear.

  • As a note, ensure all of the components of vpk.exe must be in the same place, that meaning: vstdlib.dll, filesystem_stdio.dll, tier0.dll, and Newtonsoft.json.dll.

Create a new folder in your Portal 2 directory called portal2_dlc3 (if you already have a dlc3, call this new folder dlc4, and so on...). Place the new pak01_dir.vpk into this folder. From there, open the game and enjoy your new textures!

Re-Texturing for Mods

See this document on how to change textures for mods like Portal Stories: Mel.