• 🏆 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!

Exporting models from Blender using the MDL exporter plugin

Level 5
Joined
Mar 6, 2017
Messages
190
Wow.. that is an actual typo, i have no idea how that hasn't been noticed. Sorry, will fix ASAP!

A temp fix would be to go into the classes.py file, search for "obh.parent", and replace it with "obj.parent", and then zip/install/restart blender again.
I notice that my post about smooth group was deleted, anyway, why my model has no smooth group when experted? the model look weird
 
Wow.. that is an actual typo, i have no idea how that hasn't been noticed. Sorry, will fix ASAP!

A temp fix would be to go into the classes.py file, search for "obh.parent", and replace it with "obj.parent", and then zip/install/restart blender again.
Ok, thanks

Hm, changed things like you said, but seems that not helped a lot...
2XF6ziLi9Rs.jpg

Hope you will be able to fix this trouble soon, because there is only one of such exporter for Blender i know...
 

Attachments

  • Blender Error(2).jpg
    Blender Error(2).jpg
    59.1 KB · Views: 78
Last edited:
I notice that my post about smooth group was deleted, anyway, why my model has no smooth group when experted? the model look weird

Sorry, i will take a look at this too! Did you check the "auto smooth" box on all the meshes?

Ok, thanks

Hm, changed things like you said, but seems that not helped a lot...
2XF6ziLi9Rs.jpg

Hope you will be able to fix this trouble soon, because there is only one of such exporter for Blender i know...

I will take a look at it. Please PM the blend file to me.
 
Ping @Fingolfin

Hi! I import FBX model to a Blender, it have separate meshes (like separated hand, separated cloack, etc.). So actually there are 10 separated meshes. But, once i export model via MDL Plugin, all those meshes become one single mesh in the finish of exporting operation. I.e. there are all meshes becomes one geoset.. And that is actually a trouble, because, my model is really big, and if that will have all her meshes in one geoeset it will give a screthy bug. So, how i can set up or disable that feature that conneting all meshes in single one?

Also, how i can set up Bezier or Hermite animation interpolation instead of the Linear interpolation?

Thank you.
 
Level 16
Joined
Jan 18, 2009
Messages
253
Ping @Fingolfin

Hi! I import FBX model to a Blender, it have separate meshes (like separated hand, separated cloack, etc.). So actually there are 10 separated meshes. But, once i export model via MDL Plugin, all those meshes become one single mesh in the finish of exporting operation. I.e. there are all meshes becomes one geoset.. And that is actually a trouble, because, my model is really big, and if that will have all her meshes in one geoeset it will give a screthy bug. So, how i can set up or disable that feature that conneting all meshes in single one?

Also, how i can set up Bezier or Hermite animation interpolation instead of the Linear interpolation?

Thank you.


Create materials for each geoset, and is going to work :)
 
I managed to do this once using another plugin that does mdl import. I think it was this one, but it might also have been this one. It's possible that these plugins require Blender 2.79, but you can import it in 2.79 and then open the file in 2.8+ and export it with this plugin. Imported war3 models are often split based on bone groups though and you'd need a bit of manual work to have them export nicely again (my plugin needs a skin modifier to export skinned meshes).
 
Level 7
Joined
Feb 9, 2021
Messages
301
I managed to do this once using another plugin that does mdl import. I think it was this one, but it might also have been this one. It's possible that these plugins require Blender 2.79, but you can import it in 2.79 and then open the file in 2.8+ and export it with this plugin. Imported war3 models are often split based on bone groups though and you'd need a bit of manual work to have them export nicely again (my plugin needs a skin modifier to export skinned meshes).
Thanks, I will try this. A quick follow-up question. So, I have a warcraft3 model, which is in MDX format. I convert it to MDL, using Mdlx Converter. Then, I am trying to add it into the blender, and it says "invalid mdl signature". I tried both: GitHub - seedhartha/kotorblender: Blender 2.8+ add-on to import & export KotOR models and GitHub - victorfeitosa/quake-hexen2-mdl-export-import: Blender Quake and Hexen II MDL Import/Export. Alternatively, I tried a method by this guy
, who uses Crowbar to decompile the model, and I also have an error there "File does not have expected MDL header ID (first 4 bytes of file) of 'IDST' or 'MDLZ' (without quotes). MDL file is not a GoldSource- or Source-engine MDL file. ... Decompiling "mopao-yellow.mdl" FAILED." It would be amazing if you could help me, please

P.S. I tried other models as well
 
The problem is that those are both importers for different MDL formats. There is no central authority deciding what files should use what extensions, and in this case, a lot of developers have decided that MDL is a good name for a model format (in this case Quake and Knights of the Old Republic).
 
Level 7
Joined
Feb 9, 2021
Messages
301
Thanks. Are you planning to add support for other interpolations? It would be amazing.

Great work and thank you for making this plugin happen.

Edit: I am also wondering wouldn't it be better to have animations as actions? Having them in one timeline seems just an inferior solution. Having them in action is safer (fewer chances to mess all the animations while doing one), easier to filter through animations, and easier to review (you can just press space to see the animation instead of dragging with the mouse all the time to see the one you need). Moreover, it seems like all other 3d characters in a blender have them as actions, so this would mean that the user has to copy and paste all the animations on one timeline.

Edit2: I made a simple model and tried to export it, but it does not work for me. Can you help me, please? I attached my file. It is probably something trivial because I am just starting out in modelling.
1645024346324.png



Edit3: I managed to export the model. I had to transform my curve to mash. Everything seems to work fine. Only color of the model, its position and animation of change in alpha did not transfer. I think I will find the answer by re-reading the instructions.
 
Last edited:
Actually yes, i really should switch to using actions. The reason it's done this way is because that how things were handled in the original WC3 art tools for 3ds Max, and when i started working on this plugin, i hadn't worked much with actions. I was afraid that people would forget to set fake user for their actions and lose them, which is easily done. But yes, it is definitely a superior solution.

Regarding interpolation - i do support bezier interpolation for position and scale, but not for rotation. This is because rotation is based on quaternions, and those don't interpolate in quite the same way. Just exporting them as bezier gives funky-looking results though and doesn't work.

Regarding the alpha - the reason it's not working is because you're not animating in the right place. Basically, Warcraft 3 handles materials very differently from blender, so for that reason, i'm using an extra section in the material panel called "MDL Material Settings". There, you need to add a new material layer, set its filter mode to "blend", and then you need to animate the "alpha" field that appears. You'll also need a texture (or it will default to white.blp), or you can animate vertex colors (this is also done in a special way, i think there migth be instructions somewhere in the tutorial or on the github page).
 
Level 7
Joined
Feb 9, 2021
Messages
301
Actually yes, i really should switch to using actions. The reason it's done this way is because that how things were handled in the original WC3 art tools for 3ds Max, and when i started working on this plugin, i hadn't worked much with actions. I was afraid that people would forget to set fake user for their actions and lose them, which is easily done. But yes, it is definitely a superior solution.

Regarding interpolation - i do support bezier interpolation for position and scale, but not for rotation. This is because rotation is based on quaternions, and those don't interpolate in quite the same way. Just exporting them as bezier gives funky-looking results though and doesn't work.

Regarding the alpha - the reason it's not working is because you're not animating in the right place. Basically, Warcraft 3 handles materials very differently from blender, so for that reason, i'm using an extra section in the material panel called "MDL Material Settings". There, you need to add a new material layer, set its filter mode to "blend", and then you need to animate the "alpha" field that appears. You'll also need a texture (or it will default to white.blp), or you can animate vertex colors (this is also done in a special way, i think there migth be instructions somewhere in the tutorial or on the github page).
Thank you for your explanations.

Sorry for probably stupid questions, but:
1. Does this mean that any model created in blender needs to have a blp file (for colour)?
2. How do I make model wight less? It is quite a simple model, but it wights 250kb
3. In blender, my model base position is Rotation at 90 degrees and Location Z is 1m, but in WC3 both become 0. How do I fix it?
4. How should I approach transferring the glowing effect to war3?
5. Does it support shape-shifting animation ?
 
Last edited:
1: No, but you might need your material to point to a texture within the Warcraft MPQ. Programs like Magos War3 Model Editor allow you to browse files in the MPQ's, so you can see if you can find one that works for you. Then, you use the search function in the MDL material editor to find its path. Having a texture is required by the warcraft engine IIRC.

2: If it has a lot of polygons, you can try reducing them as best as you can. This is probably the issue in your case, since your animation is very simple. Also, convert your model from MDL to MDX using the MDLX tool - it will convert it to binary, which is more lightweight.

3: It is possible that you moved it through animation. The exporter uses the pose at keyframe 0 as the root pose (this is again a quirk of how Warcraft works, i'm looking to fix it eventually). Try setting a keyframe for rotation and location at keyframe 0 and see if that helps. Try sending the blend file again and i can look.

4: Use a plane that faces forward, give it a material with "Additive" filter mode and a simple texture like GenericGlow64.blp (try searching for it in the "path" field), and set it to billboard (there should be instructions on this in the readme). You can then use vertex animation to give it a color (this is done through the viewport settings color field, it's mentioned in the tutorial)

5: Nope! Morph targets are not supported by Warcraft, it's too old.
 
Level 7
Joined
Feb 9, 2021
Messages
301
1: No, but you might need your material to point to a texture within the Warcraft MPQ. Programs like Magos War3 Model Editor allow you to browse files in the MPQ's, so you can see if you can find one that works for you. Then, you use the search function in the MDL material editor to find its path. Having a texture is required by the warcraft engine IIRC.

2: If it has a lot of polygons, you can try reducing them as best as you can. This is probably the issue in your case, since your animation is very simple. Also, convert your model from MDL to MDX using the MDLX tool - it will convert it to binary, which is more lightweight.

3: It is possible that you moved it through animation. The exporter uses the pose at keyframe 0 as the root pose (this is again a quirk of how Warcraft works, i'm looking to fix it eventually). Try setting a keyframe for rotation and location at keyframe 0 and see if that helps. Try sending the blend file again and i can look.

4: Use a plane that faces forward, give it a material with "Additive" filter mode and a simple texture like GenericGlow64.blp (try searching for it in the "path" field), and set it to billboard (there should be instructions on this in the readme). You can then use vertex animation to give it a color (this is done through the viewport settings color field, it's mentioned in the tutorial)

5: Nope! Morph targets are not supported by Warcraft, it's too old.
I see, thank you. I read your instructions a couple of times. I managed to reduce the size and add texture. However, it just doesn't fix the root pose correctly. Also, the alpha animation is not working. Can you take a look, please?

So, in terms of shape forming. Does this mean I can't do an animation that transforms a part of the model from a straight line to, for example, a zig-zag?

Edit: can it be because I have no bones?

Edit2: after re reading your github again, I just can't grasp how materials work with your exporter. Is it complety useless to make them in blender since they can't be transfered anyway? How more complex colouring can be applied? For example, for a charachter model. How textures are applied to a particular part of the model?

In my simple model (fully black) , I imported a picture from the Internet with black colour to make it a texture. Is it correct approach?

Sorry for so many questions
 

Attachments

  • effect_soifong_suzu_mark_death_texture.blp
    282.5 KB · Views: 24
  • suz_mark_save.blend
    978.3 KB · Views: 19
Last edited:
Yes, you can make it change shape using a bone animation if you have a skinned mesh. It's not as flexible as morph targets, but you can still do a lot of cool effects. One thing to keep in mind though is that Warcraft doesn't support bone weights in quite the same way - multiple bones can influence the same vertex, but they will have the same weight.

Regarding materials, you are right - there used to be a system for trying to generate warcraft materials from Blender's shader graph, but i found that it's easier to just learn how materials work in Warcraft and have a separate editor that is tailored for that. So yes, whatever is in your shader graph will not be exported, only the data in the MDL material editor.

How textures are applied to a particular part of the model?

The same as in any model - you perform UV unwrapping.
The workflow i typically use is to extract a texture from WC3 (unless i'm making my own), and i set it as a texture in the blender shader - just so i can see how it looks. Then i do unwrapping like usual (using the texture in the UV editor), and i create a MDL material layer with its "path" value set either to the path inside the MPQ (if you are using an ingame texture), or the path you plan to import the texture as in the editor (usually just textureName.blp).

I will look at your model later today once i'm done with work.
 
Level 7
Joined
Feb 9, 2021
Messages
301
Yes, you can make it change shape using a bone animation if you have a skinned mesh. It's not as flexible as morph targets, but you can still do a lot of cool effects. One thing to keep in mind though is that Warcraft doesn't support bone weights in quite the same way - multiple bones can influence the same vertex, but they will have the same weight.

Regarding materials, you are right - there used to be a system for trying to generate warcraft materials from Blender's shader graph, but i found that it's easier to just learn how materials work in Warcraft and have a separate editor that is tailored for that. So yes, whatever is in your shader graph will not be exported, only the data in the MDL material editor.



The same as in any model - you perform UV unwrapping.
The workflow i typically use is to extract a texture from WC3 (unless i'm making my own), and i set it as a texture in the blender shader - just so i can see how it looks. Then i do unwrapping like usual (using the texture in the UV editor), and i create a MDL material layer with its "path" value set either to the path inside the MPQ (if you are using an ingame texture), or the path you plan to import the texture as in the editor (usually just textureName.blp).

I will look at your model later today once i'm done with work.
Edit: forget about it, I will figure it out. Just check my suz model, please

Edit2: how can I go about creating objects, in which it is possible to see inside it? (I attached an example). When I try to export it with two-shaded, I get black trinagles? Other filters (like additive alpha) change the colour of the texture.

Edit 3 (19/03) Fingolfin , I just wanted to say that I solved all previous problems.
 

Attachments

  • 1645818164843.png
    1645818164843.png
    1.2 MB · Views: 31
  • 1645818209579.png
    1645818209579.png
    982.4 KB · Views: 22
  • Ch1_Ch3_base_human.blend
    1.3 MB · Views: 20
Last edited:
Billboarding is currently only supported for non-armature bones (objects that start with the name Bone_, typically an empty object), as well as attachments and lights. I'll make it so that it works for armature bones too. But in your case, just create an empty object, name it "Bone_Root" or something, and parent your plane to it. The billboarding options should appear.
 
Level 10
Joined
May 31, 2019
Messages
139
This plugin throws a big error msg when importing. I'm trying to import Arthas.mdl. I have his textures converted to png in the same folder as the mdl.
mdl import error.png


Using 2.83.20. Although I have also tried 2.80 with the same result.


Twilac's imports the model without displaying an error message, but he doesn't quite look as good as the image in the above post, so I'd like to try getting this plugin to work if possible.

io_scene_warcraft_3 arthas test.png
 
That's strange, i just tested it with an Arthas.mdl model exported from War3 Model Editor, and it imports fine for me. But then again, i haven't ujpdated my Warcraft version since Reforged, so i don't have any models with the new MDL 900 format. Do you think you can send me yours? Also, could you send the whole error message? Right now the left side is cropped off.
 

Attachments

  • Arthas.mdl
    930.4 KB · Views: 15
  • Arthas.png
    Arthas.png
    1.3 MB · Views: 27
  • Arthas.blend
    2.4 MB · Views: 14
Level 10
Joined
May 31, 2019
Messages
139
Oh, I extracted from the 1.28 War3.mpq ran it through this converter to get the mdl. I tried again using Magos' and this time it imported without displaying an error. So I guess that tool may break some models.

If you're curious, here's the full error from the previous attempt.
mdl import error.png

Although that error doesn't appear anymore, instead there's other weirdness going on, can't seem to get either my import or your Arthas.blender to look like your screenshot.

my_arthas_import_test.png

I thought it might have to do with the ReplaceableTextures for TeamColor and TeamGlow, so I edited the .mdl to point to TeamColor01 and TeamGlow01 instead of those replaceable textures, and it made the 'Missing Textures' warning go away, but it still doesn't look right.

my_arthas_import_test_teamcolor.png

Also, his textures only show up while looking at the Texture Paint tab, not any other way. Not familiar enough with Blender (literally never used it before trying this :p) to know if this is expected behavior. When I import your attachment though, his textures don't show up in any way.

fingolfin_arthas_import_test.png
 
First, before you import any files, you should delete everything in your scene so that you get rid of the default cube. And secondly, i think the problem is that your renderer is set to "cycles", try changing it to "EEVEE" and it should render correctly - you can do that from the "Render Properties" tab.

The reason my blend file looks pink to you is because i did not pack the textures with the file... so it can't find them. I just wanted to show that it will import. You can actually make it work by going through the materials and re-selecting the textures from their nodes in the shader edtor.

If it still doesn't work, try sending me your blend file.
 
Level 3
Joined
Apr 17, 2017
Messages
29
I exported and converted different models (with War3viewer and mldx) and tried to import the mdl into different versions of Blender (2.83, 2.9, 3, 3.1) But I always get an error like in the attachment (this one is from Blender 2.83). Nothing works
 

Attachments

  • Unttitled.png
    Unttitled.png
    124.8 KB · Views: 28
Last edited:
Level 3
Joined
Apr 17, 2017
Messages
29
Sure, thanks for your time.
In the attachment is the Jaina mdl file. It has been extracted from a Warcraft 3 1.26 mpq with Warcraft 3 Viewer and converted with mdlx.
Edit: Nevermind. I just read the post by PiesOfNorth. I downloaded and used Magos Model Editor and used it to convert the mdx into mdl (instead of mdlx).
But there seem to be animation issues, no ? For example, I imported the DiabloCar. In the walk animation the wheels are rotating around the y-axis instead of the x-axis. See attachment. Blender version: 3.1.2
I also imported the standard Paladin. E.g. the death animation appears also to be a bit off.
 

Attachments

  • Jaina.mdl
    466.4 KB · Views: 14
  • DiabloCar.blend
    4.5 MB · Views: 9
Last edited:
Level 3
Joined
Jul 5, 2022
Messages
16
I'm very new to modelling. Is this tutorial still relevant as I cannot seem to make it work? I export the .mdl file from Blender and try to import it in Retera's Model Studio and I get thrown multiple errors. When I try to import it straight into game and assign the model to a unit and I create the unit on the map, it just won't do anything. What could I be doing wrong?

I converted the .mdl file to mdx, now it can be oppened in RMS, but I have blank view even though the camera is poiting at the model directly. I can see the model in edit tab. In the game the model still doesn't appear.
 
Last edited:
I'm very new to modelling. Is this tutorial still relevant as I cannot seem to make it work? I export the .mdl file from Blender and try to import it in Retera's Model Studio and I get thrown multiple errors. When I try to import it straight into game and assign the model to a unit and I create the unit on the map, it just won't do anything. What could I be doing wrong?

I converted the .mdl file to mdx, now it can be oppened in RMS, but I have blank view even though the camera is poiting at the model directly. I can see the model in edit tab. In the game the model still doesn't appear.
Hello, can you share the error from RMS, the version of RMS you're using, and the model you exported from blender (if that's okay for you)?
 
Level 3
Joined
Jul 5, 2022
Messages
16
Hello, can you share the error from RMS, the version of RMS you're using, and the model you exported from blender (if that's okay for you)?
Hello! Sure!

I'm using Retera's Model Studio version 4.4m. I'm attaching the errors I'm getting and a .mdl exported from Blender.
 

Attachments

  • error2.png
    error2.png
    3.1 KB · Views: 7
  • error3.png
    error3.png
    3.1 KB · Views: 8
  • error4.png
    error4.png
    3.1 KB · Views: 6
  • error5.png
    error5.png
    3.3 KB · Views: 7
  • error6.png
    error6.png
    3.1 KB · Views: 7
  • error7.png
    error7.png
    73.5 KB · Views: 8
  • error8.png
    error8.png
    74.1 KB · Views: 8
  • Včela menší.mdl
    1.3 MB · Views: 5
  • error1.png
    error1.png
    3.1 KB · Views: 8
Hello! Sure!

I'm using Retera's Model Studio version 4.4m. I'm attaching the errors I'm getting and a .mdl exported from Blender.
I don't know which language contains those accents : č, š, í, ž, á
Try to :
-Remove those letters from the file name (fbx file I guess?) before importing in blender
-Rename the texture file (in this case, žlutá to zluta or w/e you want)
-In blender, change the material texture file to the one you renamed (zluta)

The model editors (RMS, Magos, MDLvis) cannot read the mdl file if it has those characters with accents, they aren't "Latin" letter.
 
Level 3
Joined
Jul 5, 2022
Messages
16
I don't know which language contains those accents : č, š, í, ž, á
Try to :
-Remove those letters from the file name (fbx file I guess?) before importing in blender
-Rename the texture file (in this case, žlutá to zluta or w/e you want)
-In blender, change the material texture file to the one you renamed (zluta)

The model editors (RMS, Magos, MDLvis) cannot read the mdl file if it has those characters with accents, they aren't "Latin" letter.
Oh I should've known... rookie mistake. Thank you! Alright so I did rename the files, textures etc. The .mdl file still throws errors BUT when I convert it into .mdx with MdlxConv it kind of works. Except the texture is..."over lit"?...I'm attaching a screenshot. I also tried to remove the light from blender if that may cause the issue with no effect. Do I have some funky setting enabled that causes this or it could be the MdlxCovn?
 

Attachments

  • 1686398396573.png
    1686398396573.png
    19.2 KB · Views: 4
Oh I should've known... rookie mistake. Thank you! Alright so I did rename the files, textures etc. The .mdl file still throws errors BUT when I convert it into .mdx with MdlxConv it kind of works. Except the texture is..."over lit"?...I'm attaching a screenshot. I also tried to remove the light from blender if that may cause the issue with no effect. Do I have some funky setting enabled that causes this or it could be the MdlxCovn?
Can you share the mdx file and the texture?
 
Level 3
Joined
Jul 5, 2022
Messages
16
You have to change the material filter mode from "Additive" to "None", I only know to do this in magos editor :

View attachment 436692
Great! I changed this setting in Blender to Opaque and works like a charm... You're helping me a ton and I wanna thank you for that! But now that I have a somewhat functional model, I have a new issue that I don't know if it's siutable to be discussed here. I want to add into the game. So I created a test map. In object editor, I copy the Sheep unit and assign it this model. The model shows textureless in the map editor and when I get into the game it's invisible or what, I can't see it. Any ideas on what is happening here?
 

Attachments

  • texturless bee.png
    texturless bee.png
    179.8 KB · Views: 4
Level 3
Joined
Jul 5, 2022
Messages
16
Your mdx model has the following path for the texture: "Textures\zluta.blp", which means when you import the texture file in the world editor, you have to put the same path as "File name"

View attachment 436697
Aaaaah that makes sense! It works! You're a god! Thank you so much, I've learned a lot from you. I guess that's all from me, I can hopefully continue my journey on my own now. Thanks a lot!
 
Top