MDL Exporter for Blender3D!

Hey, i am reading all your comments but i haven't gotten time to address them yet!

@sonphamthe11H The exporter will combine all meshes sharing the same material and geoset animation into one geoset. This is intentional and will improve performance in-game. Is there any particular reason why you want the meshes to be separate? If you do, just give them different materials.

@dtnmang I haven't tried, but it should work!
 
I just pushed an update: Nested armatures are now supported, bone weights are now better calculated (bones with a weight of less than 25% are ignored) which will lead to better looking mesh deformations, auto-created bones should now handle parenting much better too. I noticed though that animating the rotation of nested armature objects will turn out weird if they start off rotated relative to the world.

By the way @sonphamthe11H , that model looks pretty cool, did you make it yourself?

EDIT: Also, added a link to another tutorial of mine - on how to generate and animate procedural trees with the Sapling add-on.
 
Last edited:
Level 5
Joined
Mar 6, 2017
Messages
183
Nah,taken from dota2
Btw,I notice that you didnt code the models optimization well
Keyframes optimize is good but you should remove the unneeded ones which are outside of marked animations
The unneeded one make the model exported has big size
 
I would love that, the problem is that paths for in game textures need to be relative to their MPQ... What I could do is to include a file with a list of all files in the MPQ a and make a dialog window where you get a searchable list of them. Unfortunately, I can't have thumbnails for them though since these are protected by copyright.
 
Just updated the exporter to feature a searchable list of texture paths for materials! You can also search for event object IDs for your event objects, which is super neat.

EDIT: Also added preset support for particle systems, and included four standard presets! Particle systems now also have searchable texture fields.
 
Last edited:
Level 1
Joined
Mar 5, 2018
Messages
2
Sorry to bother ya but i've been getting this error when trying to install the addon on the current version of 2.8 using your current version of the tool
VUn1NW5.png
 
Level 1
Joined
Mar 5, 2018
Messages
2
I just checked this out, and it appears that 2.8 changed more things than i thought. I am working on adding 2.8 compatibility, but it will take a few weeks. Thanks for letting me know!
No problem my dude, happy to help an thanks for the great tool
 
Level 7
Joined
Jul 7, 2011
Messages
244
I used your exporter on this model. There I posted a situation, which your addon misinterpreted.
If you want to help me there, feel free.

I do not know if am asking too much, but I'm suggesting that you put some in your addon to make it more comfortable. Not do need to work with materials, so it can recognize the textures and convert them to Warcraft 3 format. After you have pressed export, already is ready to place in World Editor with game format.



MDLMS.jpg


Another thing I suggest, you put in your addon in the form "Texture Path:" a button to File Browser, to find the file you want use.
 
Hello Napoqe! Have you tried the latest version? It has a search button where you can search for a specific texture from warcraft. In the future i will add a file selector for custom textures too. Here is a nice tool which can convert textures to .blp: Warcraft III Viewer

Your model appears white because it has no textures. First, make sure that everything has a material, and that all the materials have a texture path set. When you import the textures to your map, they must have the same path in the import manager as the one you set in the model (remove war3mapimported/). For example - if you have a texture called "wood.png", try converting it to .blp using the tool and type "wood.blp" inside the path field.

As for collision, this is not related to the model. In warcraft, collision is determined by pathing maps, which you set in the object editor. You can create your own pathing maps in paint (see this tutorial: Custom Pathing Maps). The thing called "collision object" inside Blender is used for setting which part of the model is selectable. You can also use them to make it possible to walk on top of a model - for this you need to make it a destructable and set "walkable" to true in the object editor.
 
Level 7
Joined
Jul 7, 2011
Messages
244
@Fingolfin

I did as you said. I downloaded Warcraft III Viewer and converted to blp. I made the links in the texture path. However, in the World Editor the error occurs when load the model. Even there, putting the same path to go the textures. The textures are in a subfolder called "Texturas", and I did the same in the import panel of the World Editor.

Another question @Fingolfin. You told me about Custom Pathing Maps. The mapping of conditions is worked on the flat map perspective?

Edited: Google Drive
 
Last edited:
Oh, i see the problem... the BLP format has a limitation: your textures need to have a square size, and the amount of pixels to one side has to be a power of two, for instance, 256x256 or 512x512 pixels. If you fix this, it should work. You can resize them using paint - you will not need to update the UV maps of the model, since their coordinates are relative to the texture width. I also have some other comments:

  • Some texture paths have a leading slash - you should remove that (\Texturas\polystyrene-911001_640.blp for example)
  • All your materials are set to additive blending mode. This will make them appear glowing - you might want to change it to Opaque.
  • I am not sure if Warcraft supports dashes (-) inside file paths. Try removing this.
  • You can share materials between objects when they have the same texture. Right now, you have a unique material for EVERY object. This is bad for performance.
  • I don't think you actually need all those collision boxes.
  • Make sure that the import paths in the map editor are exactly the same as the ones you used in Blender.
Regarding collision maps: yes, these are in 2D. If you open the map editor and press P, you will see the pathing of all doodads and buildings. Pink means non-walkable, blue means non-buildable. If you want units to walk on top of something, you can make it a destructable and set it to "walkable". In this case, warcraft will try to place units on top of the model when they walk over it.
 
Level 7
Joined
Jul 7, 2011
Messages
244
With your guidance. Now I was able to make the model load the textures. However, no explanation the model is being taked by light blue color. But when I work on it in the Editor, it if fixes.
I can not do Custom Pathing Maps. It gets too big. Even I putting 5x5 pixels. Give me a reference suggestion and / or help me, both if you want.
I have seen a few lines appear that separate objects from objects. Maybe my lack of knowledge. And the first time that I managed to put my model in a game. Also counting that this was one of the first 3D models I've done in my life.

Work updated in Google Drive.

Screenshots: Album — Postimage.org
 
Last edited:

Hayate

Multimedia Team
Level 40
Joined
Oct 20, 2010
Messages
2,930
Hi, Wanna ask, Any plans on updating it for 2.8? it would definitely save me a few steps as im primarily using 2.8 now

Edit: I assume that the Particle Emitter is only available for setting and i cant preview the particle in blender?
 
Last edited:
Yes, i have! I have actually already laid the groundwork for that, i was just hoping to do some refactoring first since i'll need to make a separate branch for the 2.8 version due to all the changes.

As for particle emitters - yes, it is just data. Unfortunately, the way particles works in Blender is just too much different from Warcraft 3 to make it meaningful to use them.
 

Hayate

Multimedia Team
Level 40
Joined
Oct 20, 2010
Messages
2,930
I wanna ask, for the 2.8 are there still plenty of work and will it be taking very long?

and perhaps, maybe can add the possibilities on the animation can use Action Editor for the Animation instead of marker in future

Great work, cool stuff btw, with this tool it makes me more motivated to do some Warcraft Modelling in future
 
I am working on it right now and i expect it to be done before the end of next week!

I just pushed a new version with some major refactoring of the code. Now, the War3Model class serves as an intermediate format which can be converted both to and from a scene. This opens up for implementing a MDX exporter based on the same logic, and also potentially MDL and MDX importers.

As for the Action editor, i can probably do that, though i personally find the current way both faster and more intuitive, especially when you're used to 3ds Max Art Tools. The problem with the Action system is that it is almost too flexible - you can have any amount of sequences for one object, while in the MDL format, animations are stored linearly and can't overlap. I'm gonna have to do some thinking on this, i will see what i can do. Is there any particular reason why you'd prefer using actions?

Thank you for your encouragement Hayate, knowing that people use and appreciate the exporter is what makes me want to spend time on it.
 

Hayate

Multimedia Team
Level 40
Joined
Oct 20, 2010
Messages
2,930
I am working on it right now and i expect it to be done before the end of next week!

I just pushed a new version with some major refactoring of the code. Now, the War3Model class serves as an intermediate format which can be converted both to and from a scene. This opens up for implementing a MDX exporter based on the same logic, and also potentially MDL and MDX importers.

As for the Action editor, i can probably do that, though i personally find the current way both faster and more intuitive, especially when you're used to 3ds Max Art Tools. The problem with the Action system is that it is almost too flexible - you can have any amount of sequences for one object, while in the MDL format, animations are stored linearly and can't overlap. I'm gonna have to do some thinking on this, i will see what i can do. Is there any particular reason why you'd prefer using actions?

Thank you for your encouragement Hayate, knowing that people use and appreciate the exporter is what makes me want to spend time on it.


In terms of using action, i feel like is more manageble and more organized that way, perhaps you can make it to be able to choose to use action or marker when exporting, because both have it's advantage, also, if I do it with action editor, I can have the same model to have more use other than just for warcraft model.

I'm a blender user and a big fan of 2.8 and i really appreciate to get this tool, thanks again haha
 
All right, there is now a WIP 2.8 branch up on GitHub! Just switch branch from "master" to "2.8" and follow the same instructions.

There are tons of breaking changes in 2.8, so there might be some obscure errors popping up. For instance, Blender now enforces you to use explicit positional arguments whenever applicable, which means that i have to find every function call in the code and look up its argument names in the API to see if they need to be explicitly typed out... i cannot describe how incredibly annoying this is. Just copy the error message and paste it in this thread if you encounter any.
 

Hayate

Multimedia Team
Level 40
Joined
Oct 20, 2010
Messages
2,930
Cool, btw there is three suggestion, for the MDL Material Settings,

There is the "Texture Path" for us to type in the texture path, thats fine and stuff, but is kinda not very intuitive, It would be cool if I can just have a "open file dialog" so it will be easier, and also have a checkbox call "use blp" so when export, the path inside will use blp instead of like png or something. (Would be nice to be able to auto convert but this one I can convert myself manually, is just a rename)

And maybe a button call "Set Up Material" where it will automatically setup a diffuse material with that texture, of course I can do it manually but this is a "nice to have"

And also, I think it would be better to have everything in the addon to gather in the "Active tool and workspace" tabs maybe (for2.8) just a possibilities, since I can just focus everything for MDL in one place.

I hope im not asking too much haha, is just suggestions
 
Level 18
Joined
Apr 12, 2018
Messages
498
I've been meaning to ask for a while, but it appears to me that bones get exported in a completely arbitrary and random order whenever I export any model; even the same model won't come out the same way in different instances. In the grand scheme of things this doesn't really affect a whole lot, but it does get confusing to look at sometimes.
 

Hayate

Multimedia Team
Level 40
Joined
Oct 20, 2010
Messages
2,930
I've been meaning to ask for a while, but it appears to me that bones get exported in a completely arbitrary and random order whenever I export any model; even the same model won't come out the same way in different instances. In the grand scheme of things this doesn't really affect a whole lot, but it does get confusing to look at sometimes.

Im not sure if this helps, but When I export, My first frame is the None Posed pose (As in how it should look like without posing it)

for some reason, the Bone's position is using the first frame as the position instead of the resting poses, so I go to the first frame, select all bone, Alt P, Alt S, Alt G, and then set a keyframe
 
Level 18
Joined
Apr 12, 2018
Messages
498
I gave your suggestion a shot, but it honestly didn't do anything that wasn't already happening.

Although I did notice what you said about the Bones using the first frame.
 
Level 5
Joined
Jan 3, 2020
Messages
65
The issue is with your Blender file, would you mind sharing it ?
Because as far as I can tell, your material layer using your custom texture is just not applied to any polygons, and instead the whole objet uses the teamcolor material.
 
Level 6
Joined
Jul 21, 2008
Messages
52
Here is it is. It's very possible that I just don't understand how to use the MDL exporter at all. I'm still working with the animation because I appear to be running into problems with it as well.
 

Attachments

  • MDL Human Transport.blend
    5.9 MB · Views: 91
  • HumanTransport_diffuse.dds
    1 MB · Views: 87
  • HumanTransport_normal.tga
    371.1 KB · Views: 88
Last edited:
Level 5
Joined
Jan 3, 2020
Messages
65
Alright, just switch the position of your two material layers. First the teamcolor (Layer 1), then your custom texture (Layer 0).
And maybe it's just the file than you shared here, but there's a problem with your BLP, can't use it, and when I convert it to another file format, I just end up with a <1kb file.
 
Level 5
Joined
Jan 3, 2020
Messages
65
1. BLP textures are used for SD graphics (original War3). And SD graphics can't use normal maps. Normal map can only be used for HD (Reforged) graphics, and in that case you need DDS textures.
2. The order of your material layers is still wrong. Your diffuse layer should be second, not first.
3. The name of your BLP is not the same as the name required by your model. Your model wants a « HumanBarracks_diffuse »

Here's your MDX fixed. When importing your diffuse BLP, just remove « war3mapimported\ » from the file name in the Asset Manager.
And I fixed the Walk animation.
You can use War3 Model Editor to compare the changes I made to the rotations of « Bone_Paddle ».
 

Attachments

  • HumanTransport.mdx
    541.1 KB · Views: 86
New update was just pushed to the 2.8 branch:

  • Added support for Blender 2.82 mapping nodes for texture animations. Please note though, that any animations have to be done to the mapping node itself, you can't drive the values using other nodes.
  • Fixed some issues with vertex colors being inverted
  • You can now use an RGB input node with the name VertexColor in your material to add a tint to any object with that material. This is sometimes more handy than changing the object color of each material. You can still also use any node with a color input in the first socket in the same way (such as a Diffuse BSDF node).
  • Armatures now automatically generate a root bone for the armature itself. This allows armatures to be parented to other armatures or bones.
  • Better support for rotating armatures.
  • Fixed some skinning issues caused by vertices having too low bone weight. Vertices will now default to whichever bone has the most weight rather than to the root bone. This will solve most if not all skinning related issues people have been experiencing.
 
Last edited:
Level 9
Joined
Mar 6, 2012
Messages
64
New update was just pushed to the 2.8 branch:

  • Added support for Blender 2.82 mapping nodes for texture animations. Please note though, that any animations have to be done to the mapping node itself, you can't drive the values using other nodes.
  • Fixed some issues with vertex colors being inverted
  • You can now use an RGB input node with the name VertexColor in your material to add a tint to any object with that material. This is sometimes more handy than changing the object color of each material. You can still also use any node with a color input in the first socket in the same way (such as a Diffuse BSDF node).
  • Armatures now automatically generate a root bone for the armature itself. This allows armatures to be parented to other armatures or bones.
  • Better support for rotating armatures.
  • Fixed some skinning issues caused by vertices having too low bone weight. Vertices will now default to whichever bone has the most weight rather than to the root bone. This will solve most if not all skinning related issues people have been experiencing.
Thank you so much for your effort! Just wondering if the scaling animation bug has been fixed. For some reason when I export a model with scaling animations the z and y scale values are swapped. Not that much of a problem since I can fix it easily with model editor.
 
Thank you so much for your effort! Just wondering if the scaling animation bug has been fixed. For some reason when I export a model with scaling animations the z and y scale values are swapped. Not that much of a problem since I can fix it easily with model editor.

I actually wasn't aware that this was a bug, i will take a look at it right away. Thanks!
 
Top