//--------Intro
I get asked how to do this about once a week at least but generally can't be assed explaining things properly, so here we go; a full on guide.
Let's split it into sections. I will personally slay anyone who skips Part 1. Try me.
1- Preparing folders.
2- Getting the original texture
3- Patching the original texture
4- Drawing your own stuff on top
5- Packing it all up.
6- Donesies.
//--------Part 1: Preparing folders
In previous games, you could just dump extracted loose files into whatever folder and the game would read it. Now it's not so.
I'm assuming you've installed steam to
*c:\program files\steam*
If you've installed to
c:\program files (x86)\steam
or
**c:\program files\valve\steam **
(or wherever else) use that instead. Chances are if you're on 64bit windows, it's the (x86) folder.
Let's begin:
Open up your
c:\program files\steam\steamapps\common\portal 2** folder and create a new folder called "portal2_dlc3**" (without the quotes). So:
*c:\program files\steam\steamapps\common\portal 2\portal2_dlc3*
then pak01_dir
then materials
then models
then weapons
then v_models
then v_portalgun
It'll look like this, and is clearly designed to mess with dyslexics.
C:\Program Files\Steam\steamapps\common\portal 2\portal2_dlc3\pak01_dir\materials\models\weapons\v_models
[Did you know? You can push ALT+D and paste these folders into your explorer window. Cool huh?]
//--------Part 2: Extracting the original texture.
Tools:
-- GCFScape:
-- http://nemesis.thewavelength.net/index.php?p=26
(If it doesn't run install the f**king runtimes like the forum post suggests....)
Fire up GCFScape, and open this file:
C:\Program Files\Steam\steamapps\common\portal 2\portal2\pak01_dir.vpk
Inside, follow the folder structure we created earlier:
/models/materials/weapons/v_models/v_portalgun/v_portalgun.vtf
and drag it out into the last folder you created earlier, you should now have:
C:\Program Files\Steam\steamapps\common\portal 2**...
...\portal2_dlc3\pak01_dir\materials\models\weapons\v_models\v_portalgun.vtf**
Make a copy, call it v_portalgun_original.vtf or something.
Seriously, you'll thank me.
Close GCFScape.
//--------Part 3: Patching the file:
Tools:
-- Patcher thingie:
-- http://sicklebrick.com/hotlinks/vtf_patcher.rar
Now, there are a few programs available to edit the texture, but they generally use the same copy of "VMTLib" - the code that does the actual conversion. Since Portal 2 is much newer than these, they will throw a version error saying the file is too new. If we manually change the version number however, everything will be fine.
Download the stuff in that .rar file and extract it somewhere or other.
Make sure nothing has your texture open (i.e. You've not tired to skip a few steps and open it) and drag your v_portalgun.vtf file onto patcher.bat
If you see "1+0" records out, then it worked.
If you see "0+1" records out, then something went wrong.
But assuming you didn't skip this bit, you'll realise I included a patched copy of v_portalgun in the .rar anyway.
So uhh, use that.
//--------Part 4: Editing the texture, finally...
Tools:
--VTFEdit
--http://nemesis.thewavelength.net/index.php?c=178
OR
--VTF Plug-In for Photoshop
--http://nemesis.thewavelength.net/index.php?c=154
You can use either of these tools. VTFEdit is probably more noobie friendly and supports animations, while the photoshop plugin is awesome if you're used to photoshop. (Works in photoshop 6+)
//----VTFEdit Way:
Open your patched v_portalgun.vtf with VTFEdit
Go file->export and save your file, for example "bubble.jpg"
.JPEG should be fine here.
Note:
If saving as a .BMP (bitmap) photoshop can't read the file, open it in MSPaint and re-save.
If saving as a .PNG you may encounter an alpha bug even with "Mask" setting.
If saving as a .TGA (targa) then obviously you'll need something other than mspaint.
Draw all over your file... Draw something fancy. Have fun, but just don't change the width\height\etc
Then back in VTFEdit, go file->import , select your "bubble.jpg" again.
You'll get a settings popup - the default values should be fine in this case.
Hit OK.
(Normal Format: DXT5 , Alpha Format: DXT5, Texture Type: Animated Texture, Generate Mipmaps: Yes, Mipmap Filter: Box, Sharpen Filter: None, Resize : Yes, Resize Method: NPO2, Resize Filter: Triangle, Sharpen Filter: None, Clamp: Yes, Max Width: 4096, Max Height: 4096, and Generate Normal Map: No. incase you messed 'em up)
Now hit save, and save over your v_portalgun.vtf file again.
//----Photoshop Plugin way.
Drag file in.
Edit.
Save.
(remember to hit Ctrl+Shift+E to flatten layers first)
//--------Part 5: Creating a .pak file.
Tools:
--Portal 2 Authoring Tools Beta
--(Beta or higher) Install via steam.
Right, we're almost done here, just gotta get portal to read the file. You psyched? I'm psyched. I'm needlessy wasting your reading time right now, huh? Let's go.
You should now have:
C:\Program Files\Steam\steamapps\common\portal 2**...
...portal2_dlc3\pak01_dir\materials\models\weapons\v_models\v_portalgun.vtf**
Go back a few folders so you're in:
*C:\Program Files\Steam\steamapps\common\portal 2\portal2_dlc3*
In a separate window, open this folder:
*C:\Program Files\Steam\steamapps\common\portal 2\bin*
Scroll down 'till you find "VPK.exe". If you don't have it, remember to install Authoring Tools Beta from your steam tools menu. (Alternatively you can use the vpk.exe from Left4Dead or Alien Swarm - they're compatible)
Drag your "pak01_dir" folder onto "vpk.exe" in the other window.
It'll take a second and create a file for you : "pak01_dir.vpk"
You should now have a folder:
*C:\Program Files\Steam\steamapps\common\portal 2\portal2_dlc3*
which contains:
pak01_dir.vpk and a folder called pak01_dir
(For future purposes, you can deag a shortcut to VPK.exe into your dlc3 folder, then drag your pak01_dir folder onto the shortcut, so you don't need to open more folders)
//--------Part6: Run the game.
Wow right? Fiddle with it till you get it right.
//--------Alternative/Advanced Methods
//----Patching the .vtf
Hex the 8th byte from 0x05 to 0x03.
//----Avoid creating a .VPK
This is the method I used at first before realising it's pretty impossible to keep track of.
The .VPK format stores the first kilobyte or so of data for each file in the actual index...
Now as we know, .VTF files are read from the .VMTs ...which are only a couple of hundred bytes tops.
Thus, the bulk of the .VMT files are stored entirely in the pak01_dir.vpk file itsself.
Find the entry for v_portalgun.VMT by doing a string search of byte for byte search:
VertexLitGeneric..{..$baseTexture "models\weapons\v_models\v_portalgun/v_portalgun"....$bumpmap "models\weapons\v_models\v_portalgun\v_portalgun_normal"..
And just change the $basetexture to point at like v_portalBUN or something.
Rename your v_portalgun.VTF to vportalBUN.VTF and put it in a folder like
...common\portal 2\portal2\materials\models\weapons\v_models\v_portalgun\vportalBUN.VTF
I'm lazy and this is generally the method I'd use, but once you've gone through the full tutorial once and you're familliar with it it's generally much faster just to use that method.
For example, by using a shortcut or .BAT file you can update it all with a click or two, with no need to back up the index all the time and you can switch out as many folders as you like with much bigger contents.
//--------Troubleshooting:
-Restart the game between attempts
-Be a doll and write back if I missed something
-You should not have a \portal 2\portal2\portal3_dlc3\ folder portal2_dlc3 should be in the same folder as dlc_2,etc
-This doesn't change the view of the gun you get looking at yourself in a portal. Do that yourself.
-This doesn't work for multiplayer (either for yourself or others).
-Portal will create a bunch of extra folders and stuff when it runs.
Still struggling?
Here's my entire DLC3 folder with trademark shitty pink gun:
http://sicklebrick.com/hotlinks/portal2_dlc3.rar
Enjoy,
Sickle.
Edit:
Changed post title to be easier to google, since I'm still having to look this up about once a week :\



