EnglishGermanFrenchRussianItalianSpanish
Log inRegister
 
[Tool] .xmf/.xac <-> .dae converter
Post new topic Reply to topic Goto page 1, 2, 3 ... 9, 10, 11  Next
View previous topic :: View next topic
Author Message
arc_





Joined: 07 Dec 2013



modified
PostPosted: Tue, 24. Dec 13, 20:25    Post subject: [Tool] .xmf/.xac <-> .dae converter Reply with quote Print

This tool converts .xmf files (X Rebirth static meshes) and .xac files (EMotionFX actors) to and from .dae. The current version is 0.2.1 and can be downloaded here:
Converter
Source code (C++, VS2010)

Usage:

  • If you haven't already, extract all of the game's .dat files to some folder (eg using XCatTool).
  • Find an .xml file that you want to edit, e.g. assets\interiors\crates\interiors_crates_size_l.xml
  • Launch XRConvertersMain.exe from the command line, passing it the path to the folder where you extracted the .dat files and the path of the .xml file. For example:

Code:
XRConvertersMain.exe importxmf "D:\X Rebirth files" "D:\X Rebirth files\assets\interiors\crates\interiors_crates_size_l.xml"


  • The converter will convert all the .xmf's referenced by the .xml and put them in a .dae file next to the .xml.
  • Edit the .dae file in a modeling program of choice.
  • Once you're done, run XRConvertersMain.exe again with the following arguments - it will overwrite the .xml and .xmf files:

Code:
XRConvertersMain.exe exportxmf "D:\X Rebirth files" "D:\X Rebirth files\assets\interiors\crates\interiors_crates_size_l.dae"

Collision meshes and LOD meshes are indicated by a naming convention ("Xcollision" and "Xlod0" suffixes). The same goes for the material assignment ("collectionXmaterial" suffix in the node names).

Limitations:

  • You should only move nodes in the .dae file, not rotate or scale them; the converter will ignore such transformations (since I'm not sure how and if the .xml files support this). Rotate and scale the actual meshes instead.
  • Material definitions in the .dae are ignored, the converter simply takes the material name from the node name suffix and assigns that (i.e. you can only use materials that are defined in material_library.xml, be it by the game itself or an extension).


For .xac files, the steps are mostly the same. Simply specify an .xac file instead .xml, and use "importxac"/"exportxac" instead of "importxmf"/"exportxmf".

________
In case other people want to make tools that work with the X Rebirth file formats, here's some information about them:
.xac (NPC meshes)
.xmf (static meshes)
.xpm (morph-based animation for NPC's)
.xsm (skeleton-based animation for NPC's)



Last edited by arc_ on Tue, 24. Jun 14, 21:42; edited 7 times in total
Back to top
View user's profile Send private message
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)

MEDAL

Joined: 20 Nov 2005
Posts: 13614 on topic

Thank you for registering your game
PostPosted: Tue, 24. Dec 13, 20:32    Post subject: Re: [Tool] .xmf <-> .dae converter Reply with quote Print

arc_ wrote:
Limitations:[list]
[*] You should only move nodes in the .dae file, not rotate or scale them; the converter will ignore such transformations (since I'm not sure how and if the .xml files support this). Rotate and scale the actual meshes instead.


Code:
<connection name="ConnectionFor_units_size_l_carrier_kit_extender1_b_2" tags="destructible">
  <offset>
    <position x="-3.415958E-05" y="-45" z="19.07472"/>
    <quaternion qx="0" qy="0" qz="1" qw="0"/>
  </offset>
</connection>
taken from my Rahanas Hybrid Plus-Mod Wink first three are rotation (qx, qy and qz ), but not sure what qw does..


_________________
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter Wink

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help Wink
Back to top
View user's profile Send private message
TargetLost



MEDALMEDALMEDAL

Joined: 23 Nov 2005
Posts: 465 on topic

Thank you for registering your game
PostPosted: Wed, 25. Dec 13, 17:15    Post subject: Reply with quote Print

The Rotation is described through a Quaternion. A very interesting not quite easy to understand mathematic construct. You can google or wiki it up.

It always has 4 values and when its used to describe a rotation they are always normalized.
That means the absolut value or the length is always 1.
sqrt( qx^2 + qy^2 + qz^2 + qw^2) = 1

I believe the standard initialisation is qx="0" qy="0" qz="0" qw="1"
not quite sure about that and then you rotate it to what you want to have.
(there are formula for this)

Quaternions benefit are that you dont have a gimbal lock problem like you have it when you operate with Euler angles as much as I understand it.

@arc: you should add your file format specs links


_________________
Back to top
View user's profile Send private message
Fumblesneeze





Joined: 26 Nov 2013
Posts: 75 on topic

Thank you for registering your game
PostPosted: Thu, 26. Dec 13, 10:27    Post subject: Reply with quote Print

Quaternions have the advantage that you can do rotation animation by linear interpolation, while this same task requires a lot of computing power if you have to work with sin/cos/etc calls in euclidian space.

To learn more, the orge engine has a nice little text about it:
http://www.ogre3d.org/tikiwiki/Quaternion+and+Rotation+Primer

It also has a table of some useful quaternion rotations, e.g. 180° turns and 90° turns.


_________________
Streaming while writing mods: twitch.tv/fumblesneeze
Back to top
View user's profile Send private message
Dark_Ansem
Guest








PostPosted: Thu, 26. Dec 13, 12:08    Post subject: Reply with quote Print

amazing Smile well done!

Back to top
arc_





Joined: 07 Dec 2013



PostPosted: Sat, 28. Dec 13, 14:15    Post subject: Reply with quote Print

Started working on an .xac converter as well. .xac -> .dae is as good as complete: body with complete skeleton and vertex weights, head with complete morph targets. If/when I get a working .dae -> .xac converter I'll post an update of the tool Smile

Back to top
View user's profile Send private message
TargetLost



MEDALMEDALMEDAL

Joined: 23 Nov 2005
Posts: 465 on topic

Thank you for registering your game
PostPosted: Sat, 28. Dec 13, 18:56    Post subject: Reply with quote Print

Just to make sure you dont miss it: I closed my .xac to .dae converter project. Found no more time or motivation for it.

I am glad to read you are already working on an own converter so I dont have to feel so bad letting the community down. Smile

All the best and much success. Smile


_________________
Back to top
View user's profile Send private message
StephenWebb





Joined: 10 Nov 2013

Location: United States

PostPosted: Sun, 29. Dec 13, 16:55    Post subject: Doesn't seem to work. Reply with quote Print

I see that others have gotten this converter to work, but for some reason the program CTD. The assets are all unpacked, the first command line parameter is correct, and so is the second...is anyone else getting a CTD?

Back to top
View user's profile Send private message
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)

MEDAL

Joined: 20 Nov 2005
Posts: 13614 on topic

Thank you for registering your game
PostPosted: Sun, 29. Dec 13, 17:14    Post subject: Reply with quote Print

this program has no GUI/Window and therefore cannt CTD - it simply does what it is told and then exits without saying anything further.. are there the converted files where you expect them?


_________________
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter Wink

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help Wink
Back to top
View user's profile Send private message
StephenWebb





Joined: 10 Nov 2013

Location: United States

PostPosted: Sun, 29. Dec 13, 17:26    Post subject: CTD == Program Not Responding Reply with quote Print

Specifically the program doesn't work, it goes into Not Responding after the xml file and source directory where the .DAT files are given to it.

I had gotten it to respond correctly once, and it replied that access was denied so I changed permissions on the file and haven't been able to reproduce an instance where it didn't crash.

I changed the permissions back to the way they were and it just crashes now. I turned off my antivirus security as well, still nothing

Back to top
View user's profile Send private message
ICO_hr





Joined: 31 Aug 2013

Location: Sofia, Bulgaria

PostPosted: Sun, 29. Dec 13, 18:25    Post subject: Reply with quote Print

Yep some files crashes the program or just dont want to convert to .dae because file doesnt contain any LOD's.


_________________


Back to top
View user's profile Send private message Visit poster's website
arc_





Joined: 07 Dec 2013



PostPosted: Sun, 29. Dec 13, 18:55    Post subject: Reply with quote Print

If you have a crash/bug, please give *specific* details i.e.: what command line are you using, which file are you trying to import/export. If you're converting a .dae, upload it and provide a link. If you just say "it doesn't work" I can't help.

Back to top
View user's profile Send private message
killerog





Joined: 28 Oct 2005
Posts: 2562 on topic
Location: Kent, UK
Thank you for registering your game
PostPosted: Sun, 29. Dec 13, 22:12    Post subject: Reply with quote Print

So far after playing around with this tool today, I have been able to get a ship into 3dsmax/blender and export one with some minor changes. What I cant get it too do is show those changes in game. So if anyone has managed that part yet then any help would be great.

edit: One thing I have noticed is the ...._data.dae file is not updated and if you comment that out the game crashes. And it looks like it is linked to in the ....xml file.


_________________
Back to top
View user's profile Send private message
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)

MEDAL

Joined: 20 Nov 2005
Posts: 13614 on topic

Thank you for registering your game
PostPosted: Sun, 29. Dec 13, 22:26    Post subject: Reply with quote Print

how did you try to get these changes in the Game? if its with an extension: did you make a new Ship from the received data? (making a diff could be a bit difficult ^^) or did you try to replace whole files? (which is not possible in Extensions for xmls - they are either merged or or diffed, but not replaced - you can replace the whole content though)

also see my rahanas hybrid plus extension on how to add a new Ship to the Game - basically its linking the macro and components in the respective index files so the Game knows they exist, define necescary materials in the wares.wml and add the macro to a Shipyard build Module


_________________
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter Wink

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help Wink
Back to top
View user's profile Send private message
killerog





Joined: 28 Oct 2005
Posts: 2562 on topic
Location: Kent, UK
Thank you for registering your game
PostPosted: Sun, 29. Dec 13, 22:43    Post subject: Reply with quote Print

Ill take a look at your mod and see what's different and go from there. Ill write something up once ive got a model in game if no one beats me to it.

Edit: Bit more info now im not eating. Im trying to replace a mode, not create a new one yet.

I have got a diff for both the components and macro files. I am guessing its the XML file for the model I need to change using a "diff" file. But as far as I can tell it uses the _data.dae file for model info. This line in the XML file
"<source geometry="assets\units\size_l\units_size_l_hydrogen_collector_data" />"

needs to become "<source geometry="extensions\SBMod_Test\assets\units\size_l\units_size_l_hydrogen_collector_data" />"

At the moment that file is not changing using this tool so I don't think it will work if even if I change the xml file correctly.


_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2, 3 ... 9, 10, 11  Next
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Control Panel
Login Data
The time now is Tue, 24. Apr 18, 03:11

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2018
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.10376 seconds, sql queries = 29