The demo should be able to load and display any static .x model, vertex colors aren't used in the demo and only texture information is implemented for materials (the information is there, I just chose not to implement it for the demo). Let me know if it's useful to anyway.

How far do you plan to take your loader, as I've stated skeleton code and animation is probably as far as I'd go, are you planning to write a 100% complete .x loader (such as support custom templates and such)?

BTW, do you have a .x models you could share for testing purposes, I'm having a hard time finding any on the web. I could convert one but I'm hoping to find one written by a different program in case I'm relying on formatting that may not be 100% reliable. The model provided in my demo was written with gameSpaceLight.

The formatting is what has given me the most grief really. I have the models from the DX9 SDK download, and I have some models exported from 3d modeller. Its been quite hard to make them compatible. I havent got as far as considering animation. I did find the Irrlicht engine to be a useful reference for a way to write a loader.

I believe the above is considered OK for a .x file, basically it probably means any time I grab something I expect to be a variable, I should check to see if there is a { or } in it and if so assume it's a variable reference.

To handle this within the current code of my loader, I would probably create a Vector in XModelData called templates, and whenever I ran into a template (such as Material) in the main parser I would call my parseMaterial function but pass it a null for the object it'd normally store things in (MeshObject in this case), when the object is about to store the new material it'd check if the MeshObject was null and if it was, it'd automatically stick the new object into the templates Vector.

Back to finding a { or } when I expect a variable, when this happens I can go through the list of template objects looking for one with a matching name, and if one isn't found, I would then look through the rest of the data tree for a matching name. I know that for a variable to be referenced by a name like that it has to be defined in the file before it's used, I'm not sure if it's particular about heirarchy or if all variable names are supposed to be unique in the file. Anyway, I don't think this would be a big issue to support this format feature, depending on the below stuff. The page I linked to for format information actually uses a similar object as an example (which I hadn't noticed before today) so it's probably pretty common to have some stuff defined globally.

Things to know before I try to implement this.

Can two different materials (most likely inside different Mesh or Frame sections) have the same name, or are the variable names intended to be unique?

Assuming names are unique, in a multi mesh object, should the second mesh that is defined be able to make reference to the first meshes materials by name, or should it only be able to reference those materials defined globally (such as the example posted above).

Can a variable be defined anywhere, or just globally or can a material be defined inside frame (or for example inside animationset)? I'm praying it's global only.

Can any variable be a reference to a pre-defined variable (I believe yes, but I haven't tested this out).

Just a note but gamespacelight didn't like it when I tried my { Zero } example with the transform matrix. That could mean that it's not necessary to watch out for variables referenced by name all the time, or that you can't define a variable like I did using a primative type.

You have sample character animated x models at psionic3d.co.uk Totally free (there are other per pay, of course)

Also, you have an x model in Irrlicht main package (but beware, it has a keyframe every frame, which is not usual, -nor clever for a game- , it is so as was though for a quick game, in md2 format, as you know, md2 it's not dealed with bones keyframes) at irrlicht.sf.net

The irrlicht engine author made an x loading code for it. You may ask him for help about it, he's a very gentle person. Or at least, you may see the code he used for it, as a clue.

Please....please...make it in a license of the type that could jME java game engine use it... I'm an artist (worked already in some companies) planning to develop a game with a great java coder friend of mine... We can't make a big game as we're only two, but we plan to do that little with quality...

The x boned and weighted format would be really great to have...Most packages have export of x, via free plugins. (Maya, Max, XSI(I have this), Character Fx, Lightwave, Hash AM(comercial plugin), Blender, and many others have it...)

BTW, the dwarf included in...(a bit embarrased about it) ... Irrlicht engine... I made it. It was made as a joke for some friends that wanted to code a mini game in some days, southpark-like characters in medieval times...a joke. (and a really quick/dirty made)

So , the model is a bit crappy, but served Niko (Irrlicht author) for his testing and coding.

I have also helped a lot with conversions, explanations, tutorials, in those open source engine forums, about the x format, how to make the exports (artist side, only) , and many, but many 3d related questions, as I have been several years, and made this somewhat my profession to make a living of it. And I like to think that I can sometimes if time allows(lately it doe snot allow so much, sadly), give some help.

I helped making the x exporter for Blender (and now it works) , and with the testing/art side help for the Urgh engine, that also made a great work to allow import of x files into his engine.

is the most spread way to import animated character files in 3d packages. And it works in any platform, mac, linux, win...

I hadn't been checking my yahoo mail lately (oops) and didn't notice people were paying attention to this thread again.

My use of Vector was a matter of being familiar with it, and it's 'safe', and despite being synchronized I never felt that it was making a big impact on speed.

On the package name, I'm not sure why I didn't cap it, I read suns naming convention thingy sometime around 1997 or 1998 and while I always tried to use the conventions, I um, probably haven't ever read it again since the first time (not to mention I'm damn sloppy anyway).

Probably the most important thing is, I have not made any improvements, changes, or what not to this chunk of code in at least 6 months, and since I've actually stopped developing games in java (despite now being the best time ever to be doing it thanks to java-gaming.org and a few others) it's not likely to get much else done to it by me. The code is free to use, and if anyone wants to take it over in a more official capacity I can set it up so that they have access to the website that it's currently hosted on, or change the pages to point to their own web site of choice. To insure a prompt response mail me dan -AT- gufbal com . I'm off to go make note of this on the website.

I've updated the loader, I no longer have a demo available for it, jogl makes my new computer angry so a demo will most likely use LWJGL or JME (over LWJGL) if I write one.

This version should handle the inlined materials without a problem, posted by jacko so long ago, as well as inlined meshes (and inlined frames... necessary for animation). This version also reads in the AnimationSet, AnimationKey and Animation portion of the files. Skeletal animation is possible, however the .x format is a little vague on what a bone is, basically every frame seems to be considered a bone (even a static model will have a frame... presumably just a main bone to the dx engine).

Anyway, thought I'd mention the update here, to my knowledge no one is actually using this for anything (including myself haha) but possibly someone has used it for reference purposes. A small note, loader.java has been changed to Loader.java, but I haven't bothered to change my Vectors to arraylists...

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org