Exporting models to md3

I am using Blender 2.6 to create a model in Quake III format (md3). I have managed to create a UV map and I the texture is mapped correctly in Blender. However, when the model is used in the game, the texture mapping is completely wrong. Do I need to do more than just create the UV map? The md3 file seems to have no texture alignment data.

Moved from “General Forums > Blender and CG Discussions” to “Support > Technical Support”

long time since I did that, was a 2.4x

but usually is yes, do an UV map, but the image, not asign in material editor, but in UV editor. Also, check well the exporter config settings. (I think some exporters used to need both the material editor and the UV editor have teh image asigned.)

One thing that happens a lot with formats and engines: UVs get inverted, and you have to flip again them, or just do a flip, mirror of texture in Gimp or Photoshop, be it right to left, left to right, or top/bottom… however is needed.

md3 is vertex animation, not bones animationn. MD3 in that blender worked well for me, jut had to play with model scale, as md3 is vertex animation, not 100% acurate, and wobling and weird distortion may happen. Playing well with scale (often enlarging, but of coure the whole thing! Not just a mesh. better done preview to asigning bones and weights.), etc, it can minimized enough for in game characters.

Formats all have issues.

after the availability of ETXREAL (former enemy-territory engine+mod) i have to go deeper in this part again. Last time i tried it was nearly 5 years ago and now i noticed they even put a md5-loader/render-part into it. My problem is, i already asked in the etxreal-icr-channel about docs to changes and no one could help. At the moment i still have set my changes as a seperate mod using the models/anims from the stock et-engine. But if i go to a standalone game i have to generate those on my own.
Long “rant”, short question: do you have any hints/links about usage, transfer-procedere from blender-animation with necessary settings to the et-animations?
(such things like number of frames for a walk-cycle, translation, heading … diamonds… etc.)

I found that I should assign a property md3shader to the object before exporting. Now I get the following error message:
line 181 export_md3_15.py line 181
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
location:<unknown location>:-1

Does index out of range mean that i did not assign an active uv_texture? I so, how do I do it


door.blend (261 KB)

@milasudril: are you still using blender-2.60 or what?

pls. you should always note what version.
I have now collected some md3/md5 versions for different blender-versions,
ranging from 2.49 up to 2.61. But i am still at the point of checking things out.
The last time i used the md2-export, was for blender-2.47 - and because the
new etxreal-updates can use md5-formats, i think about give the md5-exporter
for blender-2.61 a chance (checking what changes are missing from the md5-version for blender-2.59).

for blender-2.59 was a md3-exporter script in the addons,
but there were some changes and this is the diff of this older one
to the one, that did the first run without errors in blender-2.61

diff 2.61/scripts/addons/io_export_md3.py ../blender259/2.59/scripts/addons/io_export_md3.py 
&lt;     'blender': (2, 6, 1),    # test-dr, 16.1.2012
&gt;     'blender': (2, 5, 3),
&gt;     'api': 31667,
&lt; MD3_IDENT = str.encode("IDP3")
&gt; MD3_IDENT = "IDP3"
&lt;         tmpData[0] = str.encode(self.name)
&gt;         tmpData[0] = self.name
&lt;     vertices = []
&gt;     verts = []
&lt;         self.vertices = []
&gt;         self.verts = []
&lt;         for v in self.vertices:
&gt;         for v in self.verts:
&lt;         tmpData[1] = str.encode(self.name)
&gt;         tmpData[1] = self.name
&lt;         print(tmpData)
&lt;         print(self.binaryFormat)
&lt;         # save the vertices
&lt;         for v in self.vertices:
&gt;         # save the verts
&gt;         for v in self.verts:
&lt;         tmpData[0] = str.encode(self.name)
&gt;         tmpData[0] = self.name
&lt;         tmpData[10] = str.encode(self.name)
&lt;         data = struct.pack(self.binaryFormat,tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6],tmpData[7], tmpData[8], tmpData[9], tmpData[10])
&gt;         tmpData[10] = self.name
&gt;         data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6],tmpData[7], tmpData[8], tmpData[9], tmpData[10])
&lt;         tmpData[2] = str.encode(self.name)
&gt;         tmpData[2] = self.name
&lt;         print(tmpData)
&lt;         print(self.binaryFormat)
&lt;       for vert in s.vertices:
&gt;       for vert in s.verts:
&lt;         if len(face.vertices) != 3:
&gt;         if len(face.verts) != 3:
&lt;         for v,vert_index in enumerate(face.vertices):
&lt;           uv_u = round(obj.data.uv_textures.active.data[f].uv[v][0],5)
&lt;           uv_v = round(obj.data.uv_textures.active.data[f].uv[v][1],5)
&gt;         for v,vert_index in enumerate(face.verts):
&gt;           uv_u = round(obj.data.active_uv_texture.data[f].uv[v][0],5)
&gt;           uv_v = round(obj.data.active_uv_texture.data[f].uv[v][1],5)
&lt;       if obj.data.uv_textures.active:
&gt;       if obj.data.active_uv_texture:
&lt;         nshader.name = obj.data.uv_textures.active.name
&gt;         nshader.name = obj.data.active_uv_texture.name
&lt;         bpy.context.scene.frame_set(frame)
&lt;         fobj = obj.to_mesh(bpy.context.scene,True,'PREVIEW')
&gt;         bpy.context.scene.set_frame(frame)
&gt;         fobj = obj.create_mesh(bpy.context.scene,True,'PREVIEW')
&lt;             vert = fobj.vertices[vi]
&gt;             vert = fobj.verts[vi]
&lt;             nsurface.vertices.append(nvert) 
&gt;             nsurface.verts.append(nvert) 
&lt;         bpy.context.scene.frame_set(frame)
&gt;         bpy.context.scene.set_frame(frame)
&lt;   filename_ext = ".md3"
&lt;   filter_glob = StringProperty(default="* .md3", options={'HIDDEN'})
&lt; #  newpath = os.path.splitext(bpy.data.filepath)[0] + ".md3"
&lt;   bpy.utils.register_module(__name__)

now i have to check first with an md3-viewer what it looks alike …

I am using blender 2.61

what md3-viewer do you use to check things?
The old md3-importer for blender-2.49
or something like md3loader?

Perhaps it is quite odd, but I import it in GZDoom 1.5.06

did notice the question about “active uv-texture” too late,
an active uv-texture,
thats the one you see in the image-editor
when you tab into edit-mode of the object (with the faces selected).

As far i remember from the md3-export source code, it checks
the current uv-texture (the active one) of the object and uses this.
(and you know, you can only use triangles for md3 …)
ps. if i have some time, i will have a look into your supplied door-blend-file…

The problem was an old version of the md3-exporter. It was for blender 2.5. The code from Drek works fine.

Hello I’m new on this forum. I have the same problem “uv_u=round(obj.data.uv_textures.active.data[f].uv[v][0],5)
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
location:<unknown location>:-1”. I try to run with the version 1.5.1 of script: http://www.youtube.com/watch?v=SRtn9KO0omY
I have done like this, but I don’t understand very well the costum propeties: the first md3shader and the second, the name of the relative path where is the file (example: Escritorio/texture.png, i have to write Escriotio)???

I understund you found another version of this script, are this compatible for Blender 2.65???


Sorry to necro this thread, but does anyone know of a version of the MD3 import/export script that is compatible with 2.8?