Loading Quake 3 Models (MD3)

Hello everyone and happy new year!

I am trying to load a quake 3 model.  It has 3 md3 files and 3 skin files.

The skin file looks something like this:


I used the TestMd3JmeWrite.java as an example to follow.  I was able to render the horse just fine.  However, when try to load the human model, the skins looked messed up. 

So the model is being rendered like this:

But it should look like this minus the gun

Anyone have an idea of whats going on?


Looks like either some of the normals are in the wrong direction, or the face winding is all mucked up…

Try setting a CullState that has no faces culled (the default is to cull back faces).

I tried that with the code below.

            CullState cs = display.getRenderer().createCullState();

Front and back culling is a blank screen.

What do you think?

lol, I meant:


I tried setting Cull to none as well.  Here is the image that is produced.

Any more hints?

Weird, first try importing the model into a 3D modeling app (Blender, Maya, 3DS) and make sure everything seems good to go.  (or you may be able just to find a 'model viewer' to check it out quickly)

Also, you might try scaling the mesh; that may re-normalize the normals.

(thats my guess at this point, the normals; but I dunno for sure.  perhaps there are sub-meshes that are being culled…)

I'm certain that the model is fine since the game "Tremulous" displays it without flaw.  I also don't have any tool that is able to view MD3 models.  I have blender, but it looks like the only importer that I could find is some python script that I couldn't get to work.  I don't run windows so that makes those stand a lone md3 viewers useless. 

I can try the scaling option though.  Do I scale the node or the spatial?


This only works for Windows.  They never got around to providing the libs for Linux or OSX (even though on their main page says its linux compatible).

So out of my frustration with the above code, I've tried to resurect the Md3Model that was in JME 1.0.  I've created a test case for it and have bundled it with the above models.  You can find it here.


Here is how you build it

You will need to change the common.xml to point to your jme and lwjgl paths.  If your using mac or windows, then you might need to add more paths to the native_mac or native_win properties in this file.

Also, if your mac or windows, you will  need to change the jvmarg property in the build.xml file to use the native_mac or native_win properties.

to compile
* ant compile

to run
* ant run

So I'm not certain what needs to be modified in Md3Model to get it to work.  I've made it extend Node but in JME 1.0 it was implementing Geometry.

Any help would be much appreciated.

Well after loading the model into 3 'viewers' including MilkShape3D, my conclusion is that it is something wrong with the textures.  Maybe the paths are getting screwed up…

Additionally, I am not sure where you got that MD3 (Quake III specific!) loader but the source looks pretty old… (like pre-jME importers old, the closest date I could come up with was over 4 years ago!)  I would really recommend against using that at all.  Try importing EACH part separately with the Md3ToJme importer (check out the TestMd3JmeWrite jME test for more information) and seeing if individually they look okay…

I have worked out what the problem is with the converter, but don't really know what the fix should be, or even if one is necessary, as it seems to be usage dependent.

Basically the problem is that the model contains multiple surfaces, but only actually needs some of them.

You can prove this by going back to your original code (as in the first example) - and make a simple TEMPORARY change to the Md3ToJme class as below -

    private Node constructMesh() {

       head.numSurface = 1;

        Node toReturn = new Node("MD3 File");

With the above change, the "human_head" model loads ok with the correct textures (the reason yours looks wrong is there is a second surface called "head_helmet" or something like that, and its using that model but with the face texture).
The "human_upper" model contains 4 surfaces (torso, armor, shoulderpads and summink else) - The same kind of problem is occuring there.

Thats whats going wrong, so the proper solution will be enabling/disabling the surfaces you actually wanted (there might be an issue with using the correct textures on them - I havent looked that far so dont know if this is a bug or just wrong code usage) - but I'll leave the final solution down to you cos im off to bed :)

Hail to the king, baby. :slight_smile:

That makes sense now.  There are different surfaces because in the game Tremulous, you can add armour on the fly (they are upgrades).

So I'll look into selecting the right surface (Unfortunatly, I am using my laptop for the next few weeks which has an Intel 945GM and jme doesn't seem to work … stupid vid card). 

Once I get the sufraces to be rendered correctly, is it possible to blend/attach the 3 body parts?  If so, how do you do that?


Also, I pulled the Md3Model code from google code's svn. 

Ok.  I'm back and have a 3d capable pc.

So I've changed models to a quake 3 compliant model.  This new model renders correctly.  Now I am left with the problem of joining the 3 body parts.  I'm not really concerned with seams as I am with making the head follow the upper's animation.  I would also like the upper to follow the lower's animation.

Does anyone know how to do this?  Right now I just add the 3 nodes that contain the graphics/animation for each body part to a root node.  I also tried adding the head node to the upper node, and the upper node to the lower node.  But this didn't seem to do anything.


I was working on some stuff in this area - namely making the loader add the tags from the md3 object to the scenegraph as nodes and animate them along with the mesh. Then you would simply be able to join the bodyparts by parenting one tag-node to the other…

To do this though, I was making changes to things that I didn't like making changes to  :expressionless: - like heavily modifying keyframecontroller to handle the nodes as well as the mesh. This gave me that - this aint right - feeling, so I abandoned it and went a different route - creating a separate animation controller for the tag-nodes…

And then I got sidetracked :smiley:

In the Md3ToJme class, the tags get parsed; however, they aren't being used and there are no getter methods.

It would be very useful to at least get the MD3Tag information so that I know the exact positions of how to put the pieces together.

The next step is handling the animation.  You have already done work in this area.  I am new to how the KeyframeController works so any advise as to how the animation works would be appreciated.