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

Blender 2.83+ MDL/MDX importer/exporter

Level 10
Joined
Nov 9, 2020
Messages
23
Some updates! 16/06/23
I've forked khalv/mdl-exporter, updated it for Blender 3.4 and merged the importer into that project:
tw1lac/mdl-exporter/tree/3.4
(it seems to work fine for 2.93 as well)

Features:
  • Importing:
    • Supports v800 (ofc)
    • Supports v1000 (SkinWeights/HD material)
    • Supports v1100 (except for materials)
  • Exporting:
    • Can export SkinWeights (Will export the model as v1000)
    • Can export sequences from Actions
    • Will bake IK (note that this is a slow process; I've added console prints for what node is being processes)
    • Will try to fetch textures from material nodes if the "MDL Material Settings" is empty

After scouring the interwebs for a wc3-model importer I found 3 but no one was really working
So I took PavelBlend's mdx-importer and fixed it. Now it won't throw an exception and stop importing the model if it can't find the correct texture file. I also made it not ignore setting parent for bones when the parentID is 0.
And then I ported it to Blender 2.83 and I added support for importing mdl-files.

tw1lac/Blender_WarCraft-3

To export, I suggest using:
khalv/mdl-exporter
Just make sure to have a marker in both ends of an animation sequence (same tag/name on both)

Update:
Packed the addon into a zip and made a visual installation guide:
mdl/mdx importer for Blender 2.8+
Now looks for textures in file_location and file_location/textures in addition to the resource folders
Can now parse skin weights!
To make it easier to export with the tool mentioned above I have added an action with all animations, and markers to match!
Changed some texts to say "Warcraft 3 (.mdl/.mdx)" instead of just .mdx
Fixed some issues I found when importing mdl-files
zip files and installation guide:
mdl/mdx importer for Blender 2.8+
 
Last edited:
Level 10
Joined
Nov 9, 2020
Messages
23
Can't find the export option either

Also I've added some most basic support to reforged (v1000) format reading on my fork, only to the point of being able to parse v1000 files without erroring, sadly haven't incorporated any of the new data

You are welcome to create a pull request :wthumbsup:

could ya make a tutorial for this?
edit: I cant find the export option ...

Unfortunately this addon does not hav an export option, the feature mentioned makes it easier to export with khalv/mdl-exporter.
I have thought about maybe merging the two, but I started poking around in Reteras Model Editor and haven't gotten back to messing with the blender addons ^.^*

The feature is the "all sequences" action.
upload_2020-11-21_20-9-30.png
The reason this is kinda "a big deal" is because it's hard to merge the actions together on the same timeline, and the khalv-exporter uses the (active) timeline:
"This approach was chosen over using acitons because it was deemed to be more intuitive and similar to how the process works in Wc3 Art Tools."
There's an old tutorial for the exporter up here already:
Exporting models from Blender using the MDL exporter plugin
 
Level 10
Joined
Nov 9, 2020
Messages
23
I believe khalv's has a wrong export scale, the model exported seem bigger than expected
There's an option to change the scale and forward direction in the upper right corner in the export dialog. The default scale was set to 60 and the direction to -X. 1 and X seems to work for me,
upload_2020-11-23_14-45-17.png


If you want to have the default values fixed you could try my fork:
tw1lac/mdl-exporter (drop the "export_mdl" folder in your addon folder)
 
Level 5
Joined
Mar 6, 2017
Messages
190
There's an option to change the scale and forward direction in the upper right corner in the export dialog. The default scale was set to 60 and the direction to -X. 1 and X seems to work for me,
View attachment 368662

If you want to have the default values fixed you could try my fork:
tw1lac/mdl-exporter (drop the "export_mdl" folder in your addon folder)
could you support the exporter to export by action instead of marking? it's really slow...
 
Level 2
Joined
Dec 25, 2012
Messages
13
Hey, great work you did there!
I noticed something odd though. I tried to import models into Blender I downloaded from Hive to take a look and am quite often getting errors.
Can I open issues about this on the Github?
 
Level 1
Joined
Dec 9, 2020
Messages
1
This is awesome!! I can't get spell effects like the Archmage's team glow on his staff to animate correctly or have a transparent alpha. Changing HeroArchMage.002 Blend Mode to Alpha Clip didn't work like it does for the other non spell textures.

Edit: I figure it's not having the right nodes setup in the shading workspace for team color and spell effects. Sorry for my ignorance, but I'm having a lot of fun. Thank you!
 
Last edited:
Level 4
Joined
Apr 27, 2021
Messages
52
Its a clever idea to make mdl importer for blender.
This is a useful tool, I will give you reaction points for the effort
 
Level 4
Joined
Oct 16, 2020
Messages
15
@BogdanW3 thank you, didnt see that, it seems to works fine i think, also i needed to find the one that works, is this one if someone is wondering Screenshot Screenshot. Not all models with .mdx format seems to import into blender, for example i can import Zombie.mdx just fine Screenshot, but i cant import HeroFlameLord.mdx, this error shows up Screenshot, but i can import it if i change it to HeroFlameLord.mdl Screenshot
Just pointing it out
 
Last edited:
Level 17
Joined
Feb 25, 2013
Messages
303
@BogdanW3 thank you, didnt see that, it seems to works fine i think, also i needed to find the one that works, is this one if someone is wondering Screenshot Screenshot. Not all models with .mdx format seems to import into blender, for example i can import Zombie.mdx just fine Screenshot, but i cant import HeroFlameLord.mdx, this error shows up Screenshot, but i can import it if i change it to HeroFlameLord.mdl Screenshot
Just pointing it out
Also about this, I have just tested both the SD and the HD HeroFlameLord models and neither throws errors during import, the error you had was pertaining to hero glow to some extent, so maybe make sure you have the hero glow textures in the correct places in your configured asset path.
 
Level 17
Joined
Feb 25, 2013
Messages
303
I imported the model, and there seems to be no aramtrue bones or animations in the dope sheet. Also, the texture from the folder did not apply.
If you read my message better, you'll see I said the "action editor" part of the dope sheet window. As for the textures, I don't remember if we changed logic for them completely, but I just give it my HD CASC root folder, my SD CASC root folder, and "dds" for the extension and all works. I may be running on one more patch than the main Twilac's branch has though (which changes texture extension substitution, the branch on my fork for that is called "paths"). You could give it a try.
 
Last edited:
Level 7
Joined
Feb 9, 2021
Messages
301
If you read my message better, you'll see I said the "action editor" part of the dope sheet window. As for the textures, I don't remember if we changed logic for them completely, but I just give it my HD CASC root folder, my SD CASC root folder, and "dds" for the extension and all works. I may be running on one more patch than the main Twilac's branch has though (which changes texture extension substitution, the branch on my fork for that is called "paths"). You could give it a try.
Sorry, my bad. Also, can you please elaborate on the texture part in the beginner language, please?
 
Level 7
Joined
Feb 9, 2021
Messages
301
Beginner language includes loads of red arrows, right? :peasant-tongue-out:
View attachment 395548

But to not go too unserious, you will probably have better success just hooking up textures manually if the auto-loading doesn't work for you.
Just to be clear. I need to create CASC Viewer folder and put all my models and textures there? Then make a path in blender and put dds extension to "image extension". Is this correct?

It seems that the folder name does not really matter. It is just all about dds extension, right?

Edit: I think I got it. It didn;t work. Thanks anyway. I will just apply it manually
1645359687642.png
 
Level 17
Joined
Feb 25, 2013
Messages
303
My setup is for loading models that use only the game's textures, with the Casc Viewer/Work folder being where I extracted all my Warcraft 3 files. If your models use none of the game files, you can completely disregard all of my text in there, and just input any 2 folders you place your textures in. If your models use only SD game files, you can input the folder where you store your custom assets instead of the HD folder, then just supply the SD CASC root for the second one. And if you use any HD textures from the game, you will probably want to place your custom textures into the HD root you extracted to best mimic how War3 will load them with just these two folders.
The extension here is most important, but not necessarily dds, use the extension your textures use if it's not dds, but also note that if it's not dds and you're using 1.32 data, the ingame textures will once again fail to get automatically recognised.
 
Level 7
Joined
Feb 9, 2021
Messages
301
My setup is for loading models that use only the game's textures, with the Casc Viewer/Work folder being where I extracted all my Warcraft 3 files. If your models use none of the game files, you can completely disregard all of my text in there, and just input any 2 folders you place your textures in. If your models use only SD game files, you can input the folder where you store your custom assets instead of the HD folder, then just supply the SD CASC root for the second one. The extension here is most important, but not necessarily dds, use the extension your textures use if it's not dds, but also note that if it's not dds and you're using 1.32 data (or not blp and you're using pre-32 data), the ingame textures will once again fail to get automatically recognised.
I think the problem is that I need to convert blp into png. I just assumed that it works with blp files.
 
Level 7
Joined
Feb 9, 2021
Messages
301
That is also a good point, blender has no idea what blp is meant to be as it's not a real format outside of Blizzard games, that's why the default extension for the plugin is png, it assumes you'll be converting to png.
Thanks for your help, it worked now. Sorry, I just started with modeling a couple of days ago : ) Was so happy that I could do everything blender, but, in the end, it is necessary to make a lot of adjustments for war3. Do you mind if I ask one more question, please? How to move these bones? I worked only with armature animations before.
 
Level 17
Joined
Feb 25, 2013
Messages
303
That is a general blender question, but Warcraft 3 only makes it the more confusing. To edit bones, you'd select the armature then go into edit mode. Note that in Warcraft 3 bones do not have a length so their endpoints are mostly irrelevant. To instead pose the armature, you'd go into pose mode and make adjustments then save them as keyframes. Google should help on more precise stuff there, the main War3 specifics are that bones have no length and all the data the mdl exporter's github page has as it's the thing you're exporting with
 
Level 7
Joined
Feb 9, 2021
Messages
301
That is a general blender question, but Warcraft 3 only makes it the more confusing. To edit bones, you'd select the armature then go into edit mode. Note that in Warcraft 3 bones do not have a length so their endpoints are mostly irrelevant. To instead pose the armature, you'd go into pose mode and make adjustments then save them as keyframes. Google should help on more precise stuff there, the main War3 specifics are that bones have no length and all the data the mdl exporter's github page has as it's the thing you're exporting with
I understand how the animation of bones works. However, what I am saying is that I can't move these bones. In pose mode, if I use G, then I move the bone to another place. Bones are also as some lines instead of normal bones (I guess this is what you referred to).

Edit: figured it out
 
Last edited:
Level 17
Joined
Feb 25, 2013
Messages
303
Does this work for 3.0? Getting an error about missing the module export_mdL
I've been using it with 3.0 for a while, even 3.1 now. Export_mdl isn't even the same project :p
This is only an importer (unless you went to the heavily WIP branch "it_might_get_an_exporter").
Make sure you go to the 2.8 branch of github if you're downloading from there (preferred), or just download the zip from the main post otherwise.
For your exporting needs, use Twilac's fork of mdl_exporter instead.
 
Level 17
Joined
Feb 25, 2013
Messages
303
I just realized the animation imports are cursed. The bones all facing one direction and are disconnected form the mesh. I see other posting about it. I'll keep watching this post to see if theres an update/fix.
Bones in MDX have neither length nor initial orientation, so that's the best that could be done. Thankfully the way they look doesn't affect too much.

Being disconnected, though, if it means none of them are moving the mesh, could be a real issue, so make sure you're using the latest version from Github and more details might help as well: Blender version, HD/SD model, if SD then v800/v1000, MDX/MDL (MDX support I can guarantee more than MDL).

I had forgot to update to the latest github version, and this has indeed broken...
 
Last edited:
Bones in MDX have neither length nor initial orientation. You will have to make do :p

Being disconnected, though, if it means none of them are moving the mesh, could be a real issue, so make sure you're using the latest version from Github and more details might help as well: Blender version, HD/SD model, if SD then v800/v1000, MDX/MDL (MDX support I can guarantee more than MDL)
has anyone on hive actually devised a way of transposing animations from blender on MDL/MDX style bones for animations in HD? I think it use to work for older versions of classic models. Say I make the bones animated separate from the mesh then add that data to a model somehow?
 
Level 17
Joined
Feb 25, 2013
Messages
303
has anyone on hive actually devised a way of transposing animations from blender on MDL/MDX style bones for animations in HD? I think it use to work for older versions of classic models. Say I make the bones animated separate from the mesh then add that data to a model somehow?
Depending on what you need bone-wise, making animations for then exporting using Twilac's fork of the MDL exporter (even though it only fully supports v800, old format so no HD) could probably be enough. After that you'd use RMS and mess around with transferring animations from that armature to a model. I don't make War3 models sadly, so my knowledge ends even before everything this importer and the mdl exporter can do.
 
Depending on what you need bone-wise, making animations for then exporting using Twilac's fork of the MDL exporter (even though it only fully supports v800, old format so no HD) could probably be enough. After that you'd use RMS and mess around with transferring animations from that armature to a model. I don't make War3 models sadly, so my knowledge ends even before everything this importer and the mdl exporter can do.
Yeah I have that addon installed in blender. I might have to just try animating the static bones as thought they are some kind of 'nodes' and exporting too see it that works. My only other solution is to ask a streamer I know whos boyfriend work on reforged as a outsourced 3d artist in Malaysia. But my fear is that they is no cheap and easy way to get this done, and the only real way is too just get a 3d studio max licence or whatever they were using for it. or just wait for twilac or someone to update their addons for HD support in blender.
 
Level 2
Joined
Apr 26, 2019
Messages
2
Not trying to revive thread but I wanted to use this tool nowadays, and had some trouble but got it working. After figuring it out wanted to post my findings.

-- Using blender 2.83
-- Use Retera's Model Studio v0.04.4g to get export the (classic) MDX i want. Note that if using Retera's, you must change model header format version to 800 instead of 1100 before saving to MDX, as the Blender import tool will reject 1100. (go to the Model tab in Retera's once your unit is open). This is only needed for MDX. For MDL you dont need to do this, and the Blender tool will import it anyways, but MDL has some issues.

-- I noticed that MDX imports perfectly with all anims for the handful of units I tried. MDL importing has errors in the animation (legs turning backwards, skin stretched, etc) but seems to work fine if you just want a static model without animations.

Hope someone finds this useful.
 
Top