Java .x file loader

http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=share;action=display;num=1093726463



I found this while surfing the java gaming forms. Maybe someone convince him to release it under a license that is compatible with jme? If so we may be able to tern it into a converter depending on how it was written.

I had mention that I got an article that detailed loading .x file its c++ the article is detailed 17 pages to be exact the code however uses an old standard but the theory seems sound it still up for anyone who wants it just cant publish it anywhere, I promised the author

EDITED, as probably x file is too complex, and as the way links were posted were making difficult to read all thread.

If with an old standard you mean directx 8.x, that is what actually output the huge majority of packages…even some just to keep compatibility…



so, it’d probably would be of much use, if so… (i don’t think dx7 would apply…)

Another one.



http://www.gamedev.net/reference/programming/features/skinmesh/page4.asp

It’s the animation that’s difficult. Last check, that loader was only good for static models (animation unsupported), which isn’t very usefull. OBJ is better for static models.



A .x loader that did animations would be really great, but the .x format is pretty complex. If anyone decides to undertake it, they should realize it will be a full time thing.

– EDIT:



TO SAVE TIME TO DEVELOPERS:



It’s then probably more clever to try to use

MD5 format. Specs and how to load here:

http://www.doom3world.org/phpbb2/viewtopic.php?t=2884



– END EDIT



=========

I see…



A simple question from a non coder…



Is it difficult because of the extra complexity of teh format, or because actually , doing a weights and bones importer is complex?



If is due to x is complex (some coder told me there little and bad info about x format, so I just digged for x animation information for this thread) format, some say than more complex than it should…well, a second possibility for weights and bones is md5, as we mentioned before…is way less spread, but at least there now exporters for Blender, Max, Gmax, and Maya (4.5 and 5, not 6, I think) .Which makes enough at least to make stuff for jME games…



I’m told the format is way easier, itself is a game format, so mor eoptimized and quick, and they say is quite easier and…better docuemented (while I keep seing little doc, but probaly is that is not needed much more…)



I’ll provide docs for it here, though started as an x post…



Yes, the only reason for x is: bones and weights animation, and spread in every highend package out there(ie: My xsi exports as x), as if it were just for technically export bones and weights, md5 does that, and does it better, and more featuredly.



And nop, I don’t see it much better than OBJ .Even more, OBJ is simpler, it supports also smooth groups, and x does not. OBJ has no polygon count limit while *.x (like *.3ds) has a 65.000 tris limit.

I have exported a 200.000 tris single mesh OBJ with a gmax script (made by a user, I downloaded that script )



So, in static, the only advantages of x , are the second UV channel, which serves for asigning the lightmap (OBJ does have only one UV channels) , and vertex colors support (obj doesn’t; x does) , good for extra lighting overlayed over thetextures. (if the mesh is well ordered, it can be used for extra lighting in indoors, ie: like cheaper(hardware wise) shaders, I have seen it done it in last job. )



So, is not the first time I hear x loader thing is hard…though, Niko, Irrlicht author, made an x loader. That’s why I mentioned.





sorry, was wrong…seems Maya 6 also having md5 export…XSI, but only through purchasing the doom3 game, and you allways will need to have it installed to export…not a very nice way (for that, I prefer other options…)



md5 format can even be used to export the camera and camera animation path…the dot3 bump normals…or just use it as only bones and weights animation export.



I think jME actually needs one of both, so as seems x is a rock too hard to climb, I’ll put the doce and tools links for md2. (yet though, I’m quite happy md3 support is there, my and my friend will propbably use that as aim to low PCs, but I think jME strongly needs a bone sand weights importer that ta least is on the main packages) :



a converter md5 to OBJ even outputting the *.mtl file.

http://www.doom3world.org/phpbb2/viewtopic.php?t=3209



model viewers, exporters and importers for md5

http://www.doom3world.org/phpbb2/viewtopic.php?t=5474



model format info,(info spread through all 5 pages) though I expect would be quite good thing to download the doom3 SDK, which I think is available freely.

http://www.doom3world.org/phpbb2/viewtopic.php?t=2884



hmmm…ok. A GREAT Source, the sdk2 download :

http://www.iddevnet.com/doom3/downloads.php



You’ll find also above a maya4, 5, and 6 importers . Actually are importers as they import into Doom3, but you need the oficial game installed.



it’s all linked also there, the merseker md5 gmax exporter, der_ton’s Blender and max importers and exporters…another importer…maybe an standalone maya importer (maybe that one does not need the game…then I’d prefer to call it a Maya exporter than a doom3 importer :wink: )



It’s also linked the ORB fantastic tool. A wonderful tool to generate normal maps from a hi res and low res versions of a model, which even also can make the displacement map (soon paralax or displacement maps will gain position over normal maps, probably…)





there’s an easy to understand short paragraph telling how animation works in doom3, great to start with clear ideas, in this page :

http://www.iddevnet.com/doom3/code.php



heck, it’s so good I’ll paste here :



"Anim

The animation system doesn’t decide which animations to play (that is done in scripts), but rather it is in charge blending animations, lerping between frames, blending bone weights, and calling frame commands.



In Doom 3, there are 4 different animation channels (“torso”, “legs”, “head”, “eyelids”) as well as a fifth pseudo channel (“all”). A different animation can be playing on each animation chanel simultaneously. This avoids the quake 2 “running while firing” problem, as well as the quake 3 “my model is in pieces” problem. There is one single mesh, but each animation affects a different set of bones. All of this is handled in Anim_Blend. It also handles blending between two completely different animations (for example when you switch between weapons).



The frame commands (defined in the modelDef) are called from ServiceAnims. Every time it updates the animation, it sees if it passed a ‘boundry’ where a frame command was defined. It is actually really easy to add your own frame commands. You just have to add an item to the frameCommandType_t enum, then implement the case statements for it in AddFrameCommand and CallFrameCommands. "




EXTREMELY good features in this type of animation. I must admit it, that is not in x format, and is quite hard to deal with the problem in x…usually artist just finds other ways…



IK

idIK is the inverse kinematics helper class. It is currently only used by actors to keep their feet on the ground, but it could easily be used for more. It is used similarly to idAF.






Woooooah…they have joint pinning by the engine…heck…that’s even hard to have in the original 3d tool…



Walk Inverse Kinematics makes feet stay on the floor, even when walking along uneven terrain.



Anyway, that’s an engine feature, I don’t trust the format provides it :wink:



the sdk2 is only 11 MB.



The way i see it, the support -thanks mainly to der_ton and Berseker- for Max , Gmax and Blender is WAY more flexible tan Maya’s…



character with bones and weights and animation exporter for Lightwave

http://www.doom3world.org/phpbb2/viewtopic.php?t=4595



Formats documentation (collected in a site)

Parked at Loopia



Well, actually, md5mesh and md5anim (that is md5: animation is separated from mesh, anothe advantage of md5(even separated in layers, and blend of animations supported in the format!) …in x you have all smashed in animation sets in a single file…people parse them out of the x files, when it’s x format) …are ascii files…!



here’s a GREAT (I have used it) model viewer…guess from who…yep…der_ton. :wink: I linked to the very exact last version page thread, at the date I made this post :

http://www.doom3world.org/phpbb2/viewtopic.php?t=1281&postdays=0&postorder=asc&start=60



"I’ve written a short tutorial about loading md5meshes. The only problem is that it is in french. (i’ll try to translate it to english, but my skills aren’t very good). But i’ve written a demo application and since c++ is international, it could perhaps be helpfull Smile

tutorial : http://www.fhtagn.net/index.php?section=md5_tuto1.html

demo : http://www.fhtagn.net/archives/md5_tut1.tar.bz2 (works on Linux, use SDL & SDL_image & Opengl, so should also works on Windows, OSX)
"



And a tip for anyone making an md5 loader :

http://www.doom3world.org/phpbb2/viewtopic.php?t=2884&postdays=0&postorder=asc&start=80





But i insist…the focus must be on the very last format specs…I’m having a hard time to find them…



yay…I think I have found the latest…is version 10, I think…here…

http://forum.games-creators.org/viewtopic_6760.htm

In that page, I have found a .h and .cpp that are parsers for the md5 format, as are in same thread, surely for md5 game version!! :)))

Have downloaded it all…



a link for a parser lib for md5

http://forums.caligari.com/gameSpace/showthread.php?t=2160



Thi slooks to me it could be also a solution… :slight_smile: :slight_smile:

http://cvs.sourceforge.net/viewcvs.py/epfl/tgengine/md5mesh.cc?rev=1.17&view=markup



I am not a coder, but looks like c code to load md5mesh and md5anim…

surely you can translate it to java, but you must be sure to make it compliant with game release md5 format…



Some said that animation is really easy part in md5.



Gmax exporter for md5. (not sure if in iddevnet the version is mor eupdated, but surely both are fully functional.)

http://www.doom3world.org/phpbb2/viewtopic.php?t=4618&postdays=0&postorder=asc&start=20



Actually I think the md5 specs are really on that very first post of Bozo in that 5 pages thread. With some loading code in it, completed in bits in therest of 5 pages…

http://www.doom3world.org/phpbb2/viewtopic.php?t=2884



as I said, in the sdk, there’s probably important code and info.

there’s also an md5, done for the game, The Imp. Great to use as a reference model to help you in coding. Together with Der_ton md5 viewer, it must be much easier than coding other formats that have not so much resources available to make the loader.



Not very sure, but i think here’s oficial info on the animated stuff of the format, in Id’s site :

http://www.iddevnet.com/doom3/afs.php

http://www.iddevnet.com/doom3/models.php



more info:

404 De pagina is niet gevonden







I just put this md5 info 'cause, as happened before…it turns that md5 is an easier way for coders…And a friend told me recently that …x files are not though for games, but 3d applications and that…carmack knows his stuff… :wink:

the article and its source is fully functional animation and weights are support and more importantly utilizes only opengl no directx whatsoever, its also well explained. I understand what needd to be done and I’m not a programmer, thats my problem, I dont have the expertise to turn that understanding into code.



but I’ll continue to try

another code-tut for md5 v10.



http://www.fhtagn.net/index.php?section=md5_tuto1.html

Heh, here I am trying to figure out what the best model format to use for exporting models into the jme format with bones animations and I smack right into this thread… meantioning my currently defunct .x loader… I wasn’t aware of any licensing restrictions on it preventing others from continuing work on it (indepedantly or not). I’m just getting started with jme, but it’s a good possibility that I’ll resume work on the .x loader (especially if it’s the best way to handle skeletal animation…).

dunno…I think the general line is keeping a native jme format and do converters for the format.



Yet though, I suppose there’s no harm if an x loader exists, even “not oficial”, many of us artist would benefit for it…



If you finish the x loader to load bones, weights, animation(spline interpolation, please… :wink: ) , and of course the usual uv, texture, and vertex normals…then it’d be great if the oficial team does like an md5 to jme format converter, that’d cover any package out there for bone-weight based character animation…

Well, if he does a “Loader” it’s trivial to turn it into and “Exporter”. The .jme format is constantly evolving to include features it needs.

“.x loader (especially if it’s the best way to handle skeletal animation…).”



No. Probably that one is md5.Which also is free and open (also ascii)



The advantage of x is can be exported from more packages.But the doom3 modding comunity works at high speed producing new plugins…





I know from very good professionals that md5 would be much easier to use and parse for the coders, though.



I have no clear which then is more convinient.



Also, more people are familiar to x, so, …I think itd be great if u fibish the xloader.



Athread that is about this, right now…

http://jmonkeyengine.com/jmeforum/viewtopic.php?t=1315





–oh–seen now the mojomonk post…



Dank , seems it’d be quite useful if you provide jme with this.



You have my vote :slight_smile:

dan has finished his .x parser. it passes all the information that is needed to load x files, his knowledge of jme is still limited so he is not able to convert to jme write the animation controller at this time,it can be used with the present joint controller but would rely on vertex duplication to compensate for the lack of weights support in jme the mesh/bones requirres matrix math stuff that is out of my league at this time but I have documents that can help if needed



http://dan.gufbal.com/xloader/xloader.jar

http://chortle.ccsu.edu/VectorLessons/vectorIndex.html



Handy little tutorial for the math needed for 3d stuff, not that I’m an expert, but this explains the major stuff…



The vertex duplicate information is used for uv mapping, and isn’t really related to the weights, I don’t know exactly how they work though. Joint controller might work, but someone would probably want to run through the file and find any joints that have shared verts and pick a joint to assign them too based on the ratios. It’s a work in progress (though I’m busy on a different project right now and probably won’t get back to the .x stuff for a while).