How to Hex Edit Models
OK let me begin with a disclaimer: I am at best a rank Journeyman with this hex stuff… I’m not a Master; for that I defer to Surdin, who taught me virtually everything I know about hex (but not everything he knows). Second Disclaimer: While anyone who is motivated can certainly learn this, my guide is not intended for the beginning modder. If there is anything here you don’t understand you are probably not ready. I have only small patience for "mod beggars", but lots of good threads/links to refer them to. If you want to learn any modding skill… read up on it, and then tackle it yourself. But with that said, intelligent questions are certainly always welcome from people who have got their "hands dirty" trying this out.
OK here goes…
Capabilities and Limitations of this method
What you CAN do with hex editing…
- You can change the textures/alphas on models (like <MATERIAL_OVERRIDE> only it works on all models)
- You can pack multiple copies of the same model (i.e. weapons/monsters) into the same folder while using different textures on each model, as long as the models all use the same animations (allows smaller downloads than multiple "folder packing").
- You can change which particles come from the particle emitters that may already be on a model (advanced - not covered in this tutorial).
What you CANNOT do with hex editing…
- You cannot change the shape or size of models.
- You cannot add new texture layers (like specular, glow or shifter layers)
- You cannot add new particle emitters or reposition existing ones.
- You cannot affect how the texture gets wrapped around the model (that is decided in MAX).
Lets see how do I begin…
First lets talk about tools. I use a hex editor that I got for free called HDD Free Hex Editor. I can’t remember where I originally got it or who recommended it to me (but I think that it was Surdin?), but when I googled for it I found it available for download here: HHD Free Hex Editor.
Please download and install this program now, if you would like to follow along. During the installation be sure to allow the context menu options to be installed. That way when you right click on any file you can easily open it with your hex editor.
Before I actually get in to the hands on part of this let me lay down a couple of rules:
El_Heffe’s Hex Editing Rule #1:
For hex editing purposes the main game is your backup copy, therefore… NEVER, NEVER, NEVER, NEVER, NEVER, …EVER… modify a model in the main game… EVER.
El_Heffe’s Hex Editing Rule #2:
Because of rule #1 we have rule #2… ALWAYS, ALWAYS, ALWAYS, ALWAYS, ALWAYS make your modifications on a copy of the default model that you have created in your mod.
There will be a few other rules as we go but these are 2 of the biggest. As with all rules sometimes you can bend or even break them without consequences, but as far as I am concerned you have been warned. You now disregard rules at your own peril.
OK now lets talk about models to edit. The most useful model for editing that I have found, and the one that by far I have used more than any other as the starting point for a new project, is charm.mdl which is found in the ITEMS folder.
The model’s shape is a simple 2 dimensional square, roughly the size of a single inventory square. by changing the texture and alpha that are used on this square you can create "new" models. Basically it gives you a way to make an item’s icon lay on the ground and serve as the model also. (It just occurs to me that if you don’t already understand how alphas work on icons then you may have a hard time following how some of this works. For background info in this subject see this thread: The Icon Ramble).
OK so lets start by implementing Rule#2 and making a copy of charm.mdl in our mod. There will be illustrations as we go (courtesy of Surdin)…
In the game root find the ITEMS folder, and then find the charm.mdl within that.

Next right click on charm.mdl and then click "Copy".
(Notice that "Edit with Hex Editor" is on the menu, but remember Rule#1)

Next find the mod folder where we will edit the model, then right click, and click "Paste".

Ok now that Rule#1 and Rule#2 are out of the way we can start to get CRAZY! So take the copy of charm.mdl that you made in your mod, right click on it and open it with your hex editor.

When it opens you will see the hex code on the left side of the window and the "English" in a narrow column on the right side. (the English is mostly gibberish characters but occasionally you will see words over there).

Right toward the top of the English column you will see this model’s default textures, ‘healcharm.png’ and ‘healcharma.png’. They are highlighted in the screenshot so you can see them easier. I know that there are funky line breaks... you just have to get used to them. (notice how each highlighted character on the English side corresponds exactly to a pair of hex characters on the left).

To get a different look on the model you edit these references to point to whatever texture you are interested in using. But watch out for a few things:
El_Heffe’s Hex Editing Rule #3:
(Part: A) The name of the replacement texture that you are editing into the model’s hex MUST have EXACTLY the same number of characters as the default texture, and…
(Part: B) it must be edited into EXACTLY the same position in the hex as the default.
El_Heffe’s Hex Editing Rule #4:
The replacement texture that you want the model to use must exist in the same folder as the edited model. (In other words, you can’t edit a whole file path into the hex, and the model will only "look" in its own folder for whichever replacement texture you have specified).
El_Heffe’s Hex Editing Rule #5:
You can’t add texture references where they don’t already exist ~or~ Don’t mess with anything that isn’t an obvious texture reference. (for instance some models refer to a texture for a "glow layer". if a model has this by default you can point it to a new texture for that layer, but if it doesn’t there is no way to add that layer to the model by editing in hex).
So for this to work correctly on charm.mdl whatever texture you are going to edit in must have exactly 9 characters in its name and 10 characters in the name of the alpha (9 characters plus the ‘a’ at the end). And this texture must be in the same folder as the copy of the model that you are editing.
So if your texture name is of the correct length and in the right folder then go ahead and click into the "English" section of you hex editor and overtype the default texture names with your new ones, and save the changes by clicking ‘File>Save’, or click the picture of the green floppy disk (the universal icon for save).
Here is an illustration using replacement texture names of ‘mynewartx.png’ and ‘mynewartxa.png’…

Be sure to remember Rule#3 Part: B. The replacement texture name must go into the exact position that the default texture name originally occupied. So make sure that your hex editor is set to "overtype" rather than "insert". You can tell by looking in the lower right corner, it should have the letters "OVR" in the corner, also the circled symbol should have a white rectangle behind it, like this…

IMPORTANT: Make sure it looks like the illustration above before you try to type into the hex.
If it says "INS" you should click the circled symbol (notice it lacks the white rectangle behind it). This will toggle it to "OVR".
IMPORTANT: Don’t try to type in the hex if it looks like the illustration below.

Now you just have to rename the modified copy of the model to something other than charm.mdl (this can easily be done with out a hex editor by just right clicking and choosing rename), and point the ∗.DAT files to your cool new model.
That’s pretty much it… If you know how to use the viewer from the minimod kit that can also be useful for pre-viewing the models before you launch the game. Be advised however, the viewer displays your ∗.PNG files on the model instead of the ∗.DDS files the way the game does, so if your ∗.DDS files need deleting you may see one thing in the viewer and something else in the game until you remember to delete the bogus ∗.DDS files.
What’s that you say? There has to be more to it?
Well ok there is a little more…
Once you have renamed the models to unique names and edited them to point to textures that are using unique texture names, then you can have as many edited models as you like all in the same folder as long as they all use the same animations. Never put animated models in a folder that contains animations foreign to them, and avoid mixing animated models (∗.SMS) and static models (∗.MDL) in the same folder unless it is already working like that in the main game.
(Does your head hurt?)
but… but… but…
OK… OK… Q and A time…
…Shoot!
Q. How can I get all my texture names to have the right number of characters?
A. Well I usually either abbreviate if my name is too long, or character stuff with X’s if my name is too short. You will find your own way.
Q. What if I want a 2D model that isn’t a 1x1 square?
A. Well the only 2D model that I have happened upon so far that isn’t a 1x1 square is the fishing pole its a 1x3 rectangle so you could build textures for that if you wanted… I guess. There are no 2D models that are 2x2 that I can think of.
Q. What if I don’t want my model to have that little gleam on it? (which I can see in the hex toward the bottom).
A. Well honestly I have never tried to mess with the gleam (I rather like it actually)… you could try to tinker with it if you want, but I can’t be held responsible if anything goes horribly wrong. ∗psst∗ the fish.mdl is just like charm.mdl only with no gleam (and your file name only gets 4 characters).
Q. What if I want to edit a new texture onto a model that is an actual 3D model?
A. Same basic drill as above only if its an animated model (like a monster or armor) then it has to be kept in its own folder a la the "folder packing method" along with all the relevant animation files (as well as the replacement textures of course)… to tell you the truth when it comes to animated models the folder packing method really does most of the heavy lifting. I only hex edit those when I have several copies of the same model in one folder that are going to be using the same animations but different textures (and even then some models are too complex to hex edit effectively. i.e. the YETI)… otherwise its just showing off (which is still fun), because anybody who can folder pack a model can do the same exact thing without editing in hex.
Q. Where can I see some examples of a finished product that was made using this method?
A. Glad you asked… check out these links (all my own work of course, and just a sampling):
Any more questions?
Fire away…