[Tool] .xmf/.xac <-> .dae converter

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

.xmf files do not contain dummies, only the mesh itself. The weapon attachment points are probably defined in an .xml somewhere.

killerog: maybe try a different shader for your material? It seems strange to use the highway tube shader for a ship. If you can't get it to work, upload the extension somewhere and I'll take a closer look.
killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog »

Im using the XU_masstraffic shader, same one ego use on lots of things.

Here is the extension zipped up: http://sbmod.co.uk/Mod_Downloads/SBMod_Test.zip
Image
lubatomy
Posts: 236
Joined: Mon, 29. Dec 03, 15:22
x4

Post by lubatomy »

I'll take a look and see if i can do something about learning about weapon placement...cant promise to be fast about though.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

Weapon placement/availability is regulated over multiple files, using my Rahanas Hybrid M/Q as example (thats the Ship File i'm most familiar with :D :P ):

Ship Macro contains all elements which make up a Ship (by not defining available Slots here you can choose to not use some Gun Slots for example, but in this case they are used):

Code: Select all

      <connection ref="ConnectionFor_units_size_l_carrier_kit_extender2_c">
        <macro>
          <component ref="units_size_l_carrier_kit_extender2_c" connection="space" />
          <connections>
            <connection ref="connection_shieldgen01">
              <macro ref="shieldgenerator_size_m_mk1_macro" connection="connection_component" />
            </connection>
            <connection ref="connection_turret_small_mg01">
              <macro ref="turret_small_mg_macro" connection="connection_component01" />
            </connection>
            <connection ref="connection_turret_small_mg02">
              <macro ref="turret_small_mg_macro" connection="connection_component01" />
            </connection>
            <connection ref="connection_turret_small_mg03">
              <macro ref="turret_small_mg_macro" connection="connection_component01" />
            </connection>
            <connection ref="connection_turret_small_mg04">
              <macro ref="turret_small_mg_macro" connection="connection_component01" />
            </connection>
          </connections>
        </macro>
      </connection>
but the the related Components File is empty regarding this as you can see:

Code: Select all

<connection name="ConnectionFor_units_size_l_carrier_kit_extender2_c" tags="destructible">
  <offset>
    <position x="-4.522971E-07" y="-27" z="291.2187"/>
    <quaternion qx="0" qy="0" qz="1" qw="0"/>
  </offset>
</connection>
since the Weapon Positions are definied in the referenced units_size_l_carrier_kit_extender_2c.xml (taken from Core files) relative to the Ship part:

Code: Select all

			<connection name="connection_shieldgen01" group="group01 " tags="shieldgenerator ">
				<offset>
					<position x="0" y="71.7817" z="1.022276"></position>
					<quaternion qx="-1" qy="7.54979E-08" qz="-4.371139E-08" qw="3.300118E-15"></quaternion>
				</offset>
			</connection>
			<connection name="connection_turret_small_mg04" group="group01 " tags="turret_small_mg ">
				<offset>
					<position x="-33.7782" y="67.8042" z="14.19803"></position>
					<quaternion qx="-0.7071068" qy="-4.748536E-07" qz="-0.7071068" qw="2.613133E-07"></quaternion>
				</offset>
			</connection>
			<connection name="connection_turret_small_mg03" group="group01 " tags="turret_small_mg ">
				<offset>
					<position x="-33.7782" y="67.80418" z="-12.05155"></position>
					<quaternion qx="-0.7071068" qy="-4.748536E-07" qz="-0.7071068" qw="2.613133E-07"></quaternion>
				</offset>
			</connection>
			<connection name="connection_turret_small_mg02" group="group01 " tags="turret_small_mg ">
				<offset>
					<position x="34.33627" y="67.80426" z="14.19799"></position>
					<quaternion qx="-0.7071068" qy="2.613132E-07" qz="0.7071067" qw="4.748536E-07"></quaternion>
				</offset>
			</connection>
			<connection name="connection_turret_small_mg01" group="group01 " tags="turret_small_mg ">
				<offset>
					<position x="34.33628" y="67.80426" z="-12.05158"></position>
					<quaternion qx="-0.7071068" qy="2.613132E-07" qz="0.7071067" qw="4.748536E-07"></quaternion>
				</offset>
			</connection>
(although you can probably define them in the Component of the Ship itself file, too if you attach them directly to the Base Ship, not to a Ship Part..)

and sorry if this doesnt help the Modellers :D :P
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 ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog »

Was looking at those files thinking along the same lines as you which is nice :)

Looking at the units_size_l_hydrogen_collector file as its what I am most used to, it has the weapons defined in its .xml file :

Code: Select all

<connection name="connection_jumpdrive01" group="group02 " tags="jumpdrive_small ">
				<offset>
					<position x="0" y="-135.47" z="-402.9015" />
					<quaternion qx="-1" qy="-0" qz="-0" qw="7.54979E-08" />
				</offset>
			</connection>
			<connection name="connection_dock_s01" group="group01 " tags="dock_s ">
				<offset>
					<position x="-0.0791626" y="131.7682" z="465.2426" />
					<quaternion qx="0.7071068" qy="-0" qz="-0" qw="-0.7071068" />
				</offset>
			</connection>
			<connection name="connection_shieldgen02" group="group02 " tags="shieldgenerator ">
				<offset>
					<position x="0" y="138.8799" z="-651.6468" />
					<quaternion qx="-0" qy="-0" qz="-1" qw="7.54979E-08" />
				</offset>
			</connection>
			<connection name="connection_shieldgen01" group="group01 " tags="shieldgenerator ">
				<offset>
					<position x="-7.900948E-02" y="128.3549" z="569.9307" />
					<quaternion qx="-0.7071068" qy="-5.338508E-08" qz="-0.7071068" qw="5.338508E-08" />
				</offset>
			</connection>
			<connection name="connection_turret_small_mg01" group="group01 " tags="turret_small_mg ">
				<offset>
					<position x="-62.278" y="121.931" z="510.6701" />
					<quaternion qx="-0.9645436" qy="-0.2639235" qz="-7.282102E-08" qw="-1.992567E-08" />
				</offset>
			</connection>
So I am having a complete guess here but should this be converted into the dae file and loaded as some form of helper in 3dsmax/blender and then exported the same way ? So its not just the "parts" that need converting but the "connections" as well. I cant see any other way of being able to place them on the ship with out that being the case.

You are going to hate me arc_ :(

Your tool will not convert the file units_size_l_carrier_kit_main_a.xml, crashes for some reason.

Reason im tryong to open that file is that is is called in the file units_size_l_carrier_01.xml. Now this file has no parts so your tool doesn't like it either, but what is does have is lots of connections. No I am sure that we also need the connections loaded and not just the parts. Almost like a scene file from X3, as this file seems to only contain links to files that have parts but doesn't contain any parts in its self.
Image
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

I fixed the UV issue for your BSG model. The reason was simply that the tool was merging vertices too aggressively, comparing only their positions and not their UV's. Now it only merges two vertices if their position, normal and UV's are equal.

The reason why the construction_set file (units_size_l_carrier_kit_main_a.xml) wasn't importing was simply that the .xml doesn't have any <lod> elements; *apparently*, these are optional and you just have to look which files are available :roll:.

Both issues are fixed in 0.2.1, see main post for download as usual. Let's see some properly textured ships ingame at last :). Support for those "composition" files (units_size_l_carrier_01.xml) is next then.
ICO_hr
Posts: 415
Joined: Sat, 31. Aug 13, 17:56

Post by ICO_hr »

arc_ wrote:...
Both issues are fixed in 0.2.1, see main post for download as usual. Let's see some properly textured ships ingame at last :). Support for those "composition" files (units_size_l_carrier_01.xml) is next then.
Thanks for all the work.I really want to do some ships or to rework Station Interiors but i have no idea how to make them running in-game.If somebody do tutorial i'll be realy glad. :)
lubatomy
Posts: 236
Joined: Mon, 29. Dec 03, 15:22
x4

Post by lubatomy »

as for determining the gun positions, it should be easy to decide on the position from looking at the model. the quaternion would be a little harder i think.

I think someone was saying somewhere there was a wiki or a webpage or whatever that defined how to come up the the quaternion.
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

Quaternions are very common in computer graphics and easy to translate to/from a transformation matrix, don't worry about that :)

ICO_hr: you can look at killerog's SBMod_Test extension for an example for now. Once the tool is more complete (support for composition files and dummies such as turret positions) a tutorial should be written indeed. It's currently not really suitable for creating new ships from scratch, but replacing existing meshes by better looking ones should already work.
killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog »

Simply amazing arc_ , have a digital beer and cookie :)

Ill try it out tomorrow and get that BSG up to scratch, then if all goes well ill write a quick tut on getting a ship in game and textured. Ill update it as I/other figure stuff out and this tool gets updated :). Ill be nice like that :O

One thing I have thought about is how you save the texture name to the XML file. You mentioned getting this from the material applied instead of the part name. That would be great, as one you cant have parts with the same name and therefore I am guessing texture unless you combine them (I am doing that on the bsg). Second it would just be quicker. For example:

I have a bsg textures in a folder called BSG. In the material file I have a collection called BSG. So your tool would pick up the folder and the name of the texture (just diff would do I guess) and use that in the XML file.

If I am being completely silly ignore me :P
Image
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

It's definitely possible for several parts to share materials. As you can see in the node hierarchy produced by the converter, each part (e.g. part_main) has multiple LOD's (e.g. part_mainXlod0), and each LOD is subdivided into multiple meshes where each mesh is assigned 1 material (e.g. part_mainXlod0XgenericXhull01). Nothing stops you from creating separate parts with separate meshes that share this material, e.g. you could add a node called part_detailXlod0XgenericXhull01.

Later on it would indeed be a possibility to establish a convention for texture file paths (collection\texture.dds) and have the tool automatically generate a material collection + material definitions from this, plus assign these to the .xmf's, without having to mention the materials in the node names. But as said, that'll be for later since it's mostly a convenience feature.

Also just as a reminder, the converter supports .xac now too (NPC meshes - importxac/exportxac)... So you can play around with that as well if you wish.
killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog »

That's my understanding of it at the moment, and its fine. Thought I would just ask :)

Ill take a look at the .xac side of things as well at the weekend but my main focus will be ships station. What I am used to modelling. But I will test it none the less.
Image
killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog »

Your latest version has indeed fixed the textures UVS as well as the smoothing group problem :)

Ill start writing a tut now for everyone else.

Edit Currently got a 9 page word document on how to add ships into the game. Hopefully ill have a very unfinished version out tomorrow sometime.
Image
User avatar
Scrappy Coco
Posts: 62
Joined: Mon, 18. Nov 13, 14:28
x3tc

Post by Scrappy Coco »

First of all: This is awesome, guys !

Little question, I wanted to poke around with .xac to .dae but I can´t figure out the right syntax for the tool.

I got my copy (extracted .dat files ) of XR directly in C: and I tried to convert the holodancers xac. I tried using this command as admin in cmd.exe

Code: Select all

C:\XR\XRConvertersMain.exe importxac "C:\XR" "C:\XR\assets\characters\argon\bodies\ch_ar_f_bod_holo.xac" 
but it is not working, I looked for xml-files for the characters, but couldn´t find much, only a couple (maybe 3). What am I doing wrong ? How can I test converting xac´s ?

Could someone gimme a hint ?

Cheers and "make it so"

Scrappy Coco[/code]
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

That's the correct syntax. If the conversion was successful, a ch_ar_f_bod_holo.dae will appear in the same folder as the .xac file.

Are you using the newest version of the tool? Do you get any error messages? Or even a "XRConvertersMain stopped working" message from Windows?
User avatar
Scrappy Coco
Posts: 62
Joined: Mon, 18. Nov 13, 14:28
x3tc

Post by Scrappy Coco »

I get a "Stopped working" error, I could try debug, but right now I am not at home. It was, btw, the newest Version.

Cheers SC
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

It turns out you simply specified an incorrect file name. It's char_ar_f_bod_holo.xac, not ch_ar. The tool's file existance check is simply not working correctly... After correcting the file name, the import runs fine for me.
User avatar
Scrappy Coco
Posts: 62
Joined: Mon, 18. Nov 13, 14:28
x3tc

Post by Scrappy Coco »

ohhh fu.k .... I am so sorry for stealing your time. epic fail... I am such a noob. I feel so embaressed right now... this is one of my darkest moments ever...

Tzzz ... Thanks alot for checking.

EDIT: OMG it worked... but I had minor errors while importing dae to 3ds , but I see it now. I´ll now try to change something and export it back to xac, lets see if this goes too.

Cheers SC
User avatar
Zeron-mk7
Posts: 584
Joined: Sat, 23. Feb 08, 12:38
x3

Post by Zeron-mk7 »

New software version need to add <action> command in to the comand line to convert file.
Can someone write example code - what <action> command and where I need to add it into this example command line code to convert file - .xml/.xmf to .dae ?

Code: Select all

XRConvertersMain.exe importxmf "D:\X Rebirth files" "D:\X Rebirth files\assets\interiors\crates\interiors_crates_size_l.xml"
Image
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

If you only want to replace textures, you don't need this converter. You only need it if you want to change models.

Either way, you always need to pass three arguments to the .exe: the action (importxmf/exportxmf), the root folder containing the extracted game files, and the path of the .xml file (which should be in its original location in the extracted game files). In your post, you're only passing the action and the .xml path.

Return to “X Rebirth - Scripts and Modding”