wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > MDL Editing
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-10-2006, 04:21 PM   #1
iNfraNe
PhD
 
iNfraNe's Avatar


Cinematics Moderator
 
Join Date: Dec 2003
Posts: 2,283

Submissions (7)

iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)

Approved Map: Mortar Ball

Send a message via MSN to iNfraNe
Default MDL Editing: The Basics

Introduction

Frequently people ask me how to make models. Making models from scratch is hard, and you will need various tools for this or the expensive program called 3D Studio Max. This tutorial will therefore focus on editing existing models.

Warcraft III handles two formats of models: mdx (the compressed version) and mdl (the uncompressed version). All models stored in Warcraft III are in mdx format, and therefore you need to import models into your map in this format. Mdx files however, are not editable with notepad, mdl’s are. Therefore we must be able to convert models of mdx format to mdl and back.

Tools needed

The actual tool we will work with is notepad (or any other basic text editor). This comes with windows so that is easy.

Another tool we need, is one that can convert mdx to mdl and back. I know two tools able to do this: Yobguls’ “Warcraft III File Converter” and “Warcraft Model Editor” by Magos.
Last a tool to extract models from the MPQ. Wc3viewer by Prophet will do, as will any other mpq editor.

How do models work

Models are made by alot of points with 3 dimensional placement and directions, also called vertexes. Between each 3 vertexes there can be a so called “face”. This is the part of the model that is textured and visible in game. So when looking at a model you are actually looking at alot of tiny triangles. The model has a track in the time to animate. By setting movement/rotation/scaling values it will animate by the time. So actually the model will do all its animations if you would “watch it” like it was a movie. When playing an animation you watch a small portion of the entire animated model.

Basic notions

So, now we can get started. First, extract a model from the MPQ. I use the rat (its a simple model of a unit to start with), the path: “Units\Critters\Rat\Rat.mdx”. Convert the model from mdx to mdl using your converter and open the mdl with a text editor. On top of the model you will see something similar to this:
Code:
// MDLFile version	Jun 27 2002 20:34:57
// Exported on Mon Dec 12 21:10:46 2005
Version {
	FormatVersion 800,
}
Model "Rat" {
	NumGeosets 2,
	NumGeosetAnims 2,
	NumHelpers 14,
	NumBones 11,
	NumAttachments 11,
	NumEvents 4,
	BlendTime 150,
	MinimumExtent { -62.0313, -16.2074, -30.2564 },
	MaximumExtent { 34.7856, 65.9125, 49.5211 },
}
The first 5 lines are of no interest to the model, neither is the name. After this we see how many geosets, geosetanims, helpers, bones, attachmentpoints and events it has. These will be explained below. Also present is the blend time of the model, and the min/max extents.

Blendtime: This is the time in milliseconds the model will take to blend from one animation to the other. It is used to smoothen abrupt changes. It will most likely always have a value of 150 and this value can also be edited in the object editor of World Editor.

Min/Max Extents: These have 3 values. One for the X, one for the Y, and one for the Z direction. It tells warcraft when to render the model and when to stop rendering it (it will stop rendering outside the camera + the min/max extents).
Now that the header of the model is cleared we will move on. Under this you will find something like this:
Code:
Sequences 8 {
	Anim "Stand" {
		Interval { 5000, 7000 },
		MinimumExtent { -56.8896, -9.66866, -5.54965 },
		MaximumExtent { 22.4475, 14.711, 25.599 },
		BoundsRadius 40.8942,
	}
	Anim "Walk" {
		Interval { 7500, 8000 },
		MoveSpeed 360,
		MinimumExtent { -53.7116, -9.7495, 1.37076 },
		MaximumExtent { 25.8239, 13.541, 49.5211 },
		BoundsRadius 43.8341,
	}
	...
	Anim "Attack" {
		Interval { 31000, 32000 },
		NonLooping,
		MinimumExtent { -60.4865, -15.4885, -10.1442 },
		MaximumExtent { 34.7856, 18.7263, 36.0843 },
		BoundsRadius 52.9707,
	}
	...
}
As you might have thought, yes, these values resemble the animations the model plays. The Interval is the time interval the model will play of its own keyframes on this animation. Other tokens are:
MoveSpeed: This demonstrates the distance which is walked in 1 animation length, this can be changed in the object editor.
NonLooping: As it says, this will make the animation not loop, like on attack or death animations.
BoundsRadius: This has to do with the radius on which the model is selectable.

Under this we see the Textures section, it all speaks for itself I think. Under that is the Materials section.
Code:
Materials 2 {
	Material {
		Layer {
			FilterMode None,
			static TextureID 0,
		}
	}
	Material {
		Layer {
			FilterMode Transparent,
			static TextureID 1,
			Alpha 7 {
				Linear,
				40000: 1,
				42133: 1,
				100000: 0.998023,
				103333: 1,
				105467: 1,
				154567: 0.998023,
				163333: 0.75,
			}
		}
	}
}
The Filtermode describes how the texture will behave when the texture has an alpha channel, most common values are None, or Blend (Blend will make the texture become transparent by the alpha channel). We also see the TextureID. This will tell the material which texture to use (starting count at 0). We also see a token Alpha there and in it a few numbers ordered like this: 40000: 1. This describes a variable alphachannel for the model. The first number is the time on which to take action, the second is the alphavalue. 1 is completely visible, 0 is completely invisible.

Under this come the geosets. A geoset is the core of a model. It holds all the vertexes and triangles. Do not try editing this without tools, it is nearly impossible. All the way at the bottom you see what material the geoset will use by MaterialID (counts from 0 also).
The visibility of geosets (not only their textures) is controlled by GeosetAnims. The Alpha token works the same way as it does on materials. The GeosetID tells the geosetanim which geoset to use.

Under this come the Bones, the core of animation:
Code:
Bone "Mesh21" {
	ObjectId 3,
	Parent 14,	// "Bone Tail 2"
	GeosetId 0,
	GeosetAnimId 0,
	Translation 17 {
		Bezier,
		5000: { 0, 0, 0 },
			InTan { 0, 0, 0 },
			OutTan { 0, 0, 0 },
		...
	}
	Rotation 14 {
		Hermite,
		5000: { 0, 0, 0, 1 },
			InTan { 0.0250946, 0.0346695, -0.0503677, 0.997813 },
			OutTan { 0.0250946, 0.0346695, -0.0503677, 0.997813 },
		...
	}
}
The ObjectID is essential for each object from now on, and they should line up without having gaps between them. The Parent is the object to which the bone is linked, as it parent will animate, so will the child.
The Translation, Rotation and Scale (scaling is not seen on this model) are the actual animation factors. Translation means movement trough space, trough the X, Y and Z axis. Rotation is about rotation the model again around 3 axis, Scaling works the same. The Bezier or Hermite token represents the Motion controller it will use, changing this will have close to no effect on the models animation.
The first number on the actual values again represents the time where to take action, and after this are the values.
InTan & OutTan have something to do with how quickly the animation will go between two frames, these values will be used by Bezier and Hermite animations.

Helpers “help” to do the animation. They behave just like bones, but don’t have geosets linked on them.

After this we see the attachment points. Needless to say, these are the points where you can place special effects on. One new tokes we see here is Visibility. But not to worry, it is exactly the same as Alpha. Each attachment point has “ Ref” behind its name, thats just the way it is.

Almost last we see the Pivotpoints. These are VERY important to the model. They give each Object a center point. The first one is for the object with ObjectID 0 etc. When removing Objects ALWAYS remember to change the pivotpoints. Objects will rotated around, will move to and scale from the pivotpoint.

Events. These nifty little things take care of any external model behaviour. From sounds to bloodspatter and footsteps. What they will do lies in they name “SNDxBLA” will make a sound with the 3 lettercode BLA (I dont think this one exists ;-) ). I’m sure there is a list which holds all event objects somewhere. Have fun looking for it if you ever need these things, I dont. The EventTrack token will say when to play the external event.

CollisionShape. They will make the model clickable. Clicking on the collision shape will tell Warcraft that the model is being clicked on.

Other objects:
Most other models will also have ParticleEmitters and OmniLights. Tho these are in my eyes most powerfull for mdl editing I will not explain them in this tutorial, since there is a whole lot to say about them.

Starting the Edit

Most edits are hard and deserve a tutorial of their own. Therefore I will only explain a tiny bit of what is possible: Removing stuff from the model (like hero glow).
Like you would maybe think, removing a part of a model is not as easy as just deleting a part out of the the mdl. There are alot of things to fix afterwards.
Lets say you are removing a geoset. Once you have deleted it totally, there will still be alot pointing to something that does not exist. Therefore you must find all objects/geosetanims that point to that geoset and remove them too. If they have childs, you will have to also remove those. Hold in mind that by removing them you are screwing up the ObjectID’s and you must align them again. You will have to remember which parent is pointing to which childs and also correct all pointers. Last to do (or actually this is the first you should do!) is to remove the pivotpoints corresponding to the objects you removed.

Final Words

All together, mdl editing is powerfull, but hard to master. When learning it, you will find great pleasure in seeing your models actually working ingame, or disappointment in seeing them not work, or even crash the game. Do not worry, this is the normal process it takes to mdl edit, since it is so hard to keep track of everything.

Hope you understood this all and you now can hopefully try and change things in the model and learn what they do.
__________________
Ever so slightly active.
Table:
Past Projects:
The Spirit of Vengeance (Cinematic, Blizzard contest winner)
Elimination Tournament
Mortar Ball
iNfraNe is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-18-2006, 11:33 AM   #2
Tim.
Missing You All at Wc3c
 
Tim.'s Avatar


Site Owner
 
Join Date: Jul 2003
Posts: 4,475

Submissions (18)

Tim. is a name known to all (503)Tim. is a name known to all (503)Tim. is a name known to all (503)Tim. is a name known to all (503)Tim. is a name known to all (503)

Approved Map: PiratesSpell making session 3 winner

Default

Approved.
__________________
"oO and if anyone called Tim. trys to make an account then kick there butts." -Mavus, moderator of the GTW forums


Avast! Seen Pirates? Get it here!
Tim. is offline   Reply With Quote
Old 04-18-2006, 12:26 PM   #3
Blade.dk
.
 
Blade.dk's Avatar


Respected User
 
Join Date: May 2005
Posts: 1,990

Submissions (15)

Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)

Approved Map: Azeroth's Arcane ArenaSpell session 01 winner

Send a message via MSN to Blade.dk
Default

But what is it doing in modelling tutorials? It is about MDL editing. I have moved it.

Nice tutorial, iNfraNe.
__________________
Spell Making Course: Part 1: Making a simple stomp spell.
I wonder if I'll ever finish part 2.
Blade.dk is offline   Reply With Quote
Old 04-18-2006, 04:34 PM   #4
iNfraNe
PhD
 
iNfraNe's Avatar


Cinematics Moderator
 
Join Date: Dec 2003
Posts: 2,283

Submissions (7)

iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)

Approved Map: Mortar Ball

Send a message via MSN to iNfraNe
Default

Finally someone looked into it, thought it was never gonna be approved :)
__________________
Ever so slightly active.
Table:
Past Projects:
The Spirit of Vengeance (Cinematic, Blizzard contest winner)
Elimination Tournament
Mortar Ball
iNfraNe is offline   Reply With Quote
Old 04-18-2006, 08:20 PM   #5
Jacek
Banned
 
Join Date: Dec 2004
Posts: 1,095

Submissions (1)

Jacek is a jewel in the rough (164)Jacek is a jewel in the rough (164)

Send a message via MSN to Jacek
Default

Few notes:

Quote:
BoundsRadius: This also has something to do with when to render the model and when not to, im not completely sure what it actually does.
Like Extents they are also related to frustum culling of objects.
Quote:
InTan & OutTan have something to do with how quickly the animation will go between two frames, editing will also have close to no effect.
They are positions of control points of the Bezier or Hermite. Linear animation isn't using them.
Quote:
ParticleEmitters
There are 2 types of ParticleEmitters - ParticleEmitter and ParticleEmitter2. Often you see ParticleEmitter2 in effects like fire, water, smoke, abomination's poison cloud etc. ParticleEmitter works like ParticleEmitter2, but uses other model as a particle. You can see this in Blade.dk's Bone Spear (rings are generated by ParticleEmitter)
Jacek is offline   Reply With Quote
Old 04-19-2006, 10:15 AM   #6
Rao Dao Zao
www.raodaozao.net
 
Rao Dao Zao's Avatar


MDL & Resource Moderator
 
Join Date: Aug 2003
Posts: 2,511

Submissions (27)

Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)

Approved Map: When the Freedom Slips Away

Send a message via MSN to Rao Dao Zao
Default

Boundsradius is related to selection; clicking on an area of geometry within the boundsradius will result the model being selected, in the editor or in game. Models without boundsradii are unselectable except by drag-selecting.
__________________
Rao Dao Zao is offline   Reply With Quote
Old 04-19-2006, 02:42 PM   #7
iNfraNe
PhD
 
iNfraNe's Avatar


Cinematics Moderator
 
Join Date: Dec 2003
Posts: 2,283

Submissions (7)

iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)

Approved Map: Mortar Ball

Send a message via MSN to iNfraNe
Default

thx both, will update.
As for particleemitters, like I said, different subject.
__________________
Ever so slightly active.
Table:
Past Projects:
The Spirit of Vengeance (Cinematic, Blizzard contest winner)
Elimination Tournament
Mortar Ball
iNfraNe is offline   Reply With Quote
Old 08-14-2006, 02:10 AM   #8
linguistic
User
 
linguistic's Avatar
 
Join Date: Aug 2006
Posts: 9

linguistic has little to show at this moment (0)

Default

Thanks for the tutorial, I really appreciate this, though I am more interested in skinning, triggers, and terrain, this is still very helpful for anyone looking to make maps on their own, you never know when you may, say, I dont know, want a character with only one arm :)
linguistic is offline   Reply With Quote
Old 09-08-2006, 12:59 PM   #9
Dionesiist
User
 
Join Date: Dec 2005
Posts: 2,163

Submissions (34)

Dionesiist is just really nice (382)Dionesiist is just really nice (382)Dionesiist is just really nice (382)Dionesiist is just really nice (382)Dionesiist is just really nice (382)

Default

Can you please evolve the topic of making geosets appear in certain anims?
__________________
Dionesiist is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 10:43 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services