KatsBits Community

Game Editing => Scripts & Support => Topic started by: motorsep on June 08, 2011, 03:50:12 PM

Title: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on June 08, 2011, 03:50:12 PM
Current available MD3 export scripts - test for compatibility before use.
Basic MD3 prep and export instructions can be found below

[edit addition by kat]


I downloaded MD3 exporter for Blender 2.53+, however, I don't see it in the list after installing the add-on in Blender 2.57b :/ Does anyone have the same issue? What's the solution? Thanks.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on June 08, 2011, 11:43:17 PM
Yeah it won't, it needs to be updated to work in 2.57 both in terms of it showing up in the AddOns list and actually exporting correctly because of the changes made to Blender. As of right now you're better off sticking with what works (2.53?).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on June 10, 2011, 03:24:27 PM
There ya go, MD3 exporter is back in business: http://www.kot-in-action.com/files/blender/io_export_md3.py

Good people made it work again, in Blender 2.57b, but it needs testing.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on June 10, 2011, 07:26:41 PM
Tested this (using MD3JavaView) with my buneh character and the script does output an MD3 file with associated animation but it's not automatically creating the file set need for "Quake 3" - in the java viewer this means it can't find the *.cfg file that contains the texture, animation data so the mesh appears black in the viewer. That's a problem with the set up rather than output though.

Cheers for updating, I'll mirror the file in the tools section.

Animation export
- Only exporting active animation sequence (good/bad depending on your point of view).
- double check "Start:" and "End:" frames are set correctly per animation.

(https://www.katsbits.com/images/misc/buneh-md3-test.jpg)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on June 10, 2011, 07:50:02 PM
I don't think you need .cfg file for the texture.. It's gotta be .skin file, no?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on June 10, 2011, 07:59:30 PM
I think so yes, it's been a while since I've done anything Quake 3 related so I've not got the game installed to be able to check but iirc all the skin file did was reference a shader?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on June 10, 2011, 08:23:23 PM
yeah, or texture. For example, if you have you shader name in the model as "bunny", then the shader file will look as following:

bunny,models/animals/bunny

You can either have a shader in the models.shader called "models/animals/bunny" or you can have bunny.tga in models/animals/ folder.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on June 10, 2011, 09:32:38 PM
Hmm... currently I've got the *.blend file set up so the material, texture and image name (datablocks) are all using the same 'name', "bunnysneaky", which is the same as the file itself "bunnysneaky.tga". That image is loaded using relative paths so it appears in the "Source:" block as "//bunnysneaky.tga".

The mesh is exporting but in the md3 viewer applying a skin or an actual texture image just renders the object black, which usually means there's a texture loading issue somewhere. Now I can't quite remember if the texture image datablocks in Blender are supposed to reflect the 'shader' path, meaning the text fields (Texture > Image > datablock ID) should be written as "/models/path/texture" and not just "texturename" because the script gets the actual pathing info from there, or at least it used to?.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on October 20, 2011, 08:21:27 AM
Before you ask... no, the script doesn't work (yet) in 2.60  ;)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on October 20, 2011, 04:09:11 PM
I am not too familiar with MD3 format. I, however, had to modify script itself (ASE exporter for 2.49) so it can append proper prefix (path) to the texture. Maybe it can be done to MD3 script too?

EDIT: Do you know if MD3 exporter can export shape keys animation (flapping flag) ?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on October 20, 2011, 06:43:43 PM
Not sure about the shape keys question, can you 'bake' the frames to the time line like you can using bones? If you can do that then there might be a possibility it can (I can't think of any objects in the original game [Q3] that had that type of movement).

Re the script: it does appear in the AddOns list, but it's just not selectable. Not sure if that means the script won't work overall or just that it needs a tweak. I'll take a look.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on November 08, 2011, 04:55:43 PM
First off, hi everybody, this is my first post on your forum.
I've been testing this script in Blender 2.6 and come across this error.

line 549, in save_md3
uv_u = round(nobj.active_uv_texture.data[f].uv[v][0],5)
AttributeError : 'Mesh' object has no attribute 'active_uv_texture'

Does anyone know where Blender 2.6 is currently hiding our uv data??
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on November 08, 2011, 05:08:34 PM
Can't help you on this one but you certainly got further than I had, couldn't even get it to run!. Looks like another round of deep changes in Blender have taken place in 2.6.

Welcome by the way  ;)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on November 08, 2011, 06:39:36 PM
Thanks for the kind welcome :)
It loaded right up for me with no problems, will even export all the mesh data. Looks to be very close to working fully, just a small back step with uvs.

EDIT: I got it working, just getting some test results from a few people, then Kat will post it in the tools section.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on November 11, 2011, 11:06:00 AM
Added download link to the first post in the topic above.. adding to the tools page as well. Good job updating this for 2.60a.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on November 19, 2011, 07:29:09 PM
Do you know if MD3 exporter can export shape keys animation (flapping flag) ?
Yes it can!! At least in 2.6 for sure.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on November 19, 2011, 08:00:13 PM
Sweet! Anything particular I need to do to set it up right?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on November 19, 2011, 11:01:45 PM
Huh, where to start.
I will assume you know quite a bit already, you've been around blender longer than I.
You will need to set up your shape keys, properties>objectdata>shape keys
click + to add your basis (basically your starting point)
click + again to add key 1
go into edit mode change key one to what you want it to be.

Now animating your shape key
This is where I got hung up at first, open the dope sheet and change it to shape keys. Here is where all shape key animation starts, just select your frame and make your key adjustments (slider), blender will auto-majicaly insert a key frame wherever in the timeline you adjust shape keys. No baking necessary just export the finished object(s) like normal. Some good tuts out there. All I know came from a few you tube videos last night. Look into f curves and object drivers too.

Now here's is where the excitement begins. Baking physics based animations to key frames. I won't get into yet, cause I don't enough myself, but it does work, I've tried it.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on November 20, 2011, 01:41:51 AM
Adding to what dmc2143 mentioned. You'll need to be mindful that, iirc, MD3 originally limited the number of effectors that could/would influence a particular vertex to just two or three. That means if you have a number of Shape Keys, say five or six (and this isn't unlikely/unusual due to the way they work), effecting individual vertices it may cause problems at run time (dropped, broken or ineffectual motion) - if you're doing a cyclical animation for example you might want to try and limit yourself to just three keys - the "Basis" (start point), "Key1" (midpoint) and "Key2" (end point/duplication of 'Basis'). This might be/is probably different for other engines using the format though.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on November 20, 2011, 01:46:58 AM
@dmc2143: So are you saying I can simulate cloth for a flag and export it straight into MD3 ? (or rigid body sim)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on November 20, 2011, 01:18:44 PM
I am saying it's worth a try now. You will need to bake the physics to the timeline. properties>physics
I've done one simple physics test, a multi subdivided plane cloth falling onto a sphere and draping itself around the sphere. It exported to md3 just fine.

ADDED: Yes, I have exported a md3 flag with wind physics applied to a cloth / soft body plane.

About shape keys, I just did a test with 6 different keys and got errors, so Kat has the right of it. It appears to be a limitation in the md3 format itself. Untill blender can bake shape key animation data (if ever) we may be stuck on that one. Trust that I will be looking into it, there may be more treats to 2.6 yet.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 09, 2011, 04:36:05 AM
I am using this exporter with 2.59 and I get no error. However, I am getting shader error upon loading my MD3 to the game:

models/flag/flag_joint.md3: could not load texture "NULL"

Here is export log: http://pastebin.com/ffsGQ0Yk

The model is simple box, no bones, no anims.

P.S. I don't have MD3 viewer for Linux and JavaMD3 viewer doesn't work / nor it wants to compile. Thus I can't check the model any other way, but loading it into the game.

Thank you.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 09, 2011, 05:44:44 PM
Two things to try, see what they do;
In the same boat as you though, JavaView doesn't work on Windows 7 :o(
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 09, 2011, 07:09:42 PM
same result - not working. Getting same error on model load and because of that model is not being rendered in-game.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 09, 2011, 08:25:35 PM
Hmm.. looking at that data you posted again, a couple of other things stick out to take a look at. Try exporting a much smaller number of frames (less than 100, 99 or below); I can't remember off the top of my head but I recall there being a frame limit by which MD3 went a bit wonky afterwards. If you're using the same engine as before (Dark Places?) again check to make sure there are no frame limits in place.

Also try exporting the mesh without the "_" in the name, "flagjoint" or "flag-joint" at a push; underscores ("_") are another caveat with MD3. Again check any limits with the engine your using though. I know these aren't obviously related to 'shader' errors, but as we know problems and messages don't always tally up.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 09, 2011, 09:07:36 PM
no no.. That's not it.

I made a skin file where I assigned a shader to the mesh: mesh_name,shader_name and I can see the model in-game now. But UV's are wrong. I exported using scale in the exporter's GUI.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 09, 2011, 09:42:48 PM
How are the UV's screwed up? Are they inverted, flipped, totally scrunched up and all over the place? Each 'symptom' has potentially different fixes - might be as simply as flipping a texture upside-down or left-to-right, or more likely, modelling actual size and not using the script to scale on export (that never really been a good way to model and export content for games as you know).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 09, 2011, 10:25:07 PM
On the left - MD3, on the right - IQM :

http://farm8.staticflickr.com/7154/6483822233_859c80be09_b.jpg

MD3 should look like IQM. It's the same scene in Blender, just exported into 2 different formats.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on December 09, 2011, 11:31:00 PM
Do you have md3shader defined as a custom property for the object? Somehow the UV coordinates aren't getting exported. Unless you've named your shader "NULL" it is a sign that UV texture is being ignored by the script for some reason.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 10, 2011, 01:00:06 AM
Are you creating (and assigning) full a Material to the mesh rather than skipping that and applying the texture directly to the unwrapped UVWs?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 02:06:30 AM
I have texture applied in the UV editor (that's what I always do, because I need to see it in the viewport) and I have material applied because that is a requirement of IQM exporter.

If someone would ever write about md3shader in the docs or ReadMe, I would probably have that ;) So, no, I don't have that and I am not even sure where to set that and how.

I never applied anything with the name NULL to the mesh.

There is a good model viewer called Noesis, it loads MD3, but it seems like there is no UV map nor there is a shader/texture. It's just a mesh.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 10, 2011, 06:43:23 AM
Try the MD3 Model Tool from here (http://www.splashdamage.com/forums/showthread.php/17677-ET-Model-Tool-v1-4-0-*NEW*?p=258773&viewfull=1#post258773) (Splash Damage forums) see if that gives you the same issue. If it does then you definitely know it's an issue with the export output from Blender (always worth double checking to make sure).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 03:50:36 PM
Thanks, tried it. I see that the surface name is as I named it in Blender (so using skin file would solve the issue of the NULL shader). I see the shader name is NULL and I know that UV is jacked. So it is definitely exporter issue.

I am using Blender 2.59 and I am almost sure that anything UV related should be the same as in 2.60 and 2.61. I will give exporter a shot in Blender 2.61 (as we all know 2.60 is really buggy and thus I skipped it) and it I get the same results, I would appreciate if the author will take a second look and fixes the issue.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on December 10, 2011, 07:29:22 PM
In object mode. Under propereties menu (yellow cube icon). Very last menu selection is custom property. You need to assign the custom property name "md3shader" set value to YOUR_SKIN_NAME.EXTENSION (eg. my_cube_skin.tga)
I assumed this was known because it has been this way since Xembies original exporter for 2.5. I will have to write something up one of these days.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 08:01:46 PM
\o/

It worked, thank you. Now I have another question.

http://farm8.staticflickr.com/7005/6488319119_15b02c07a8_b.jpg

The left cube is IQM, the right cube is MD3. They both use the same shader:

models/flag/flag_joint
{
   {
      map models/flag/flag_joint.tga
      rgbGen lightingDiffuse      
   }
}

However, as you can see, shading is messed up on MD3 model (both models are spawned dynamically, as if those were weapon models for example). Even if I don't apply the shader listed above, and both models use the texture directly, I still have that shading issue.

Any clues? Any idea if that can be fixed?

Thank you.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 10, 2011, 08:09:05 PM
Can you copy/paste the data from each file, or post them for inspection?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 08:19:34 PM
IQM and MD3 files?

http://www.kot-in-action.com/files/flag_joint.zip
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on December 10, 2011, 08:39:31 PM
Quote
rgbGen lightingDiffuse
This is some feature of the engine you use??? I would be checking with the developers to see is you can control the diffuse or other values. I know nothing about the IQM format, this may just be another shortcoming of the very old md3 format. Look to other games from your engine to see if this works correctly for any md3s. Might be someone else has found ways to fix it.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 10, 2011, 09:13:59 PM
MD3 are usually 'vertex lit' (they're are 'shaded' meshes).

@motosep: This looks like it could be a problem with mesh smoothing. Might be that IQM support vertex splits for that purpose, iirc MD3 applies a single grouping value to everything so it'll weld vertices together where it finds them co-incidental to each other, breaking any 'groupings' ('Sharp' marked edges for us Blender users).

Did you use or apply edge-split and/or apply the modifier before export? You might need to 'force' splits into place using the "Separate" function (select and press "Y").
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 09:18:01 PM
This is a standard shading language of Quake 3. Darkplaces engine support almost all of Quake 3 shaders functions. As I actually work with MD3, I'll see if the issue will persist or will be too much noticeable on actual models.

Do you have a sample .blend file with a flag that you exported successfully into MD3? Could you share it please?

I am also wondering if there is a way to loop cloth sim in Blender..
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 09:22:03 PM
@kat: no, I don't use edge split on my models unless I am making "hard" surfaces. IQM supports smoothing, so if I have surfaces as "flat" in Blender, it will split them on export automatically.

This cube is actually just a test cube. We are prototyping dynamic cloth sim for Darkplaces and we use old Quake MDL format for physics joins. MDL is ... old :) IQM model doesn't work with ODE engine for some reason, so I needed to try MD3 in lieu of MDL.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 10, 2011, 10:45:11 PM
Btw, I spoke to the programmer of Darkplaces engine and he said that limitation for number of the shape keys is the exporters issue. There is no such limitations in MD3 format as it can have numerous morph targets.

The reason to use shape keys is to be able to loop cloth seamlessly. It's impossible with cloth sim afaik.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: dmc2143 on December 11, 2011, 12:32:57 AM
Ok, so exporting physics to md3 will bake the shapekeys needed to the timeline in the md3 itself. Import the md3 back into blender (stuck with the old 2.4 import script for now)with shapekeys all set. You can duplicate and reverse for a seamless animation.

About shape keys, the limits are on the number of shape keys in blender that you can use to alter any specific mesh at one time. Using md3s every animated frame is treated like a shape key of its own, either off(0) or on(1) where each frame has one key on all others off.

Here is my test work on this. And the necessary import script for 2.4
http://www.mediafire.com/?82wgbh0cg3y0y6c (http://www.mediafire.com/?82wgbh0cg3y0y6c)

I use md3s in a different engine, for Duke Nukem. I've never even played Quake 3 ;)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 12, 2011, 03:36:22 AM
Alright, got things going :) Flag, animated with Cloth and exported into MD3, not looped (in-game footage):

http://www.youtube.com/watch?v=OwHNGCL8etA

Its .blend file (after exporting to md3, importing in 2.49 and saving it in 2.59):

http://www.pasteall.org/blend/10246

Since I don't get how to work with these evil shape keys, can you please explain how can I loop this particular case, using my .blend as example? Thank you.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 14, 2011, 06:05:21 PM
Script seems to work in 2.61. I've not done a full export test (proper path set-up etc.), but the initial export I tested (bunneh character) worked OK.

@ motorsep: do you need the animation to be that detailed? That quite a bit of complex movement you've got going on there that if you could simplify, might be able to approximate as a standard shape or keyed animation.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on December 14, 2011, 06:14:36 PM
Of course I need it that complex :) Why else to I need cloth sim involved ;) Otherwise I could have used deformVertexes in the shader.

The issue is that I don't understand how shape keys work and how to work with them. There isn't any useful tutorial around :(

What I need is to morph last 10 frames into first 10:
1 2 3 4 5 6 7 8 9 10 ....................................... ......... 10 9 8 7 6 5 4 3 2 1
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: bartart3d on February 17, 2012, 02:49:56 PM
Thanks for the info, but I seem not to be able to get the textures loaded. Is there some more detailed explanation on how to export to md3 with materials? No matter what I try I don't get the textures loaded, and when I load them in 'misfit', an old linux app, the UV map seems not to be present.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on February 17, 2012, 03:23:47 PM
See if you can test the exports in one of the available md3 viewers floating around on the Net to double check the mesh.. JavaMD3View is probably the better one but it's not compatible with Windows 7 if you're running that OS. There's also Q3 Model Tool. If you can't find either, I'll post them later as an attachment.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on February 17, 2012, 07:00:06 PM
Script appears to work with 2.62 (only done a basic export test).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: bartart3d on February 18, 2012, 08:34:23 AM
Hi Kat, thanks for the reply. There seems to be more going on then only the texture problem. The normals are always inverted too when I export to md3.

I've tried the JavaMD3View, did not work, even though I run linux (ubuntu 11.10). Reading the documentation, it all seems very windows oriented. Q3 Model Tool worked like a charm in wine, which is quite ironical, since Java is supposed to be cross platform, and windows executables not...

Is Q3 Model tool supposed to load skin files on loading the md3? I've noticed it did not on my model. When manually adding the skin file, the model shows all black,well, more dark gray, just like in misfit, the linux app to load and edit md3's. I don't find a way to view or edit the texture coordinates though. I still have the impression that the uv-map is not exported from blender into the md3.

I've tried to run blender 2.42, since I've heard that would be the best version to export, and certainly import md3 files, but then I have the python compatibility issue. It does not find the python path. It uses python 2.4, and now we're at python 2.7 on a default install. I thought that was the problem, so I've tried to install python 2.4 too, but then there are dependency problems, since some of the libraries required to build it are replaced...

I'm starting to get really stuck here.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on February 18, 2012, 06:24:28 PM
I'm not too familiar with Linux so don't know if you can do this, but normally you can install different Python versions to a system so long as they are contained in their own folders; 2.4 to "Python24", 2.7 to "python27" and so on as Blender usually self-identifies what it needs. Try doing that (if you haven't already) to see if you get the I/O set up fully for 2.42.

The only other way to independently test the MD3 I can think of is to load it into Quake 3 but that's quite fiddle to do. So far as I know Q3 Model Tool should load in the materials properly if everything is OK, but there may be some setting that needs to be enabled somewhere - I'm not too familiar with it unfortunately, as I normally used JavaMD3View, until Windows 7, which is a much more straightforward app.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: stilobique on April 11, 2012, 09:01:48 PM
Hello,
thanks for the script ; it's perfect !
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on May 21, 2012, 08:12:42 PM
Has anyone updated MD3 exporter for 2.63+ ?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on May 21, 2012, 08:44:00 PM
Not this version no. There's another MD5 export script post in the normal posts for 2.63 (http://www.katsbits.com/smforum/index.php?topic=404.0) that's been written from scratch to take into account the BMesh updates. I've not had a chance to test it yet myself though.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: motorsep on May 21, 2012, 08:55:37 PM
I am more interested in MD3 exporter as it's the only exporter is missing from my workflow. Is there any working MD3 exporter for 2.63+ ?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on May 21, 2012, 09:45:01 PM
Sorry, keep mis-reading that as MD5.. and no, not yet.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on July 13, 2012, 11:21:06 PM
See first post for updated MD3 export script for 2.63a thanks to CoDEmanX (http://www.blenderartists.org/). Zip file also includes a basic test sample provided by motorsep (http://www.kot-in-action.com).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: mexicouger on August 23, 2012, 11:04:23 PM
I hope I don't get in trouble for this.. But I am having issues with Blender 2.63a and tags. Everytime I create an empty, name it what I want, in this case "tag_barrel", and select my mesh and tag and click export, I get an error.
I don't know how to copy/paste the error information, and I don't know if you all need it or not. But am I the only one who has issues exporting tags?
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: mexicouger on August 24, 2012, 06:10:29 AM
I followed all the directions above, but the error still occurs.

(https://www.katsbits.com/smforum/proxy.php?request=http%3A%2F%2Fi982.photobucket.com%2Falbums%2Fae302%2Fmexicouger%2FUntitled-3.jpg&hash=aa56524356e79bd481a5e2ae8ba8a17c)

To export, I basically selected the tag, selected my mesh, and clicked export, and thats the error that comes up.
I already knew about the parenting to bone thing and I followed the directions exactly anyways. I don't understand! But I really appreciate your help! I never had this issue with exporting md3 with blender 2.49.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on August 24, 2012, 06:46:25 AM
[EDIT] updated script with tag_ support (http://www.katsbits.com/smforum/index.php?topic=275.0)


Hmm yeah.. I just did a test to confirm. Mesh and/or rig export fine, adding the Empty doesn't. That basically means they (Emptys) don't appear to be 'valid' objects by the script (or are not converted correctly). The only thing I can think to suggest for the moment is to use an actual bone that's part of the same Armature. So add a new bone to your current rig, name it "tag_[whatever]" and parent it to the bone that controls its movement. export that and see what happens - you should be able to export without issue, but the test will be if that set-up performs the same way/as expected in the MD3 environment. Not sure this will work unless you happen to be using a skeletal version of the MD3 format (version that uses a skeleton, I know there are a couple out there).

An alternative might be to use a single triangle mesh object parented to the same rig as the main mesh (so you basically end up exporting two mesh objects, it should create a named sub-mesh in the MD3 file data). Add a Plain, triangulate and remove one triangle. Reposition and align. Name the Object "tag_[whatever]" and parent that to the same armature as the main rig. Make sure it has the appropriate vertex groups. Export and see what happens.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: mexicouger on August 25, 2012, 04:05:47 AM
Hey! I was pretty bummed about the tag bug with blender 2.63a (http://www.katsbits.com/smforum/index.php?topic=326.msg2463#msg2463) and tried a few different ways of getting the tag in my model all of which failed. I located the error and looked at a previous md3 exporter and with a bit of coding I fixed the tag problem.

Now using blender 2.63a, you can use tags. As always, you select your tag and mesh and just export.
So here it is.

http://www.mediafire.com/?9rz015ffau5zks0

-Mexicouger
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on August 25, 2012, 04:43:45 AM
Cheers will add the new updated version to the available files list once I've got the file sorted out (make sure you've added yourself to the credits section in the update ;) ).

Just to clarify, are you 'parenting' the Empty's to the Armature as per the above or doing something else? (So Empty is parented to the Armature *object* and 'linked' to a specific bone?)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: mexicouger on August 25, 2012, 04:52:27 AM
Thanks! And you just do what you normally would with a tag. Basically, make sure your armature is in pose mode. Position your tag where you want it, then select your tag and the bone you want to parent it to, and then parent. The tag will follow the bones animations perfectly.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on August 25, 2012, 05:07:35 AM
OK. Will get this up ASAP. Thanks for the fix.

(split and merged these last couple of posts so all 'tech' issues are in one place).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: D-Meat on December 15, 2013, 11:16:17 PM
Hello again,

I'm trying to export an md3 and I get this :
Quote
Traceback (most recent call last):
  File "C:\Users\D-Meat\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\io_export_md3.py", line 798, in execute
    save_md3(settings)
  File "C:\Users\D-Meat\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\io_export_md3.py", line 574, in save_md3
    my_scale = round(25/scene_minimum,2)
ZeroDivisionError: division by zero

location: <unknown location>:-1

The error seems simple : there is a division by 0, which might be the value of the "scene_minumum" variable here ...

I guess this variable might be the starting frame specified in the timeline, but it's variable name seems to be "frame_start".
Also, by default, the starting frame is 1, so it shouldn't divide by 0 ... I moved the starting frame to 2, and I'm getting the same error.

The only thing I have not followed from the tutorial is the separation of the armature in 2 different parts (for upper and lower), because I thought it might be complicated to animate some things ...
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: D-Meat on December 16, 2013, 12:41:01 AM
Problem solved : you have to select the object you want to export, and export separately head, torso and legs.

I haven't tested in the engine yet :)
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on December 16, 2013, 02:53:49 AM
Yup, it's always best to export objects separately (at present) otherwise the compounded mesh data (the export of several things at once) may cause various errors on export. Glad you got it sorted though.

You *can* export a full skeleton (not all MD3 usages need the upper/lower/etc split), but yes it will likely cause problems come time to test in the tech you're using because it'll be looking for 'properly' set up content. Certainly agree that having to do that can make animating confusing!

P.S. moved your post to this tech topic and tidied the old one (how to) up so there's less confusion over where these types of question can be asked.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: Strategee on September 18, 2014, 07:42:01 PM
Hi !
I use "MD3 export for 2.63a with "tag_" support" and i have always the same problem with size.
When i export it, the size of my model is really too big and even resize in blender doesnt work.
Also the option in export script fail.

By the way, i I tried export .3ds and the size is correct.

Idea to fix it ?

PS : I love this fix about tag <3.
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on September 18, 2014, 09:39:17 PM
Have you tried using "Apply" ("Ctrl+A") on the mesh and armature before export? Be careful doing this with the Armature though, if it has Action sequences they may break (this happens because Blender set a keyframes positional data relative to the original coordinates attributed to individual bones, change those and it alters the resulting exported data, in other words Blender ends up exporting the model as if it were much larger than it actually is).
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: Strategee on September 19, 2014, 01:46:00 AM
Hi-bis
Thank you for your quick answer.
In reality i test with no bones/armature and with a unique frame (but i tried ctrl + a).
I guess i need armature and keyframe to fix size ?
I go work on it and i post here if i'm still stuck =D.

In all cases thx for your help :P
Title: Re: [MD3] EXPORT script for Blender 2.5+/2.6+
Post by: kat on September 19, 2014, 01:19:05 PM
Yes, iirc you won't get a valid MD3 if you try to export without an Armature and Action - standard 'object' based animation doesn't work (that's where the object has no Armature and you're animating by simply moving the Object around). To fix the size of the mesh you need to use the "Apply" function as that resets Object data to "1" (http://www.katsbits.com/tutorials/blender/character-6-armature-rigging.php#setorigin) (1:1 size/scale).