• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

MDL Exporter for Blender3D!

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.

Event_Objects.jpg

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. Note that like particle emitters, collision shapes use the scale of the empty object as radius, so don't use "Apply Scale" on them or the scale will not be properly exported. It is now safe to apply the scale of collision shapes.

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
As you might guess, the different "Tree" options are for replaceable tree textures, "Replaceable ID" is for manually entering an ID. For regular textures, paths can be easily found in MPQ editors such as the MPQ browser in Magos Model Editor (just right-click a texture in the hierarchy and press "copy path to clipboard"). Layers also have a filter mode, which dictates how it will be blended together with the below layers. The "Blend", "Transparent" and "Additive Alpha" filter modes also expose an extra "Alpha" property (animatable), which you can use to add an extra transparency factor to the layer or to create fade-out effects. Layers are rendered top to bottom, so team colors would typically be at the top of the list with the texture below. Layer names are for organising your layers mostly and aren't exported.

6_material_editor-jpg.305034

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.

Timeline.jpg

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.

Sequence Editor.jpg

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.

9_animate_visibility-jpg.305040

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


Particle Editor.jpg
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Very nice. Truly a long time coming.

It has been way too long since I used Blender though, can't really test it.

Helpers are the same as generic objects, aka the parent class of all nodes. In other words, they are the same as bones as far as animations go etc.

Note that both helpers and multiple bones per vertex are absolutely required.

If you are having issues with texture animation rotations, the keys are quaternions that rotate around the Z axis. An easier way to look at it is that they are simple 2D rotations.
Their form is [0, 0, Z, W].
The center of rotation is [0.5, 0.5], so translations are needed.

I would assume Blender can give you the bounding boxes of things. Therefore, is there any particular reason to use the local scale, rather than the bounding box? the latter will avoid the issues with node scale vs actual size.

Continuing with the same line of thought, I would assume Blender also gives you a way to get a quaternion representation of a node's rotation also when it's defined with euler angles, so is there a reason to limit this?
Euler angles are very yiffy, I agree, but Blender and other modeling tools do support them, so use it to your advantage.

And again, with the same theme - I would assume Blender supports both bezier and hermite interpolations, so same question there.

Of course I may be wrong about these assumptions, I haven't written any Blender code in longer than I haven't used it for modelling :p

Please support MDX as well!
 
Last edited:
Helpers are the same as generic objects, aka the parent class of all nodes. In other words, they are the same as bones as far as animations go etc.

Note that both helpers and multiple bones per vertex are absolutely required.

Thanks! Multiple bones per vertex is something i'm working on right now, it will likely be done today. It hasn't been a big deal in terms of visuals for the models i've tested though. I've gotten the impression that 3 bones is the max per vertex, so i'm using that limit. Fixed!

As for helpers, from what i understand they are just empty nodes in the hierarchy which can serve as parents, but nothing else. The thing is, the exporter currently optimizes away these kinds of useless nodes and instead use the nearest animated parent (or the root bone), so i'm not sure in what situation i'd want to generate a helper. When are they created in the Art Tools exporter? When do you use them in any other Wc3 model authoring tool?

If you are having issues with texture animation rotations, the keys are quaternions that rotate around the Z axis. An easier way to look at it is that they are simple 2D rotations.
Their form is [0, 0, Z, W].
The center of rotation is [0.5, 0.5], so translations are needed.

Thanks, this is very useful info. Texture rotations in blender are always in Euler (AFAIK) and rotate in 3D space (since Blender suports 3D textues and noise generators). I could propably create a quaternion from an axis-angle representation here.

I would assume Blender can give you the bounding boxes of things. Therefore, is there any particular reason to use the local scale, rather than the bounding box? the latter will avoid the issues with node scale vs actual size.

This was my first solution, but the thing is that you can't animate the bounding box of an object and there's no way of getting a curve for this (since it's a generated value). Another option would be to use custom properties, but this would not provide any visual feedback. I think not applying scale is a very small thing to ask. Optionally, i could temporarily assign an identity matrix as world matrix for the object (so as to give it neutral orientation), save its bounds to a scale vector, and then reassign its world matrix. This would allow me to multiply in that scale vector to each keyframe.

Continuing with the same line of thought, I would assume Blender also gives you a way to get a quaternion representation of a node's rotation also when it's defined with euler angles, so is there a reason to limit this?
Euler angles are very yiffy, I agree, but Blender and other modeling tools do support them, so use it to your advantage.

And again, with the same theme - I would assume Blender supports both bezier and hermite interpolations, so same question there.

This is true, but remember that there are multiple quaternion representations for each Euler rotation, and which one is correct depends on which value you are interpolating from. I think there are helper functions for calculating this, but it still means that i have to consider the next and previous frames to calculate a correct rotation, and it screws up my algorithms. Another problem, which is essentially what's behind the requirement of having the same amount of keyframes per channel, is that i don't know how to generate proper control points for bezier curves. Blender only supports Bezier interpolation - Hermite and Bezier are just different representations of the same curve, only that Hermite uses tangents while Bezier uses control points. The issue is that in Blender, a control point has two coordinates - its Y coordinate for each frame (for Bezier, this is the InTan/OutTan value of the incoming and outgoing handles respectively), but also X coordinates, which exist on the "Frame" axis, which makes for a total of 2 handle coordinates per axis... but there is no X coordinate for MDL handles, only the tangent value. It makes sense to me that the InTan and OutTan vectors would represent the 3D positions of the control points. For this reason i'm using only the Y coordinates of the keyframes, and this seems to create accurate results. however, for rotations, i've noticed that the Hermite tangents are often the exact same values as the ones in the keyframe itself, at least in a continuous rotation. For other rotations, it is some other similar value which i can't seem to wrap my head around. Like, what would be the coordinate of a control point for a 4-Dimensional sphere? The expected value for Hermite would be (Handle coordinates) - (Keyframe coordinates), for a straight tangent the value would be (0, 0, 0). But it's not.

Please support MDX as well!

I'll get to that, i chose MDL to start with since this is pretty much the first piece of Python code i've ever written, so i wanted to pick the easier option. I will have to refactor the code though so that it spits out a structured data object for the model which it sends into a file writer function of choice.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Helpers are used by most WC3 models in existence.
You can't simply remove them and expect models to work.
You can try to find actual useless ones as an optimization, but that's for later.

Animated scaling is a good reason, I didn't think about it.

Tangents/control points don't have a frame, just a value.
The fact that you see them in 2D on the graph is, well, just to allow you to see them in a meaningful way.
That is, their direction in respect to their keyframes makes visual sense, especially when you see how it changes the curve itself.
Without visually seeing them in the graph editor, all you'd have are text boxes and the curve shape, far less convenient.

If Blender only supports bezier, then I imagine you should too. I doubt there's much use in supporting hermite when the user can't see it in Blender properly.

Supporting MDX is actually easier than MDL, as is always the case with binary and text files, if you ask me. Sure, you can't easily see the data with your eyes, but at the same time all you have to do is follow the specs and read the next N bytes as it says, rather than parsing tokens, skipping white spaces and comments, etc. etc. :p
 
Well, i know that Helpers are common, but can you please explain to me then in which particular situations a bone/parent object should be converted into a helper? Should i instead of optimizing away useless bones convert them into helpers? Should bones become helpers if they have children, but no animation or geoset data?

As for tangents/control points - if the tangent X axis is just for visuals, then why does the length of the tangent change the properties of the curve? If they were of a normalized length, then i would understand, but as of now in Blender, pulling the control point on the horizontal axis will alter the properties of the curve.

Yes, binary formats are not really any harder, it's just that it's very hard to interpret the error feedback when something goes wrong, especially if you don't know all the details of the format. With MDL files, you can just compare the values you get with those of a model exported with Art Tools.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
You normally don't need to convert any nodes, it's something the user decides.
Helpers can't have vertices attached to them, so if one has vertices attached to it, it must be a bone (if we are talking about automatic fix conversions), however the fact a bone has no vertices attached to it does not mean it must always be a helper. If it also doesn't reference a geoset animation, I guess it can be converted as a form of optimization, but it's not required.
I have no idea what happens if it references a geoset that has a geoset animation referencing it. Does it affect the visibility of the bone? No idea. I could never figure out the rules of when different parts of models (nodes, geosets, layers) are visible and being processed by the game or not.
Note that when bones are invisible, any node down the chain isn't updated as a runtime optimization, in which case converting to a helper will have side effects. But what are the exact rules? who knows.
For an example of this, think about units that have internal morphs, like the Mountain King. The Avatar part is all under a bone that is visible only in the alternate animations, meaning all of the relevant nodes, geosets, emitters, etc. cost more or less nothing when Avatar isn't active.

When you move around tangents in curve graphs, you are changing their value. Again, the fact that you see them in a graphical way is to make the process intuitive. It makes a lot of sense that when you move a tangent in some direction and length, the curve around it will move in the same fashion.
If you look at the values directly, unless you're a computer, or have experience with writing manual splines, they won't really make a lot of intuitive sense, as you noted.

You are free to look at my specs/code for MDX :p
 
Last edited:
I don't really think you quite understand the issue with the curve handles here. Again, bezier keyframes in Blender have two coordinates: Frame, and Value. Consider the following curve:

Curve_1.jpg

As you can see, this particular keyframe has the value 1.75 and its left handle is also at the value 1.75. Y and Z are at 0 and 3 respectively. In other words, the sensible representation would be this:

Code:
Translation 2 {
    0: {0, 0, 0}
        InTan {0, 0, 0}
        OutTan{0, 0, 0}
    4166: {1.75, 0, 3}
        InTan {1.75, 0, 3}
        OutTan {1.75, 0, 3}
}

But then, consider the following curve:

Curve_2.jpg

The values are the same, but the handle is moved back. Notice how the shape of the curve is radically changed? The curves are clearly not identical, regardless of what you say. As for Hermite interpolation, these use the derivative of the outgoing tangent instead of the "height" of the control point. This should yield the tangents (0, 0, 0) for most keyframes, yet the most common form when exporting from Art Tools is the same as you'd get if they were exported using Bezièr interpolation. This is something which puzzles me.

Regarding helpers: Helpers can't store ANY information other than parent, visibility, and billboard properties. Yes, you could technically use a helper to control the visibility of a group, but that's really all i can think of, and having a root bone will serve the same purpose. I guess i can still implement them for that particular case, though. I can't really let the user decide, since marking something as a helper despite having a mesh skinned to it will not work.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
The graphical representation you see of tangents/control points is NOT time based. When you moved the point left, you didn't change its frame, you change its value, which in turn affects the curve. The curve itself IS time based, which is why when you stretched the control point, the curve changed such that you get different values in the same frames.
You can look at a keyframe as one structure containing a frame, a value, and (optionally) tangents/control points. The latter are not keyframes by themselves.
Indeed, this is why the MDL keyframes look how they look - the tangents are a part of the keyframe.

Helpers don't control visibility, they have translation/rotation/scaling animations.
Technically all helpers can be bones, however bones have more processing to them, thus using helpers is a simple and natural optimization.
Yes, you cannot have helpers with any vertices attached to them, that doesn't mean you need to automatically change bones/helpers in every other case! Indeed, you shouldn't, since it can have side effects, unless you add the code that checks if there are side effects.
Perhaps @Retera can chime in, since this is stuff he did for MatrixEater.
 
Last edited:
You're really starting to bug he here, GhostWolf. No, the values of the handles do NOT change when you move them, i don't know why you claim to know that they do. The handles are specified as 2D coordinates within the graph. Here is some proof:

Curve_3.jpg
Curve_4.jpg

And yes, i know perfectly well that the control points aren't actually related to frame timing, but the length of the tangent DOES affect the appearance of the curve (but not the stored value). I also know that in Blender, the X value of the control point is stored in terms of the frame number as it appears in the graph. The question is how to combine these 6 values into a handle coordinate in 3D space.
Here is a link to the Blender Python API documentation: Keyframe(bpy_struct) — Blender 2.71.6 1abcbe7 - API documentation

Regarding helpers, according to the MDL/X specification they do support animated visibility. You are right though that they also have TRS animations, i didn't realize that... then it makes a lot more sense. Any objects in the hierarchy which are animated but have no geosets attached to them should be helpers.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Your images confused me, so I googled a bit and what you are using here are fcurves, rather than bezier curves. According to an answer on stackoverflow the former is indeed based on time.
With that in mind, I have no idea how the control points are converted, my bad.
One thing I saw is at A Primer on Bézier Curves if you search for "Rational B-Splines". I won't say I know much about this subject, but it sounds fairly similar, with the ratio being the difference in time between the control point and the point itself. I may be totally off though.

For bones with no vertices attached to them, you still need to consider visibility. Refer to my reply above, I don't know exactly when bones are visible or not, and this may have side effects if you change without checking and it just happens to be a model with weird stuff.

I don't think helpers actually support visibility animations.
I know it's written in MDL specs, however no such animations are known for MDX, nor did I ever see any model with anything.
Perhaps test it for MDL and see if it works. Who knows, maybe there's a KGOV animation or something :p
 
Last edited:
@GhostWolf, can you confirm that there are models in the Warcraft MPQ which do save translation, rotation, and scale animations for helpers? Because if so, i can add helper support with little effort. I know that practically all MDL entries with an object ID has such fields specified as animatable, but for most (such as attachments and event objects), adding animation data to them won't actually have any effect.
 
Level 42
Joined
Oct 20, 2010
Messages
2,935
Hey wanna ask, this export does not support IK is it? Somehow my animation export is very wonky


Edit: Seems like it might be because I animated in Euler instead of quaternion, by any chance if there is a way to change the animation modes without reanimating the whole thing? Dammit!

=.=
 
Last edited:
There are plugins for converting Euler curves to Quaternion, though some might require a small amount of python knowledge. I am working on Euler support though, since i realize that's what people use mostly. IK not supported unless you bake it down to keyframes (and preferably do a keyframe optimization).

I have to warn you that animation support is extremely experimental and there is no guarantee that it will work out in your case. First of all, rotations don't properly support bezier interpolation, and that will look weird. To fix this, open the graph editor, select all keyframes, and go to key>interpolation mode>linear. Second, rotations in armatures don't work well with axis correction - if you want to use armature animations, make sure that the armature is pointing towards the -Y direction (Might also be +Y. You may have to apply rotation, though i'm not sure) and then in the export settings, set axis correction to X=X and Z=Z.

Overall, i'd recommend you to experiment a bit and see what works and what doesn't. Personally, i tend to do my animating by creating empties and giving them names starting with "Bone_", and parenting them to each other. This method has worked best for me and i have successfully finished a few models this way (though unfortunately this workflow does not support skinned meshes). I haven't done much animation with armatures yet, though it should kinda work (i have some test files), just let me know if you encounter any specific issues (and if so, send me the .blend file so that i can investigate).

Another thing i noticed is that mesh bounds will for some reason become weird. Perhaps because i don't write bounds in the geoset (just the global bounds). For now, you will have to open the model in magos and recalculate bounds there - a fix is coming for this.

Just a tip - in user settings, you can set default rotation mode as well as default interpolation mode. Could save you some pain in the future.
 
Level 42
Joined
Oct 20, 2010
Messages
2,935
There are plugins for converting Euler curves to Quaternion, though some might require a small amount of python knowledge. I am working on Euler support though, since i realize that's what people use mostly. IK not supported unless you bake it down to keyframes (and preferably do a keyframe optimization).

I have to warn you that animation support is extremely experimental and there is no guarantee that it will work out in your case. First of all, rotations don't properly support bezier interpolation, and that will look weird. To fix this, open the graph editor, select all keyframes, and go to key>interpolation mode>linear. Second, rotations in armatures don't work well with axis correction - if you want to use armature animations, make sure that the armature is pointing towards the -Y direction (Might also be +Y. You may have to apply rotation, though i'm not sure) and then in the export settings, set axis correction to X=X and Z=Z.

Overall, i'd recommend you to experiment a bit and see what works and what doesn't. Personally, i tend to do my animating by creating empties and giving them names starting with "Bone_", and parenting them to each other. This method has worked best for me and i have successfully finished a few models this way (though unfortunately this workflow does not support skinned meshes). I haven't done much animation with armatures yet, though it should kinda work (i have some test files), just let me know if you encounter any specific issues (and if so, send me the .blend file so that i can investigate).

Another thing i noticed is that mesh bounds will for some reason become weird. Perhaps because i don't write bounds in the geoset (just the global bounds). For now, you will have to open the model in magos and recalculate bounds there - a fix is coming for this.

Just a tip - in user settings, you can set default rotation mode as well as default interpolation mode. Could save you some pain in the future.


managed to change Euler to Quaternion after did some digging, I was using IK, no wonder the animation goes chaotic,
Do you have any tutorials or any info i can use on baking the keyframe thingy? or at least what keyword i should use to search on that?

thank you :)

experimental or not i appreciate your effort on making this addon. It brings back my motivation in warcraft modding :)


Edit: Manage to figure out how to bake that animation, but now got another problem when export, when i open the model in magos, i get an error "expected "{", got "S" in group "Bone" in "C:\SumthinSumthin\Model.mdl"

I can open the model in MDLVIS but there is no sequence and i get some MDLVIS error

Edit: Managed to "Bake" the animation
But Yeah It kinda screw up when I export
I included my .blend file, you see if it will be possible to export into .mdx
 

Attachments

  • UtherExport.blend
    3.6 MB · Views: 399
Last edited:
From inspecting the blender files i can see a couple of issues:

First of all, you are still using Bezier interpolation for the rotations - i really should disable this until it is fixed, but for now, you should just change interpolation mode of all keyframes to Linear.

Second, one requirement of the exporter is that each "channel" (X, Y, Z) of an animated property (say, rotation or position) needs to have the same amount of keyframes. So basically, if you want to keyframe the rotation at a frame, then both the X, Y, Z, and W curves need to have a key at that frame. With the baking you did (or presumably the optimization, if you did any), there are areas where frames are missing from some channels (you can see this in the Graph editor). It can be fixed by simply putting the cursor at those areas and inserting rotation or location keyframes there for those bones, though this can be tedious work. I am working on an automatic fix for this, but it might take a few weeks.

Other than that, everything seems to export fine. Perhaps you can try to save a copy of the file without animations, export it, and try an animation transfer tool to transfer some Paladin animations? The bone hierarchies should still export, i think. If not, it should be enough to add a single keyframe to each bone to make them not be optimized away. The model looks great, by the way!

EDIT: PS, one thing i noticed recently is that animating render visibility (to animate geoset visibility) is inversed. In other words, keying render visibility to "On" will result in the object being hidden in the export, and vice versa. Also something i'm working on.
 
Level 42
Joined
Oct 20, 2010
Messages
2,935
From inspecting the blender files i can see a couple of issues:

First of all, you are still using Bezier interpolation for the rotations - i really should disable this until it is fixed, but for now, you should just change interpolation mode of all keyframes to Linear.

Second, one requirement of the exporter is that each "channel" (X, Y, Z) of an animated property (say, rotation or position) needs to have the same amount of keyframes. So basically, if you want to keyframe the rotation at a frame, then both the X, Y, Z, and W curves need to have a key at that frame. With the baking you did (or presumably the optimization, if you did any), there are areas where frames are missing from some channels (you can see this in the Graph editor). It can be fixed by simply putting the cursor at those areas and inserting rotation or location keyframes there for those bones, though this can be tedious work. I am working on an automatic fix for this, but it might take a few weeks.

Other than that, everything seems to export fine. Perhaps you can try to save a copy of the file without animations, export it, and try an animation transfer tool to transfer some Paladin animations? The bone hierarchies should still export, i think. If not, it should be enough to add a single keyframe to each bone to make them not be optimized away. The model looks great, by the way!

EDIT: PS, one thing i noticed recently is that animating render visibility (to animate geoset visibility) is inversed. In other words, keying render visibility to "On" will result in the object being hidden in the export, and vice versa. Also something i'm working on.



Just curious, is “The channel having same amount of keyframe” the one that causes the model to be not working? It does succesfully export but the mdl cant be open by magos, so just wondering

I try to solve that but its just kinda too much so i guess i will be looking forward for your “automatic fix” :)
 
Just curious, is “The channel having same amount of keyframe” the one that causes the model to be not working? It does succesfully export but the mdl cant be open by magos, so just wondering

I try to solve that but its just kinda too much so i guess i will be looking forward for your “automatic fix” :)

Yeah, it is the keyframe thing. I have a fix ready though, it went faster than i thought... might be published before the end of this week if i have time.
 
Hey guys, i pushed an update recently which includes some major refactoring in anticipation of the improved animation exporting - however, nothing is changed for how animations are exported as of yet. However, there is now an extremely convenient sequence manager in the scene tab which allows you to set rarity and looping mode. Here's the readme description:

Whenever you create two timeline markers with the same name, a sequence will show up in the sequence manager tab, which is at the bottom of your scene tab in the properties menu. This is where you set 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", you will also get to set 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. Removing one of the timeline markers from a pair will remove the corresponding sequence from the sequence manager.

Another important change is that bounds are now properly written into the sequence blocks, which might help issues with unselectability. However, geosets still don't get their extents properly written, so you might still need to recalculate extents in magos as a fallback. A fix for this will come very soon.
 
It is OUT!

I just pushed the newest version which includes the new animation exporter, which will make a huge difference in the usability of this tool. The exporter now supports euler rotations, armatures export correctly, and the exporter will no longer fail when not all channels of a property are included in a keyframe. Other fixes include:

  • Animating render visibility no longer gives inverted results. You will need to redo visibility animations for previous projects of you've used this though
  • The start and end keyframe of a sequence now shows up in the sequence manager
  • Keyframes which are not part of a sequence will no longer be exported
  • Rotations now always export with linear interpolation until I can fix bezier interpolation to work correctly
  • Some more stuff which I will write tomorrow
 
Last edited:
Ah, i see what the issue is here... you have animated the hammer shaft and parented its head to the shaft. A bone is auto-created for the shaft, with "Bone_" added at the start of its name, but the head still has a reference to the original name "Cube.001_Cube.0026" and can't find it in the list of bones. I think i can add a quick fix to this, though the proper way to do it would be to create an empty object named "Bone_Mace" and parent both the shaft and the head to it. It is good practice to not animate your meshes, in case you want to change them while keeping the skeletal hierarchy.

EDIT: Managed to make it work by parenting the mace to the hand bone. It now exports correctly, and the animations look fine(-ish)!!! You might need to redo the mace animations though by doing the thing i described above (parenting it to an empty and animating the empty). There is also an issue with the book - this is because it uses its own armature, and currently, the parent of an armature is not retained by the bones it contains. The best thing would be if you were to add some new bones inside the existing armature which are not connected to the body. I think that in the future i will add it so that a root bone automatically gets created for armatures objects, so that you can use them in hierarchies.

Uploading my MDL export as well. There is some clipping and other weirdness, though i'm sure this can be fixed with some tweaking of the bone weights.
 

Attachments

  • UtherExport.blend
    3.5 MB · Views: 249
  • UtherExport.mdl
    749.5 KB · Views: 92
  • HeroUther.blp
    269.9 KB · Views: 202
Last edited:
Level 5
Joined
Mar 6, 2017
Messages
190
I know what exactly why my model is messed up
I’ll send the info later
The issues is when the distance of two bones which are linked is long,the exporter didnt animate them,that’s the problem with neodex
edit: the model only work fine when u select the bone in object editor and go to edit mode and export it
and I need a anims merge and auto name :) like altamaria script for 3ds max
@Fingolfin
 
Last edited:
Level 5
Joined
Mar 6, 2017
Messages
190
the model works now but when I export the model,some bones are messed up,see the attachment
pay attention to his head and his chest
 

Attachments

  • color.blp
    842.1 KB · Views: 192
  • eathshaker.mdl
    3.9 MB · Views: 114
  • color.dds
    170.8 KB · Views: 85
  • earthshaker.blend
    11.8 MB · Views: 96
Level 5
Joined
Mar 6, 2017
Messages
190
Like the video I attached
And I wanna summit an issue: some bone which I renamed them to something like “overhead_ref” or “overhead ref” or “Overhead_Ref” or “Overhead Ref”,when export,it changed to helper but not attachment
another issue the model become too big when export
@Fingolfin
 
Last edited:
Sorry for the late response - i checked your model out, and you are right that it doesn't export well. At the moment i don't know what is causing this behavior, but as for the file size, i just implemented a keyframe optimization feature which reduces the size of your particular file down to 900kb. Although still big, it reduces the size by 3/4 from before. When exporting, just check the box named "optimize animations" and set the threshold value to something low, like 0.01 or even 0.005.

This is also very useful for resampled IK animations, so i guess it can be of interest to @Hayate as well. I haven't had much chance to test it, so let me know how it works. There are some further information and caveats listed in the github readme.

EDIT:

Like the video I attached
And I wanna summit an issue: some bone which I renamed them to something like “overhead_ref” or “overhead ref” or “Overhead_Ref” or “Overhead Ref”,when export,it changed to helper but not attachment
another issue the model become too big when export

Did you try to use armature bones as attachment points? Sorry, but this is not possible. Armature bones can only be bones or helpers. What you need to do is to create empty objects and name them something like "Overhead Ref", select your armature and switch to "Pose Mode", select your empty again, then shift-select the bone you want an attachment for and press CTRL+P. Choose "parent to bone". It should work.
 
Last edited:
Level 5
Joined
Mar 6, 2017
Messages
190
I edited it by hand =) but thank for your reply,I've waited so long
edit:the value 0.025 for the scale is the right scale =)
I don't think the reduce frame is the best way to reduce size of models
I think like neodex,you can just animate models by the "rotation",the models will more lighter
 
Last edited:
Level 20
Joined
Apr 12, 2018
Messages
494
Obviously you're under no obligation to make any allowances for this, but I just thought I'd throw this out there because this is what I've been doing with the plugin.

I've been looking into ways to get animations from M3 models through Blender and while my Blender-fu is terrible my preliminary attempts to get even one animation track exported using this plugin ends in failure. I would assume that's just a natural function of the m3 addon and this addon handling animations differently. Currently the only way to get the animations intact is with 3DS Max (whatever version)

Anything other than that usually transfers correctly (especially the bones with their names intact) except for the particles (which are mostly not compatible downgrading anyway) and the attachments (all of them are turned into helpers) for obvious reasons. This is usually more important that porting the animations anyway.
 
Level 20
Joined
Apr 12, 2018
Messages
494
You can send me a blend file and I can have a look at how it works.
This is the version of the m3 addon I'm using: Talv/m3addon

The attachment is a straight import of the Starcraft 2 Apocalisk using the above (just the mesh).

The way the addon seems to handle model + animation file seems to be slightly different than models that come with animations, but that's a different issue and can be gotten around using the XML converter.
 

Attachments

  • test-apocalisk.zip
    6.8 MB · Views: 201
Level 5
Joined
Mar 6, 2017
Messages
190
sorry,here is the problem
You can see there is 4 meshes parented to an amateur but when export,there only one mesh at all
 

Attachments

  • untitled.mdl
    500.3 KB · Views: 113
  • untitled.blend
    1.1 MB · Views: 173
Last edited:
Top