md2 pcx


I’m testing some md2 models from polycount, but they use pcx texture files.

How do I get textured md2 models into jME that use the old tris.md2 and a .pcx texture?

I notice the Dr Freak model test is using a jpg texture?



There is not a loader for .pcx images, so you’ll have to convert the pcx into one of the supported formats (jpg, bmp, tga, etc).

Did that before this post (converted to .jpg) , tested, but got an untextured figure.

Doh…Must refresh in eclipse to reload the directory:-)

Thanks for the memory jog.

The texture coords have gone a little screwy.

You can test it yourself if you have time…cool astro boy:

as against


I suspect the texture (pcx to jpg) coord problem has something to do with the original textures not being powers of 2?

Anybody know of a way to reskin or fix this with these md2 models?



md2 is an old, ancient, arcan format… :wink:

It was used pcx by then, and often the tools limited to 256 colors, 8bit.

MD2 get linked the skin internally. So it depends on what name was it using, just that. The texture, fortunately you can change it for a better graphic (ie: pcx24 bits instead of a 8 bits pcx) , but not name+extension.

You actually need a tool for re asign anothe rskin to it.

Several ways :

-Blender (need knowledge in real depth of it. Forget it if u don’t , already…) Not the quick task type of thing for what u want now…

-NST (what I’d use if I were you, probably) .A really nice free tool to not only texture a model, but also even generate the uv map, and even do some 3d painting (only for marking, is no good for accurate finishing th etexture, that’s done in a 2d package)

The texture can allways be worked out or changed totally provided you just keep the name. You can use different skins with an md2, if u just keep same name and extension.

-Max has qtip, there’s a free version somewhere…an md2 import/export plugin. It should be quite easy.

-There’s an md2 importer for gmax, and somewhere, -i have it- an md2 gmax script to export md2 files…

NST tool only supports BMP (while there’s a compressed format, rle, you could save with a tool later on with rle compression, but is very low compresion) …if it’s a matter for you, you can still use Gmax, which is free, and can use any texture format. Or Max. Or Blender.

NSTv09b3 is available through a link in quake2 resources at polycount, I believe.

I can dig for the other options if ur in the need,but now a bit in a hurry. Tell later which u decide, and if I don’t miss this thread later on, I’ll answer again to what you may ask.

Oh…the tools (for example quake modeller) sometimes wrecked the UVs, that can happen. More unlikely to happen with Max or Gmax.

Hey Snaga,

Yeah, I know md2 is old but I’m doing some prototyping and am after some quick test models to help define the look and feel. Polycount had a few so I thought I’d try the jME importers :?

I have a little experience modeling and with the 3d programs, but that’s not my strength. I’ll hook up with a real modeller/animator if I go to the next stage.

Got the latest NST (thanks) and resized to 256*2 and re-exported astro boy.

Looks fine in NST but still gives some texture shearing when imported into jME.

Not sure where the problem lies. Has anyone else had problems with md2 textures? The docs a little thin on the texture params, but I’m just using the linear setting from the DrFreak md2 demo. Tried a few others bur no apparent effect.

I’ll try a new skin in NST if I get the time.

Many thanks for the help.


the thing of power of 2, could be, too.

oh, have you seen that md2 license?

is like most polycount models, if not all…for the game to mod only, quake2…


Please ask if you want to use the model for anything other than

personal use as it is explained here, particularly if incuding it

in a patch or add-on.”



old qtip plugin for i/o for Max. Works till Max5, surely later on versions too…this is the old freeware, non limited version… - This website is for sale! - worldzone Resources and Information.

NST 0.9 md2 skinning tool (it preserves ALL animation!! :slight_smile: )


md2 max and gmax import plugins.

edit, hadn’t updated the trhead…reading now ur answer…

So, only prototyping. Forget the legal issues I mentioned.

As allways, post an screenshot were in a good size, are seen the probs…The shear could be of many types, many different problems. I have come up to many, not only with md2.

I’ll probably know when seing.

You resized the texture? that’s no good…the UVs should be resized, not the texture…

Even much, much better. Upload your md2 with problems. I did download astroboy original, so have the ref to check differences. I’ll see what’s happening with ur md2…

Upload it somewhere if u can…

I have Gmax, Blender(import+export, any 2d graphic format) with md2, Quake Modeller, and NST. And know how to use well all of them.

Oh, the importer md2 for gmax, is easy to find -the link- but not the exporter script. I have it, though. I don’t have a site to upload useful tiny files, if not, I’d directly upload all of them.

I don’t know coding nor jME, so I dunno if u refer to the probs are after a conversion of the md2, and u have now an “ofending” md2, or is that once inside in jME engine it happens. In some case it’s about scaling uvs slightly. In many other case, it’s weirder to guess what happens, but I already know several of the probs.

A third option, more powerful (as format is slightly better) is make a conversion md2–>md3 with another nPherno tool : the nmd3c compiler.

(there’s a single piece models -alla md2- loader, that also loads models with tags(i don’t like tags) if present, for jME. )

But…I have it too installed and know the deals. So, what I told you, upload the problematic md2…

Try this jME program. I just opened the astro.pcx and saved it directly as a .jpg (no resizing). This gives the same look as resizing to 2562 in NST, so the "problem" md2 is just the same as the one you downloaded.

Q: Qtip looks like it only imports animation frames, not.md2 files?

package jmetest.renderer.loader;


import com.jme.scene.model.XMLparser.

import com.jme.scene.model.XMLparser.Converters.Md2ToJme;

import com.jme.scene.Node;

import com.jme.scene.state.TextureState;

import com.jme.image.Texture;

import com.jme.util.TextureManager;

import com.jme.input.KeyBindingManager;

import com.jme.input.KeyInput;

import com.jme.math.Vector3f;

import com.jme.animation.KeyframeController;

import javax.swing.;




  • Started Date: Jun 14, 2004<br><br>
  • Test class to test the ability to load and save .md2 files to jME binary format

  • @author Jack Lindamood


    public class TestMd2JmeWriteAstro extends SimpleGame{

    float totalFPS;

    long totalCounts;

    private KeyframeController kc;

    private static final String helpMessage=“Fun with KeyframeController and md2 models. Keys are:n” +

    “R: Make drFreak runn” +

    “H: Make drFreak attackn” +

    “Z: Toggle repeat type wrap and cyclen” +

    “E: Do a quick transform to the beginingn” +

    “B: Do a smooth transform to the beginingn” +

    “Q: Do a smooth transform to drfreak’s deathn”;

    public static void main(String[] args) {


    TestMd2JmeWriteAstro app=new TestMd2JmeWriteAstro();




    protected void simpleInitGame() {

    Md2ToJme converter=new Md2ToJme();

    ByteArrayOutputStream BO=new ByteArrayOutputStream();

    URL textu=TestMd2JmeWriteAstro.class.getClassLoader().getResource(“data/astro/astro.jpg”);

    URL freak=TestMd2JmeWriteAstro.class.getClassLoader().getResource(“data/astro/tris.md2”);

    Node freakmd2=null;

    try {

    long time = System.currentTimeMillis();


    System.out.println(“Time to convert from md2 to .jme:”+ ( System.currentTimeMillis()-time));

    } catch (IOException e) {

    System.out.println(“damn exceptions:” + e.getMessage());


    JmeBinaryReader jbr=new JmeBinaryReader();

    try {

    long time=System.currentTimeMillis();

    freakmd2=jbr.loadBinaryFormat(new ByteArrayInputStream(BO.toByteArray()));

    System.out.println(“Time to convert from .jme to SceneGraph:”+ ( System.currentTimeMillis()-time));

    } catch (IOException e) {

    System.out.println(“damn exceptions:” + e.getMessage());


    TextureState ts = display.getRenderer().createTextureState();









    freakmd2.setLocalTranslation(new Vector3f(0,0,-20));


    kc=(KeyframeController) freakmd2.getChild(0).getController(0);


    // Note: W S A D Left Down Up Right F12 ESC T L B C Already used









    protected void simpleUpdate(){

    //Stand1-40 0-39

    //Run1-Run6 40-45 (flying position)

    //Attack1-8 46-53

    //Pain1 54-57

    //Pain2 58-61

    //Pain3 62-65

    //Jump 66-71

    //Flip 72-83

    //Salute 84-94

    //Taunt 95-111

    //Wave 112-122

    //Point 123-134

    //crStand 135-153

    //crwalk 154-159

    //crattak 160-168

    //crpain 169-172

    //crdeath 173-177

    //death1 178-183

    //death2 184-189

    //death3 190-197

    if (KeyBindingManager


    .isValidCommand(“start_run”, false)) {



    if (KeyBindingManager


    .isValidCommand(“start_hit”, false)) {



    if (KeyBindingManager


    .isValidCommand(“start_end”, false)) {



    if (KeyBindingManager


    .isValidCommand(“start_smoothbegin”, false)) {



    if (KeyBindingManager


    .isValidCommand(“start_smoothdeath”, false)) {



    if (KeyBindingManager


    .isValidCommand(“toggle_wrap”, false)) {

    if (kc.getRepeatType()==KeyframeController.RT_CYCLE)







I am afraid I can’t code, not even have jME installed…just an artist…

But if you post an screenshot, I may have some clue.

Sometimes is just the mipmapping, solved scaling the uvs, or etc.It depends.

Original from NST showing correct mapping:

jME (from program above) with astro.pcx renamed to astro.jpg:

What you need to do is convert the pcx image to jpg, then not resizing the content, just expanding the edges to get a power of 2…then fill the remainder with black.

I think that worked the last time i tried…Can’t remeber tho…


But as snaga says:

>>You resized the texture? that’s no good…the UVs should be resized, not the texture…

Anyways, only takes a minute so I tried that…no luck.

Original pcx converted to jpg. Size is 296164:

next highest width is 512
256 (also tried 512*512)

Even worse.


no, nope, sonic…that’s not what the thing is needing…

You actually need to keep coords relative to pixels…

when u resize astroboy texture, ur not resizing accordingly astro boy UVs…that way, there’s not the same relation…

NST 0.9b3 has the feature(I have solved it now PERFECTLY, I have no site to upload, if not, I’d provide u the fixed md2 ready to go in jME…) :

You only gotta do this:

-Load NST. When says this md2 has not…discard, discard. Don’t worry.

-Now, in open menu. Open the md2 you want.

-now, just gotta do this: “Skins” top menu…“Re-size All” option…

-UNMARK enforce limits. Leaving it checked wont let u go to 512x512.Why? well, because md2 limits used to be 640x480 limited (so, height would not go) …leaving limits check box blank, allows you. Modern engine allows more size, I’ve checked so many times. Sure jME too, though being md2.

hehe, that in other package would be a bit more tricky, but nPherno did very specialized good tools for the time…

It does actually resize both texture and UV mpaping!

To do this if not, would need the use of Max, Blender or Gmax. As NST is the only one importing and exporting animation, does not destroy it, while Lithunwrap, Milkshape, Ultimate Unwrap, can only take one frame.

So nPherno is your tool :wink:

of course: Save as BMP. A 512x512 bmp is something anycard today can eat. And so, you’ll be free to lossless edit the bmp later, as you’ve resized the pixels inside nphero: u may wish to add more detail in painting, improve it a bit, in an external 2d package. Can be done, only saves as same name and extension.

Indeed, ur increasing the pixels size:it should be improved detail, as u have more pixels, but for ur tests, it actually does a perfect job, if u only do what I told u (don’t select or move the coords or anything, just those steps)

This way u convert this md2 in same animated md2, but with 512x512(well, I wrote that, is a good compromise size/quality for an md2, today) instead of that 296x164 or something like that.

You actually were adding extra space, were enlarging the canvas , not the picture, and weren’t doing accordinly so with UVs. NST way is fraking more quick and accurate than u even would do with a higher package… :wink:

next time, a tut on how to convert an md2 to an md3, with the other tool, npherno md3 compiler :wink: (you can even add morph targets…)

MD2 has a limit in most packages I know to export of 4096 tris, and md3, of 8192. texture limit in md3 is higher, but as u see, texture sizes seems can be override.

Worse thing in md3, imho, is use it in separate pieces like quake3 did…and in both md2, md3, that UV limits need to be well hidden in hidden parts of geometry as it create geometry seams there.


lost some step…

-after “save as” the model, as an md2 (allways keep a copy apart of the original md2 model) same name to make things quicker and problem free, you need ALSO to export the skin, the texture. As with resize all, what u’re doing is resizing accurately both UVs and texture, but u must actually export the texture :

  • skins top menu. put a name there.

    After that, skins menu again. “Link” I think this is what actually asign it to the md2 internally. So, seems it stays in the old standard of md2 only loading pcx. The bmp save as option I think is there for just save as a reference file, in case you like more bmp (pcx supports rgb, too, you can edit it and save as pcx in many 2d packages, later on, as u 'll want more than 256 colors. while u keep the name and extension…)

mmm…I think I understand your process, but it still looks the same after I did that.

. load md2

. resize all to 512x512

. save as pcx and bmp (as jME only accepts bmp)

. link to new 512 pcx

. save new md2


hmmm…no way…

save as bmp wont allow you to link it…it only links pcx.

(link is to pcx only.BMP has been provided for ref paiting, in other 2d tools not having pcx by those ages, I am afraid…not for actual linking internally)

so, if jme never loads a pcx, we’re stuck…Or not.

Look, a great tool I used in the past :


I also tried this:

Opened astro boy (all the time I had been checking the md2 in the non nagged 3d exploration 1.5(later versions are days limited), as shows well animation) in Blender. Imported ok. Had to remove doubles, reclaculate normals outside, and reasign material and texture. Easy (for a Blender user, for a non user, impossible to learn in an afternoon…) stuff…i had here the md2 import/export plugins. They’re not online now, as the author’s server is down till dunno what month next year. Again, if someone is kind, I can upload a set of tools somewhere.

But well, they worked as charm. Imported the (already fixed in nst) md2, fixed the mentioned stuff, asigned a jpg version of the 512x512 resized texture (UVs already resized, as is done at a time in NST) …I mean, did that step only to test once more Blender md2 importer, and to check that is one good way to add other texture format, like tga , png , or jpg.

Worked well…but…hey, no! it really worked well…!

I was noticing kindoff like the puppet going to a lower Y position, but it was already in original file for some reason…maybe quake engine related…huh…

Well, it works…I have a place at sharemation…gonna try to upload now…

(the only way to go with NST was PCX, so, no way with NST alone…and the md2tool, while is great for other fixings once md2 is compiled(life saver) seems it just suppot pcx…who knows if one could find some tool to write the internal md2 binary file and just change the name of whatever.pcx to whatever.jpg or png, as is just that SILLy thing…lol… I mean, NST would suffice, if so, and u see, for textures non powers of 2, is dumb easy and short proccess comparing to the blender, max or gmax steps…of importing and reasigning an md2 skin. And some fix. For me it’s easy…now, that I discovered certain stuff…but… )

…so I’ll upload a functional md2 for u.

BTW, it walks very slightly I almost don’t notice it…but seems is how the original animation is, as see the same in original tris.md2 with othe rviewers.

Also, this proccess I sucessfully made with Blender, can be done too with Gmax, and Max, and like always, the needed plugins. Though those aren’t either easy to find. (again, I have them, hehe)

For curiosity’s sake. The list of commands of this md2tool ms-dos thingie… :

md2tool v1.2.0 by Jaakko Kerõnen [edited to avoid spam on his email…]###

Usage: md2tool [-flip] [-renorm] [-dsk] [-s <skinfile>]
[-skin <num> <skinfile>] [-del <num>]
[-delframes to|from|<num> <num>] [-delskin <num>]
[-skinsize <width> <height>] [-gl] [-info] [-create <framelistfile>]
[-md2] [-dmd] [-savelod <num>] [-lod] [-ef <num>] [-op <num>] [-tcmap]
[-mg] [-fn <filename>] [-weld] [-weldtc] model[.md2|.dmd] ...

-create Create an empty model based on a frame list (each line specifies
a frame name, empty lines are skipped, comments begin with ; ).
-del Delete one frame.
-delframes Delete a range of frames.
-delskin Delete one skin.
-dmd Save model as DMD.
-dsk Set skin zero to the default skin name (model name + PCX).
-ef Set error factor for mesh optimization (default: 1.0).
-flip Flip triangles. Automatically builds GL commands.
-fn Change the name of the model file.
-gl Build GL commands.
-info Display model information.
-lod Generate detail levels (automatically saved as DMD).
-md2 Save model as MD2 (the default).
-mg Display triangle groups in the texture coordinate map.
-op Set the number of mesh optimization passes.
-renorm Calculate vertex normals.
-s Set skin zero.
-savelod The level to save when saving as MD2 (default: 0).
-skin Set the specified skin.
-skinsize Set skin dimensions.
-tcmap Display texture coordinate map when optimizing.
-weld Weld vertices (only for models with one frame).
-weldtc Weld texture coordinates (removes all duplicates).

Sounds good…let me know where/when.

If that does not work then it may be a problem with the jME md2 import?




You have a -pretended to be- fully functional md2 file, linked internally (supposedly: my last doubt is…the format wont understand other texture than pcx, if so, jME would be lost, but no, can’t be…we’ve seen demos of md2: mojomonk must know a way to tel internally which texture file he wants ) But if there’s not such format limit…well…I told in blender to save as a linked jpg…

I sent the link by PM, as bandwith there gets ate each hour with very little, so, only chance is for you to download privately…

If it doesn’t do so, the pass by blender is not useful…

the easier for you for future md2, is…only NST, so, the key fo rease workfllows for coders, is find a tool to write in the md2 file, internally, to tell it, hey, what I want is THIS jpg, not THAT pcx… :wink:

I mean, with NST, and resize ALL, you’d be done if there’s found a way, wether in jME code, or a tool I may find to write an skin name change in the variable it may use the md2, for the skin to use… the ms-dos “md2tool” I think changes a pcx…for other pcx…name.Not extension…grunt…

Sorry, can’t access the file.

Say’s I need a userid /password for the sharemation account.

argh…bandwith and share policies…grunt…

PLEASE, read this post fully. And execute my reowrked tutorial in this post. Now is FULL, not letting any step out. It will let you edit any md2 at your will, not needing me or any gfx guy anytime you want to prototype.

I’ll pass you another ones…these one will work for sure.

check your PMs

just please, don’t share this url with anyone…

If you read my last posts…

I was telling you a way that allows you to both allows to resize uv and texture and uvs accordinly to become a power of two texture+letting uvs keep well the new relation, AND link internally the md2 to a JPG instead a PCX, even the NST tool not understanding what a jpg is…a dirty but seems that effective trick, as I realize in 3d exploration it says the material link is astro2.jpg, the one I set. Though it does not show automatically…hmm…should test with another viewer as I don’t know java coding to test in jme… The final key to that was putting short names file in short names folders… Put th one I exported with NST only in c:temp …

Ok, once again, more complete quick steps tut… (This is the NST only method, not the Blender 2.35 method. WAY easier for any coder…)

  • PLEASE…copy the zip file into c:/temp (exactly the one I used) or c:/md2, but just a short name, in a first hd level. Decompress just there, not in the deep folders it will make (just drag and drop files from the zip into the folder.)

  • Open NST 0.9b3 (b3 refers to beta3. Grab this one or someone share some space where I can upload.)

  • Say to no when asks something about your base folder , at start.

  • FILE/OPEN …choose the original MD2 file, that you have decompressed with all the dat in same folder: the md2 and the texture.

  • Ask now YES when asks if wanna use base folder for skins (it asumes base folder now where you are loading the md2 from)

  • menu SKIN/Resize-all procedure explained before. (just like it, enforce unchecked, 512x512, etc)

  • Menu SKIN again. SAVE as to save the skin as another PCX (like astro2.pcx )

  • go to your windows explorer, or directly MY Pc, how you move in ur windows, I mean, outside NST.

    -Find that astro2.pcx. Open it for example with the freeware fantastic viewer/converter Irfanview ( ) . Save it now as JPG. astro2.jpg .

  • Back to NST. Menu SKIN . LINK (it want let you if you already linked one before by error or soemthing. If so, just choose UNLINK, and then LINK again…) . Now it will let you choose a file. ( For all my tests, it seems this is really the texture that will matter inside the md2 file) Set "SAVE AS TYPE" in the dialog(typical windows one) to allow to choose "ALL FILES (.)"

  • Choose the astro2.jpg you created. You’re almost done.

  • Ok, you still are looking at a nice skin, as you just loaded before a pcx (when u answered “YES” it to load “from base folder”(where md2 was opened from, it just shows that one resized by u.)) …but if u look up there at top tool bar, there’s a line where says “skins” .You wont see things clear if used other folder path than a short one, as I sugested (did so as if not, NST does not link well thepath, for some reason.Does not write it complete if not) …you will see…a LINKED ON icon (like a connected chain icn) and just besides, the text path saying “c:/TEMP/ASTRO2.JPG” .That is telling you the md2 you will save NOW (and not before) will have the JPG linked to it. Though it is visualizing the old pcx (happily, as it can’t visualize jpgs or other thing than bmp/pcx)

    -Very final step : FILE menu. SAVE AS. Choose same folder we are using (ie: c:/temp if u did it all in that one) and put a name different to original md2. Like…NST.md2 …or whatever.


    The files you need to care now to load in jME are NST.md2 and astro2.jpg (or other extension, if u used other file type: the cool thing in this step by step tutorial, is when you hit all files, you could have done the conversion to any file oustide in irfanview from astro2.pcx to ANY file format…)

    You don’t need my files, he result of thi stutorial, or the blender example I did yesterday with BLENDER 2.35 and Bob_holcomb md2 import/export plugin…

    …but…to make things even easier, I am sending you a new link to download by PMs. PLEASE, the only favour I ask u in exchange is…Try both NST md2, and blender md2. Decompress each zip in a different folder, and try to load into jME. I want to know if it is possible in both cases: as it will leave clear if both Blender and NST , each alone, can be used as optional ways to do md2 for jME. In the case of NST, is great to fix/edit an existing md2, great for any coder that is in prototyping stage like you. The case of Blender, is great for artists that may come to jME as it’'d be proving the full way, not even could generate an md2 from scratch in Blender, but also act as NST like converter (but multiplatform: for Mac, win and linux,as u don’t need nothing else (perhaps Gimp or the like to convert externally the PCX to jpg or whatever))

    I am interested quite a lot in both ways.

    WHo knows if my own game will be using md2 of some sort. I doubt it as MD3 is better,(mainly: no trembling of vertices for the abscence of floats in md2. the 4096 tris limit is buig enough in md2, though ) but you never know.

    Ideall, we’ll use md3, or better, some sort of bone-weights format like md5 or x. Whatever comes …

    But is great if you test the two files and work: would be proved a pair of absolutely free ways, to ouput md2 for jME in a very customized way, giving full freedom for whatever the need.