1. The poll for our 11th Music Contest is up! Help us choose the most awesome cinematic tracks by casting a vote!
    Dismiss Notice
  2. Melee Mapping contest #3 - Poll is up! Vote for the best 4v4 melee maps!
    Dismiss Notice
  3. The 30th edition of the Modeling Contest is finally up! The Portable Buildings need your attention, so come along and have a blast!
    Dismiss Notice
  4. The Aftermath has been revealed for the 19th Terraining Contest! Be sure to check out the Results and see what came out of it.
    Dismiss Notice

Exporting models from Blender using the MDL exporter plugin

Discussion in '3D Modeling Tutorials' started by Fingolfin, Aug 20, 2018.

  1. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,144
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    Hmm, yeah, that does look weird. My best guess is that it is related to the scale of the armature, it currently has a scale of 0.025. When i applied its scale, the animation in Blender started looking the same as in the MDL file. If it's not too much hassle, try applying the scale (or create a new armature) and redo the animation like that.

    EDIT: Just pushed an update which adds support for armature scaling, and it does fix some of your issues. However, there is still an issue where the arms rotate inwards in the stand animation. I am not sure what causes this, though i will look closer into it tomorrow. At first i thought it was because your armature was rotated, but i tried applying its rotation with no effect.

    EDIT2: If anything though, now that i think of it: the exporter uses the pose at frame 0 as reference pose and converts all rotations to be relative to this. it is possible that this causes some problems since your animation starts, with his arms rotated and keyed, at frame 0. Can you try creating a rotation frame for each bone at frame 0, where the character is in his rest pose ("T-pose"), and then just start his regular animations at some other frame? Your sequences can start and end wherever you want. You can move keyframes easily in the action editor.

    Also btw, Euler rotations are supported now also, they are automatically converted to Quaternions, so you don't need to worry about that.
     
    Last edited: Jan 20, 2019
  2. GriMw0lf

    GriMw0lf

    Joined:
    Jan 17, 2019
    Messages:
    6
    Resources:
    0
    Resources:
    0
    @Fingolfin Thank you, it worked! That was pretty damn quick, I appreciate it.

    I looked through your code a bit and I noticed you've been working on this since at least April, that's a lot of dedication, so good job! You're a legend man, this plug-in is a real lifesaver.
     
  3. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,144
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    Thanks a lot! Initially, it was mostly for myself, and for the fun problem solving and programming. I swapped from 3ds Max to Blender a couple of years ago, and now that I've gotten used to the fast, hotkey-based workflow of Blender, i can't stand working in Max anymore... so i basically had to write a plugin for it (even though had never programmed in python before, haha). It's been a struggle, but seeing people make use of it makes it all worth it! Good luck, and just let me know if you have any more issues!
     
  4. GriMw0lf

    GriMw0lf

    Joined:
    Jan 17, 2019
    Messages:
    6
    Resources:
    0
    Resources:
    0
    Thankfully Python isn't too difficult to learn, would have been a lot worse if Blender had used C++ for its plugins.

    That being said, I don't know Python but if you ever need any help with C#, Go, or JS/TS (I work as a full-time dev) let me know and I'd be happy to help, it's the least I could do to repay you for this awesome plugin you've made!

    If I find any issues with the exporter, I'll make sure to let you know.
     
  5. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,144
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    Thanks for the offer, but I am a full-time C# dev myself, so I think I'll be fine on that front! Feel free to give a shoutout to this plugin if you ever upload a model made with it though, it would be much appreciated.
     
  6. Astrella

    Astrella

    Joined:
    Oct 3, 2008
    Messages:
    146
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Would it be feasible to make your model in Blender; export it and then animate it using Mdlvis?
     
  7. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,144
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    Yes! I like to think that the current animation support is at least as good as that of MDLVis, though.
     
  8. Astrella

    Astrella

    Joined:
    Oct 3, 2008
    Messages:
    146
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Alright; thank you. I'm not really sure what I'm going to do yet cause I'm new with this. Just wanted to know my options. I'm very grateful for you making this plugin though cause I feel Blender probably has wider use than the made-for-Warcraft tools handy as they might be so will definitely give both options a go. :)
     
  9. NightStalker

    NightStalker

    Joined:
    Apr 21, 2013
    Messages:
    1,126
    Resources:
    5
    Icons:
    4
    Spells:
    1
    Resources:
    5
    Hey Fingolfin, the plug in worked flawlessly for my model. Just a quick question though! It is from my lack of knowledge; I mapped each and every nook n cranny of my spaceship model, they show on the model as I want it to be. But I don't know how to export each texture separately with the UV layouts. When I select all and try to export the layout all I get is a blank background and many lines depicting my vertices.

    So question is; how can i export the layouts easily without re wrapping them one by one for each part, so that the Magos Model Editor can detect the textures as well? Right now Magos sees it as just a solid spaceship with no textures.
     
  10. Fingolfin

    Fingolfin

    Joined:
    Jan 11, 2009
    Messages:
    3,144
    Resources:
    152
    Models:
    142
    Icons:
    1
    Packs:
    4
    Skins:
    2
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    152
    Hey, glad it works for you! What you need to do with the textures is to assign a material for each part which you want to have a separate texture for. It is possible to have multiple materials on the same mesh and assign them to different faces by selecting them in edit mode and pressing "assign" with the material selected. Then, you need to set up the MDL data for each material in the bottom of the panel where it says "MDL Material Settings", as described in the manual. Make sure to set your texture paths correctly in the material layer. Finally, you need to use a BLP converter to convert your textures and place them in the same folder where you export your model. If you export it and open it in Magos, it should now display the textures.

    Also note that in the image/uv editor, you can go to UV>EXPORT UV LAYOUT to get an image with your uv layout to base your texture on - just remember to set opacity to 1. There is also a plugin called "texture atlas" which lets you unwrap multiple meshes at the same time.
     
    Last edited: Feb 14, 2019 at 10:34 PM
  11. NightStalker

    NightStalker

    Joined:
    Apr 21, 2013
    Messages:
    1,126
    Resources:
    5
    Icons:
    4
    Spells:
    1
    Resources:
    5
    AWESOME! The textures now show correctly in Magos. I can't tell you the hype to see the result in the game haha :D