How to Hex Tutorial

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 :slight_smile:

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 :slight_smile: ).

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 :smiley:

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.

Does the same principle work for ragdolls?

Yeah. you can do that with ragdolls too. Although some ragdolls have more than one material. So renaming the folder in which the materials are contained are best. Don’t rename all the materials.

Hexing can be applied to any kind of model that has a MDL file you can open.

Made some minor edits to the OP to include some things I forgot (PHY files description) and some other minor things.

I was gonna hex some TF2 models but I can’t find the .mdl files for them. I got the skins, but not the models so where can I find those?

Use GCFscape to open the team fortress 2 content.gcf and look in the tf/models folder. Also using Ctrl+f allows you to search all the files by name, which can be useful when looking for a particular model (or part of a model).

Hope that helps ^^

Silver, you don’t need .xbox files at all. They just take up space.

That you don’t, and personally I just delete them, but I said what they were incase people case across them :slight_smile:

hey SS can you hex the park our hunter please

If you have the model follow the tutorial and you’ll be able to do it ^^ (I don’t have the model so I can’t, also i’m working on other stuff).

i tried but when i want take the ragdoll going out of memory


As so many people have been asking about hexing and i’ve been repeatedly linking to it ¬.¬

tried, when i load it up to gmod, its an error. help?

Did you make sure to change the name on the spawnlist to the new model’s name? (as you don’t usually get error models when hexing). If you did you will need to put a picture of the first few lines and the lest few lines of the MDL file and the folders the model and materials are in so we can see if there are any discrepancies.

Also make sure you altered the paths in the VMTs to use the new textures (though this isn’t likely the error, but its always worth checking).

Hopefully this will stem the flow of little kids coming in going “plz helap how 2 hex???”

ill upload a pic of what ive done so far. since ive altered the main names in the hex editor, i altered the lower ones too, its a ragdoll. It has many VTF’s. Anyways, as you said i changed the VMT’s and tried. posting pics.

humm… your hexing looks ok, upload it somewhere (all the stuff) and i’ll take a look at it for you.

Edit: You do just have it in the models folder right? Not models/milver_sonic.

when i installed them in gmod yes they were in models. But now i have em on my desktop. And sure ill upload em. Well, ill try.


ok uploaded fully with spawn list and models/materials etc. Link:

EDIT: link to the new silver skin:

THANKS now i can hex skins for my friends :smiley:

Wow that site is aweful for hiding its download link/waiting time and all that irritation.

Anyway, it appears you’ve altered something you shouldn’t as its giving exception access violations in crafty, which is what you get generally when something has been renamed to something longer than the original (overwriting bytes to do with something else), so I will need a link to the original model aswell so I can go through and compare to find the problem.