A friend was having problems figuring out how to hex so I decided to make a tutorial (a better one) on how to do it ^^ (Also i’ve been saying I would for ages :P)
Model used in tutorial: Poster Model
Welcome to my Hexing tutorial, I have attempted to make it as simple and easy to follow as I can but it’s possible I might use terms unknown to you, if so please let me know so I can remedy any issues that arise
First of all when you start out, you must make sure you have the following programs: A Hex Editor (I use XVI32), VTFedit (You could also use Photoshop plugins) and a Source Game (Such as HL2, CS:S or Garry’s Mod). You may also need GCFscape to aquire some models or materials, but not for this tutorial. Links to all these programs can also be found in my Deviant Art Journal.
OK, now to start ^^
Make sure you have both a materials and models folder for your model and that all the files you will need (MDL, VTX, PHY, SW, VTF and VMT) are contained within them (see later).
It is advised that you keep at least one backup of all files you intend to make hexed versions of incase a mistake it made and you need to backtrack (also so you still have the original).
Now lets see what all these are for:
MDL files are the file format that includes the data for the model itself (what we will be concentrating on).
SW files are the texture positional data such as UV coordinates for the model (don’t worry if you don’t know what this means).
VTX files are the directX render settings for the model (or this).
PHY files contain the collision data for how the model interacts with the game world (the actual size and shape of the model as it interacts. V_models and effects do not have PHY files).
VTF files are the textures for the model (the coloured bits).
VMT files are the code that is used to tell the game how to render the textures and is what the models link to in the MDL files (will be important later).
Now onto the actual hexing =P
Now you must open your hex editor as demonstrated (or open the MDL file from the hex editor if you don’t have it defaulted ).
This is what we will use to actually alter the code within the model (MDL) file, which is what hexing actually is.
This is what the XVI32 Hex editor looks like, yours may look different if your using a different program, but the right hand text should be the same (as it’s the bit we are interested in).
The only parts we are interested in for this tutorial is the first two lines, starting at “posters” (see image) and the last 2 lines (see part 6).
ok, now that we know what we need to do, we will make the first change. Alter the first letter of “posters” to “m”, so it will now say “mosters” (see image), this has altered the file path the “mosters” instead of “posters”. Now do the same with the next “poster” so it says “moster”. Do not alter anything else yet. You have now made it so the model is called “moster” in a folder called “mosters” but will not be complete until a few steps.
Now go to the bottom and where it says “poster” and “posters” do the same as to the ones at the top so it will now say “moster” and “mosters” (see image). This will have altered the path the model is looking for the material file (in the “mosters” folder) and it is looking in there for a material (VMT) file called “moster”.
Now that you have changed the paths used in the MDL file you must mirror these changes in the actual files. First change the name of the MDL file from “poster” to “moster” to mirror the second change made (in part 5).
Next you must do the same with all the other files, making sure to retain the endings of the VTX files (of dx80, dx90, sw and xbox if you have one).
Also you must rename the folder all the files are in to “mosters” to mirror the first change in part 5 (as circled in the image).
(You do not always have to change all the parts shown in this tutorial, but i’ve done so to show which parts in the MDL file can be altered to allow you to rename file or folders how you wish).
Now we move onto the textue files in the materials folder as shown in the image. This model only has one texture, others may have more, but each will have a VMT file per texture referred to in the MDL file (there may however be more VTF files, but that is for more advanced textures).
Open your VMT file with either VTFedit if you have it (shown in the image) or any text editor such as notepad.
Now the only part of the VMT file we are interested in for this tutorial is the “$basetexture” line as this determines what the path to the texture (VTF) used on the model will be.
Alter the path as we did in the MDL file, as shown in the image.
Now rename both the VMT, VTF and the folder they are in so they are the same as we defined in the MDL file (as shown in the image).
All the files and folders should now be correctly named in line with how you redefined the paths in the MDL file when you hexed it.
The hexing is now complete and the model should work perfectly without replacing the original version.
The final thing you can do is ensure that you have renamed everything correctly and that everything is looking in the correct place for the files needed.
I tend to do this using Crafty, a useful model viewing program with a console, shown in the image (Link to the download can be found in my DA Journal).
(Custom textures unfortunately will not load in Crafty correctly, i’m not entirely sure why, but you are still able to check the paths, so I don’t mind).
(All identifiable information has been removed from the images).
Other model viewers like HLMV could be used to check the model works, or just by loading it in a game.
This concludes my tutorial, I hope you have been able to successfully hex a model
If you have any Source, Garry’s Mod or Modelling related problems, I will be happy to try and help where I can, my contact details can be found here.