MDL Editing I - The Basics

From TDGwiki

Jump to: navigation, search

Written by CHUNK

A lot of people ask me about how to do some pretty basic things to edit models. I don't have access to the really fancy software (3DS Max) so I mostly do MDL editing. I thought I should share some of the things I've learned how to do and allow other people the opportunity to learn from it. As a result, I am writing a series of tutorials which will cover almost everything that you might want to do with MDL editing that can be done with the fancier and costlier model editing software.

Contents

Introduction

To start, let's talk about what exactly is mdl editing and why isn't it 'model' editing. All model files used in Warcraft are in the format .mdx, which is the graphical model you see when you look at a unit, doodad, etc. The text version of the .mdx file type uses the extension .mdl (thus mdl editing) and it includes all of the information about the model, including the skins and other graphics used, sound effects played during animations, particle emitters, attachment points, and other fun modely junk that you probably don't need to know about.

The interesting thing about MDL editing is that you can do all of it with Notepad, if you'd like - although sometimes the tools that have been developed are a lot friendlier methods of producing the model you want.

To edit models, you almost always need to first convert them from the mdx format to the mdl format, so you can mess with them directly in Notepad or tinker with them using other software. Some people have trouble converting files because the tool that you use to convert them back and forth is a little buggy. If you can't make the mdl->mdx converters work for your computer, you will probably have issues with many of these tutorials, but I will try to eventually cover some tools that don't require .mdl file types.

The Tools

To make things easier, I've compiled all of the tools I most commonly use for editing models in the following zipped folder:

This zipped file includes the following tools:

  • Yobgul's File Converter
  • Oinkerwinkle's full MDL suite of MDL editing tools
  • Oinkerwinkle's Warshape
  • Magos' War3ModelEditor (1.05)

You will also need/want these tools, particularly the viewer:

  • Image Extractor II
  • War3Viewer

If you don't have them, they are also in that tools folder, although they may be old versions ( http://www.jx3.net/tdg/Tools/ ). They are useful for viewing the models and finding/viewing blps (skins).

The Fundamentals

In order to have some understanding of what I am talking about, you need to know the terms. Model editing isn't hard, the terms a little confusing at first - so just stay with me here:

Models are composed of several components: the most important three are skins, geosets, and bones.

Bones
We won't be messing with bones (or at least not for some time) but it's good to know what that means. Bones are just like your own bones, they are the skeleton of the model. When the model moves, it moves because the bones are animated. Bones have no physical representation that you can see - they are purely conceptual constructs that are visible in model editing programs like 3ds Max or Gmax, but aren't visible in-game. The bones are set up to be moved, so that models can move in a logical fashion.
Geosets
Geosets are kind of like the model's actual skin (although, strictly speaking, they aren't visible either). They are made of small 3-sided panels that are joined together with other panels to make nodes. Each 'panel' is a flat surface - which is what people mean when they say polygons (or polycounts, which is how many polygons a model has). Geosets are basically welded onto the bones and they stretch when the bones are pulled or pushed, so as to give a physical surface to the model. They are designed to stretch in model editing software by building intricate links to the bones.
A geoset is technically any grouping of these panels (polygons) - and models are often composed a multiple geosets - usually because the geosets require more than one skin or different types of materials (for example, some skins have alpha values set to team color, some skins have alpha channels set to be transparent - seeing as how alpha channels can't represent both, the model is usually divided up into geosets so that all (or most) of the stuff that is affected by team color is together, all of the stuff that has one skin is together, and all of the stuff that has a similar material affect are together.
Skins
Skins are the graphical part of a model that you see in-game. Skins actually cover over the geosets - like wallpaper (or clothing on an invisible person if we want to keep our metaphor of skeleton, skin, and clothes together). If a model has no skin, nothing is visible in game (not strictly true, but basically, the outside of the model (geosets) won't be visible and neither are the bones. As I mentioned, above about geosets, models often have multiple skins required to see everything correctly. All skins have a path that is referenced by the model and this path must match the location of the skin if you import a skin into a map.
When people ask - "can I have the same model with multiple skins?", the answer is usually 'no', because each model has the path of the skin it uses imbedded into the mdl text directly - so until someone finds a way to change those values easily, you need one model for each different skin (although there are some tricks to get around this, sort of, they are advanced). You could, however, have multiple models that use the same skin.

Now, aside from just covering the basics of models in this tutorial, I thought it would be best to walk people through some of these things you find in a mdl file and talk about what they are and what they do. To do this, you'll need two programs: War3Viewer and FileConverter.

Extracting the Model

I use W3Viewer to extract the mdx I want to edit, so I will walk you through that first:

  1. Open Viewer
  2. Two windows should open, one with a big field with a menu and a smaller box with radio buttons at the top and expandable + folders. If the smaller of the two doesn't open, open it by clicking on view | treeview window
  3. Make sure the mdx radio button is selected, expand the + folders to see the tree view of all possible models in the mpq. Viewer tends to open whatever mpq you had open last, so if you want stuff from TFT, you need to File | Open MPQ and browse to War3x.mpq
  4. Find a model to open. For this example, I'll use a rifleman: Browse through expanding folders, to units, human, rifleman, Rifleman.mdx
  5. For those of you who are unfamiliar with the file paths, if you were to import a new model called Rifleman.mdx into your map and you wanted to overwrite the existing one, you have just browsed to that path: Units\Human\Rifleman\Rifleman.mdx - the same sort of pathing that you would do to find the path of skins.
  6. Right-click the mdx file from the list, select Extract file - put it on your desktop or somewhere you like to work so you don't lose track of it.
  7. Close the Viewer

Now you have the model extracted.

Convert the File

  1. Open FileConverter
  2. Click the Load File button
  3. Sometimes the file doesn't show up at first, if this happens, browse to the right place, then change the extension type you are browsing for to something other than mdx and then back to mdx and your file should appear
  4. Select the mdx, click convert to mdl.
  5. It should give you an OK button - if it isn't OK, too bad, you got the button anyhow. Close the program. Note: this usually causes the program to crash for me. Also if you do a lot of conversions at once, it can also crash the program. But once the model is converted, it doesn't matter.

Open your favorite text editor (Notepad, I guess) and use it to open the mdl file. It won't be a natural choice, but you can change the file types to view all and select it.

What makes up a mdl file?

This should give a file that starts out something like:

// MDLFile version Jun 6 2002 04:58:04

// Exported on Mon Sep 04 23:28:17 2006
Version {

FormatVersion 800,

}
Model "Rifleman" {

NumGeosets 4,
NumGeosetAnims 4,
NumHelpers 17,
NumBones 30,
NumAttachments 10,
NumParticleEmitters2 3,
NumEvents 8,
BlendTime 150,
MinimumExtent { -113.538, -63.0121, -38.6218 },
MaximumExtent { 76.7922, 64.4947, 136.98 },

}


Then a bunch bunch bunch more junk under that. We'll take it slowly and just cover some of these things in the file. This stuff I've pasted above is just metadata that the model uses to make sure everything matches up with what is actually in the file. 4 geosets (we talked about those), 4 animations, 17 helpers, 10 attachments, etc.

Sequences 10 {
Anim "Stand" {
Interval { 67, 1400 },
MinimumExtent { -31.8948, -38.6305, 0.476923 },
MaximumExtent { 62.9998, 48.9718, 82.314 },
BoundsRadius 63.8099,

}

Sequences are the animations the model has. There's a whole list of them, but this is the animation for Stand. Interval just tells you in a sequence of events, which ones refer to Stand (67 to 1400). If you want to add an animation (we'll cover that later) the model should have ranges for the interval that don't overlap with those you are adding. Some of the other animations have a few other descriptors such as non-looping or rarity 4 - these thing just tell the model how and how often to play the animation.

Below the animations, the path to the skins are listed:

Textures 5 {
Bitmap {
Image "units\Human\Rifleman\Rifleman.blp",
}
Bitmap {
Image "",
ReplaceableId 1,
}
Bitmap {
Image "Textures\Dust3x.blp",
}
Bitmap {
Image "Textures\gutz.blp",
}
Bitmap {
Image "Textures\Flame4.blp",
}

}

As you can see, there are 5 bitmaps referenced (although one is nulled). The first is the rifleman's skin, then dust is the effect from firing the gun, as is flame4, and gutz are the skeletal remains. If you wanted to change any of these paths to something else, you can. In fact, towards the end of this tutorial, I'll do that just to show you how easy it is.

Next comes Materials. This field tells you things like how transparent, is it colored, does the alpha channel make player color, etc.

After the materials the geosets are listed. There are four in this model, each one representing the surface of different parts of the model. The geoset is defined by vertices with three points.

Geoset {
Vertices 342 {
{ 8.71961, -4.0321, 74.6725 },
{ 9.77005, -2.57717, 74.5852 },
{ 9.45785, -3.20564, 76.2338 },
{ 66.5764, -0.0918, -2.79801 },
{ 66.6436, -7.77476, 4.88513 },

If you are curious what each geoset is defining, you can open War3Viewer back up and find the Rifleman.mdx file again. Now in the treeview, you will see at the bottom 4 checkboxes that say mesh 1 - 4. Those meshes are the geosets. If you click off the checkboxes, the geosets will disappear. Geoset (mesh) 1 is most of the body, geoset 2 has the cape. As I mentioned, this is mainly because G2 has something that requires team color - so it gets its own geoset.

The geosets also include information about which panels are present between the nodes (and which aren't) - and a list of when each of the geosets is animated and how.

Below geosets, there is a list of geoset animations. These tell the model when the geosets are visible (1 means visible, 0 means invisible):

GeosetAnim {
Alpha 12 {
DontInterp,
67: 0,
1500: 0,
3667: 0,
13200: 0,
13400: 1,
14067: 0,
14333: 0,
16167: 0,
78100: 0,
83867: 0,
146033: 0,
146367: 1,
}
GeosetId 2,

}

The numbers before 0 or 1 are the sequences, you can match them up with the animations and match the geoset ids to the geosets themselves and it should become apparent when geosets are visible when.

Under these there is a long line of bones. As we discussed above, you can't do much with bones without real editing software, so we'll skip them. What is important to know about the bones is that you can attach things to them (like attachments and geosets) and if you are missing a bone between two models, you probably won't be able to get a good animation transfer between them, because something is missing that is supposed to animate.

Below these, the attachments. Each attachment is linked to a bone somewhere:

Attachment "Foot Left Ref " {
ObjectId 47,
Parent 34, // "Bone_Foot_L"
Visibility 1 {
DontInterp,
212833: 0,
}

}

Object IDs refer to this object (each bone, attachment, sound, camera, etc, needs to have an object ID) and parent is what the attachment is attached to (the object ID of the bone). Here the attachment has a visibility as well - obviously you shouldn't have attachments after things are dead if you can help it.

Pivot points and particle emitters are next and they are too complex for this discussion, but maybe I will eventually get to particle emitters in a later, more advanced tutorial. If should be enough to explain that particle emitters do things like make flames, sparkling lights, and other things that move around as small entities and make the models look good.

Sound events are listed next:

EventObject "SPLxHBL2" {
ObjectId 66,
EventTrack 1 {
15333,
}

}

They have a sequence number, like other animations, and this tells the model what time to play the sound. They have object IDs and they have these weird codes for the sounds themselves (this one is SPLxHBL2, I have not idea what that is, but it happens during the death animation, so maybe it is the unit exploding or something.

Cameras and Collision information are the last objects. Some models don't have a camera built in, but instead have a separate mdx for the portrait. In the case of these, you either need to add a camera or edit the portrait too. Usually the portraits have much higher poly counts and animate the unit talking and stuff - so they can be much nicer than just putting a camera in a model, but when it comes to file size, you might have to go with skimpy sometimes. I'm hoping to do an "add a camera" tutorial eventually.

For now, you can close the rifleman text file. No need to save anything. You can delete the mdx and mdl files. You can always export them again later.

A Quick Skin Change

To finish the tutorial, we'll do one last thing with a mdl file - and that is change the skin of a model and save it, and convert it back to a mdx. You can use this technique of simply changing the skin path. I don't think that any of the skins would look very good on a rifleman, so we can just export a different model, convert it, and change the path for the skin.

A lot of the models that people upload to wc3sear.ch are very simple edits that just change a skin out. I'll show you how lame that is to post there, because it requires no real skill. For this example, we'll make a new aura model. The nice part about messing with aura models is that you have the option of using existing blps in the game to replace the aura's skin.

So, we'll get started: Export the following model from W3Viewer:

  1. Abilities | Spells | Human | Devotion Aura | DevotionAura.mdx
  2. Convert the mdx to mdl using the FileConverter
  3. Open the mdl in Notepad

Now, Devotion Aura actually has 2 skins that make up the glowy arrow aura thingy under it - so if we were to replace the existing blps, we probably would want to find something that will look nice in quadrants (because the skins for this aura are quadrants).

Scroll down to the Textures section of the mdl file in Notepad. The first of the two images in Devotion are the corners, you can simply type over the existing address with the address of the file you want to use. To keep things simple, we'll use an existing blp in the game - the thorns aura quadrant:

Abilities\Spells\NightElf\ThornsAura\Thorns.blp

And we'll replace the glowy arrows with battle roar paws, just to put something in there:

Abilities\Spells\NightElf\BattleRoar\BattleRoar.blp

The texture part of your file should now look like:

Textures 2 {
Bitmap {
Image "Abilities\Spells\NightElf\ThornsAura\Thorns.blp",
}
Bitmap {
Image "Abilities\Spells\NightElf\BattleRoar\BattleRoar.blp",
}

}

Now you can just save the file. I'd recommend renaming it and changing the name of the file up at the top to something else, like RAWRA!

Model "RAWRA!" {
NumGeosets 4,
NumGeosetAnims 4,
NumHelpers 1,
NumBones 4,
BlendTime 150,
MinimumExtent { -83.556, -82.9196, 13.4777 },
MaximumExtent { 82.6268, 84.3226, 18.1723 },

}

Keep in mind that when you save as, it will save as a txt file, but you can just rename it by removing this last part of the extension to mdl. It will give you some crap about not doing things like that, but ignore it.

Open the mdl file in FileConverter and convert it to an mdx file.

Now you can just import the new model into warcraft and you are done. Remember, we used blps that were already in the game, so there is no need to add a skin - but if you were to make your own skin or edit the existing ones somehow, you'd need to make sure that you put the right path for the file into the mdl file (the same as the one you use for the custom path when you import the skin). Also remember that models won't show with some kind of skin.

One last thing about importing: Add all of the files using the import manager. Close the editor, saving the new map file. Then reopen the editor before applying the model to anything in the game.

Creating a Custom Loading Screen Model with MDL Editing

Looking for another simple thing to do with the MDL editing skills you learned in this tutorial? Check out this simple technique for making your own custom loading screens without the size issues:

  1. Convert your custom loading screen blp or tga image.
  2. Export the loading screen model.
  3. Convert to MDL.
  4. Change the loading screen skin path to your image's path.
  5. Save as your new model's names.
  6. Convert to MDX.
  7. Import your skin with the path you've set in the model.
  8. Import the model.
  9. Save, close the editor, reopen the editor.
  10. Set the loading screen mdx to your newly imported mdx file.
Personal tools
Navigation
Clan TDG

Main About the Clan Join.gif Clan TDG Members Community Events Friends Links Forum.gif

Resources

Maps Tutorials Tools Custom Skins, Icons, & Models

Wiki

Website Feedback Community Portal Recent Changes Jump to a Random Page Wiki Help

Toolbox
Clan TDG

Main About the Clan Join.gif Clan TDG Members Community Events Friends Links Forum.gif

Resources

Maps Tutorials Tools Custom Skins, Icons, & Models

Wiki

Website Feedback Community Portal Recent Changes Jump to a Random Page Wiki Help

LANGUAGES
Clan TDG

Main About the Clan Join.gif Clan TDG Members Community Events Friends Links Forum.gif

Resources

Maps Tutorials Tools Custom Skins, Icons, & Models

Wiki

Website Feedback Community Portal Recent Changes Jump to a Random Page Wiki Help