- Joined
- Jan 11, 2009
- Messages
- 3,414
Warcraft MDL Exporter for Blender
It's been a long time coming, but now there's finally a way to export Blender models for Warcraft III!
This plugin is currently under development, but already supports practically all properties of the MDL format. I will try to keep this thread updated with new info and instructions on how to use it.
DOWNLOAD
Tutorial: [3D Art] - Exporting models from Blender using the MDL exporter plugin
Procedural tree modeling tutorial: [3D Art] - Creating procedural trees using Blender
Current issues:
- Although animations are supported, there can be some limitations and issues. For instance, you can't parent armature objects to other objects. Euler rotations should be supported but i haven't tested yet.
- Bezier and Hermite interpolation are exported in a somewhat approximative fashion, and although it usually looks good, you might get some issues. Rotations will automatically use linear interpolation as of right now.
- Animating the dimensions of a particle emitter is currently not supported and will throw errors.
- Armatures apparently need to have a scale of 1 for translation animations to work correctly. This will be fixed.
Usage Guide
Modeling
Meshes with the same materials will be combined into geosets.
To control the smoothness of your normals, set the object to "Render Smooth" in the right toobar, and then go to the "Object Data" properties tab and check the box which says "Auto Smooth". Here, you can choose the maximum sharpness angle which will be smoothed. Note that any mesh with a particle system attached to it will be treated as an emitter, and thus will not be exported as a geoset.
Attachment Points
To create an attachment point, add an empty object and give it a name ending with "Ref" - for example, "Overhead Ref" will create the attachment point "Overhead". Attachment points can be parented to bones by selecting first the object, then shift-selecting the bone, and pressing CTRL+P>Set parent to object.
Event Objects
In their most basic form, event objects are empty objects with a name matching the pattern "[EventType][UniqueId][EventId]". One example is "SND1DHLB" which represents the sound event "Death Human Large Building". This can be a bit hard to remember, so fortunately there is a helper operator for this. Press SPACE to open the search bar and type in "Add MDL Event Object". This will create an empty where you can configure the event type and ID from dropdown lists in the object properties tab. To determine when the event is executed, there is a property called "eventtrack" in the "Custom Properties" submenu which you can animate. If you create your event from an empty object, you will have to add this property yourself. What value you assign to it in the animation doesn't matter - only the frame numbers are used.
Collision Shapes
Collision shapes are used typically to specify the clickable surface of a unit. There are two types of collision primitives - Box and Sphere. To create one, press SPACE to open the search bar and type "Add MDL Collision Shape". You will be prompted to choose between the two types. After confirming, the shape will be created at the position of your 3D cursor.
Lights
Create a lamp and go to the "data" properties panel to find a panel named "MDL Light Settings". Here, you can configure the light type as well as attenuation properties, color, and intensity. All values except the light type can be animated.
Billboarding
Lights, bones, and attachment points can all be billboarded. A panel titled "MDL Billboard Options" will appear in the "object" properties tab when a relevant object is selected. You can constrain billboarding to a certain axis by checking the "Billboard Lock X/Y/Z" checkboxes respectively.
Materials
Meshes will need materials in order to be exported. When creating a new mesh, go to the Materials tab and make sure that the mesh has a material assigned to it. At the bottom of the tab, there is a panel with the label "MDL Material Settings". Press the "+" button next to the "Layers" window to create a new material layer. Each layer can have a Texture Type assigned to it, the different texture types are:
- Texture (requires a path specified)
- Team Color
- Team Glow
- Cliff
- Lordaeron Tree
- Ashenvale Tree
- Barrens Tree
- Mushroom Tree
- Northrend Tree
- Replaceable ID
Rigging
For the most basic models and animations, rigging is not necessary. The exporter will automatically create bones for objects which don't have any, and transfer any animations to them. To make bones manually, create an empty object (CTRL+A > Empty) and give it a name which starts with "Bone_". You can also use Blender's armature objects to create bone hierarchies, this is necessary if you want to have deforming bones. Select your meshes first, then your armature, and press CTRL+P and select "Armature Deform with Automatic Weights". This allows multiple bones to affect the deformation of a single mesh.
Bones which have no geosets attached to them will be automatically converted into helpers.
Animation
Animating in Blender is done by first changing a value, then adding a keyframe to save it. Most properties can be keyframed by mousing over it and pressing I. Location, Rotation and Scale can be keyframed by simply pressing I anywhere in the 3D viewport and selecting them from the drop down menu.
Creating Sequences
When animating your model, the animation will be done as a single, long segment of different movements in the animation timeline. Sequences define the start and end bounds of each named animation clip. To create one, mouse over the timeline and press M to create a timeline marker, and then CTRL+M to name it. You can name them anything, but Warcraft generally only accepts certain names such as "Stand", "Death", "Birth", etc. Drag your timeline marker to the start of your sequence, and then create another one with the exact same name and place it at the end. Note that you MUST have a start and end marker for your animation to export. You can place as many sequences as you like, but they cannot overlap.
Whenever two timeline markers with the same name are created, a sequence will be created in the sequence manager, which you can find under the scene tab in the properties menu. Here, you can edit things like looping and rarity - changing the name in the sequence editor will also change the corresponding timeline markers. If the name contains the word "Walk", the editor will expose a Movement Speed parameter which controls the relationship between the units movement speed and the walk animation playback rate. If you create a Death, Decay, or Attack animation, their non-looping values will default to "False" for convenience.
Global Sequences
A global sequence is an animation which repeats itself over and over, regardless of which sequence is playing. An example of this is the movement of the flames of the Fire Lord hero. To mark an animation as global, go into the graph editor, select your animation curve(s), and go to "Key>Add F-Curve Modifier>Cycles" (or press SHIFT+CTRL+M). For animations with multiple channels, such as rotation/color/scale/position, only the first channel needs the modifier. Note that most properties support global sequences, including most particle settings, event track keys, light intensity, visibility, etc. (i will make a full list at some point). Also note that global sequences always start from the first frame - all frames from 0 up until your last animated frame will be part of the sequence.
Animating Visibility
You can control when or not an object will be visible by animating its render visibility. The easiest way of doing this is to select the object, change render visibility by clicking at the camera icon next to it in the outliner, and then pressing the I key with your mouse still over the icon to create a keyframe. Another option is to add a "custom property" to the object, name it "visibility", and then animate that - whichever is more convenient.
Animating Vertex Color
Warcraft materials can be given an aninmated tint which is applied as a vertex color in the game (same as the tint color properties in the object editor). Tint is applied per-object using the "Color" field in the object properties tab. Animate it, and a GeosetAnim will be automatically created for this geoset. It also works to just set the object color to anything else than white.
Texture Animations
To create a texture animation for a layer, enable nodes for the material and add a "Mapping" node to the node tree, give it the same name as the layer you want to animate, and animate its properties. The name of a node can be changed in the viewport menu of the node wiewport (N to toggle).
Interpolation Modes
You can change the interpolation mode of your keyframes by pressing A in the graph editor so that all keyframes are selected, and then go to Key>Interpolation Mode. All three modes are supported, though Bezier rotations will be converted to Hermite in a somewhat experimental way.
Particle Emitters
The exporter supports all three emitter types: ParticleEmitter, ParticleEmitter2, and RibbonEmitter. These are referred to as "Model Emitters", "Particle Emitters" and "Ribbon Emitters" respectively. To create a particle emitter, create a plane (SHIFT+A>Mesh>Plane), go to the "Particles" tab in the properties window, and press "New". Scroll down to the bottom and you will find the emitter settings. Most properties have informative tooltips if you mouse over them - there are also some excellent tutorials on how to do particle emitters in the tutorials section.
One important thing to node though: Exported emitters will use the plane's X and Y scale to define its bounds. For this reason, make sure to never apply its scale (For those who don't know what this means - you can apply an objects scale by pressing CTRL+A>Scale to set its scale to (1, 1, 1) and instead apply the scale to the vertex positions). Remember that you can animate the X/Y scale to animate the bounds of the emitter; Unlike other objects, it is safe to individually keyframe the X and Y scale of an emitter, and you can also have different global sequences for each axis. "Emission Rate", "Speed", "Gravity", Variation", and "Latitude" can all be animated (hover over the field and press I to keyframe the value).
Last edited: