How To: Export Models, Re-Import. (Blender)

The place to discuss scripting and game modifications for X4: Foundations.

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

DuckSoup
Posts: 67
Joined: Fri, 20. Jan 12, 17:08
x3ap

How To: Export Models, Re-Import. (Blender)

Post by DuckSoup » Wed, 5. Dec 18, 03:29

So maybe this is common knowledge, but I want to throw this out there for anyone wanting to play around with the models. In my example, I use Blender, but I have no doubt other tools will work.

First, unpack the game files. You can read more how to do that here: viewtopic.php?f=181&t=402452
For best results, make a copy of your X4 directory somewhere else (Make sure the directory you created has no spaces in the root folder for the game files). From that copy you made, unpack the files to this X4 directory. Once that is complete, it is best to remove the CAT\DAT files. Reason for this is when you make changes to the model you don't want to have to repackage everything. You can load in with loose files, but CAT files get loaded in first. So it's best to just remove the CAT files.

Next, pick up XRConverter: https://drive.google.com/file/d/0B5I84p ... F0Nnc/view
This was used to export X:Rebirth ships, still works with X4. Here's some documentation
viewtopic.php?f=129&t=360045

(Before modifying a ship, make a copy of the .XML of that model)
I put the XRConverter Tool in the root directory of the game. From there I run the following command to export a ships model to .DAE

Code: Select all

XRConvertersmain.exe importxmf D:\<Game_Root_Directory> D:\<Game_Root_Directory>\assets\units\size_s\ship_arg_fighter_02.xml
This will create a .DAE next to the XML file. From here we can go ahead and import into Blender.

https://i.imgur.com/S27t390.png

Yay we imported our model. Now we want to make our changes, and bring it back into the game.

So do to this, we want to make sure to remove the Camera and Lamp before exporting.

Once that is complete, Select File > Export > .DAE

Make sure before you export, you go to Textures, and select "UV Textures" on the bottom left.

Image

With the new .dae created, we need to convert this back to XML.

(Again, make sure you create a backup of the original .xml, or rename it to .xml.old)

Code: Select all

XRConvertersmain.exe exportxmf D:\<Game_Root_Directory> D:\<Game_Root_Directory>\assets\units\size_s\ship_arg_fighter_02.dae
This will generate a new .XML file to be loaded into the game. Replace the original XML with the new one and you should be good to go.


{Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked - Terre}
Last edited by DuckSoup on Wed, 5. Dec 18, 20:26, edited 4 times in total.

Urillch
Posts: 14
Joined: Sun, 2. Feb 14, 06:43
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Urillch » Wed, 5. Dec 18, 17:51

Thanks! you linked me to your How To and i got it all squared away!
" It is better to live one day as a lion than a hundred years as a sheep. "

- Italian proverb

lyfesgrafiq
Posts: 13
Joined: Thu, 6. Dec 18, 13:28
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by lyfesgrafiq » Thu, 6. Dec 18, 14:21

Hello, I have a couple questions. When you say "Now we want to make our changes..", what type of changes can be made? Sorry if this is obvious but I've never played any X series games til Foundations, and I've never modded any of their games before. I'm pretty decent with blender and just curious as to how much can be changed.

Also, not sure if it's because I'm new to the forum (or I don't own a copy of XRebirth)... but it says that I don't have permission to download the catalog tool.

Staberind
Posts: 119
Joined: Wed, 5. May 10, 23:32
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Staberind » Thu, 6. Dec 18, 14:43

Awesome! thanks for this info, its like gold dust to me.
Aladna Hill, Again, AP, 3.1. in the last Game worthy of the "X" title. <<<< X4 might just be changing this. :?:

semTex.
Posts: 5
Joined: Mon, 18. Nov 13, 11:53
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by semTex. » Thu, 6. Dec 18, 15:03

lyfesgrafiq wrote:
Thu, 6. Dec 18, 14:21
Also, not sure if it's because I'm new to the forum (or I don't own a copy of XRebirth)... but it says that I don't have permission to download the catalog tool.
Did you connect you profile with steam (if you purchased the game trough steam) or enterd the gamecode?

lyfesgrafiq
Posts: 13
Joined: Thu, 6. Dec 18, 13:28
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by lyfesgrafiq » Thu, 6. Dec 18, 15:12

semTex. wrote:
Thu, 6. Dec 18, 15:03
lyfesgrafiq wrote:
Thu, 6. Dec 18, 14:21
Also, not sure if it's because I'm new to the forum (or I don't own a copy of XRebirth)... but it says that I don't have permission to download the catalog tool.
Did you connect you profile with steam (if you purchased the game trough steam) or enterd the gamecode?
Thanks much for the help... I didn't connect my pro to steam. :thumb_up:

Lc4Hunter
Posts: 2170
Joined: Sun, 2. Apr 06, 16:15
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Lc4Hunter » Thu, 6. Dec 18, 19:36

Thanks for this at first!
Just one question: Does anyone know an option to import/export DAEs to 3ds Max? In the past i used an additional programm to convert the DAEs to another format which i can import into 3ds Max.
My blender days are... well... a long time ago. I´m better using 3ds Max and i would like to brong some of my babys into game, but at most this little sweet guy :D :D

Image

User avatar
Axeface
Posts: 2939
Joined: Fri, 18. Nov 05, 00:41
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Axeface » Thu, 6. Dec 18, 19:38

Lc4Hunter wrote:
Thu, 6. Dec 18, 19:36
Thanks for this at first!
Just one question: Does anyone know an option to import/export DAEs to 3ds Max? In the past i used an additional programm to convert the DAEs to another format which i can import into 3ds Max.
My blender days are... well... a long time ago. I´m better using 3ds Max and i would like to brong some of my babys into game, but at most this little sweet guy :D :D

Image
I saw that model on creative universe, its great :)

@OP. Do you hve any advise on how textures/materials work? I remember that the setup in 3dsmax for X3 was a real PITA, no idea about Rebirth. I'de like to try to get the megalodon in X4 :D

DuckSoup
Posts: 67
Joined: Fri, 20. Jan 12, 17:08
x3ap

Re: How To: Export Models, Re-Import. (Blender)

Post by DuckSoup » Thu, 6. Dec 18, 20:32

Axeface wrote:
Thu, 6. Dec 18, 19:38
Lc4Hunter wrote:
Thu, 6. Dec 18, 19:36
Thanks for this at first!
Just one question: Does anyone know an option to import/export DAEs to 3ds Max? In the past i used an additional programm to convert the DAEs to another format which i can import into 3ds Max.
My blender days are... well... a long time ago. I´m better using 3ds Max and i would like to brong some of my babys into game, but at most this little sweet guy :D :D

Image
I saw that model on creative universe, its great :)

@OP. Do you hve any advise on how textures/materials work? I remember that the setup in 3dsmax for X3 was a real PITA, no idea about Rebirth. I'de like to try to get the megalodon in X4 :D
I honestly don't just yet. Once I got the Export\Import working, I had like... a couple hours to work on some stuff before my toddler got sick, so I haven't been able to spend much time on the models. (Now the holidays are coming up....)

Lc4Hunter
Posts: 2170
Joined: Sun, 2. Apr 06, 16:15
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Lc4Hunter » Thu, 6. Dec 18, 23:17

As i remember correctly some Egosoft employes said that they use 3ds max to create models und to export them so i think there has to be a way.
But i think they also said that they have their own tools for that so we can´t expect to find something public that helps.

Making models in 3ds max, exporting them into a format blender likes, importing it to blender and exporting it into DAE and from DAE to the X4 file format is a long way which can cause a lot of problems and errors... :(

Xenon472
Posts: 162
Joined: Fri, 19. Jun 09, 20:07
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Xenon472 » Fri, 7. Dec 18, 00:53

I am trying to export some model files and i followed your guide fine untill i run XRConverter command but it does nothing, i both tried running the command from a bat file and writing the comand on the powershell, both times it hung on for a couple of second (so it seem it does something) but then no .dae is created
am i doing something wrong?

p.s the command i am using is: ".\XRConvertersMain.exe importxmf I:\X4 export I:\X4 export\assets\units\size_s\ship_arg_fighter_02.xml"

User avatar
Axeface
Posts: 2939
Joined: Fri, 18. Nov 05, 00:41
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Axeface » Fri, 7. Dec 18, 01:14

Lc4Hunter wrote:
Thu, 6. Dec 18, 23:17
As i remember correctly some Egosoft employes said that they use 3ds max to create models und to export them so i think there has to be a way.
But i think they also said that they have their own tools for that so we can´t expect to find something public that helps.

Making models in 3ds max, exporting them into a format blender likes, importing it to blender and exporting it into DAE and from DAE to the X4 file format is a long way which can cause a lot of problems and errors... :(
I dont think you should have any problems if you use OBJ to get your models into blender?
And yeh, they have their own exporter which I dont think they ever released? I cant remember exactly but back when I was making ships for X3 I think we had to wait for a 3rd party exporter.

Binkley-Spacetrucker
Posts: 3
Joined: Sun, 2. Dec 18, 02:10

Re: How To: Export Models, Re-Import. (Blender)

Post by Binkley-Spacetrucker » Fri, 7. Dec 18, 02:18

Xenon472 wrote:
Fri, 7. Dec 18, 00:53
I am trying to export some model files and i followed your guide fine untill i run XRConverter command but it does nothing, i both tried running the command from a bat file and writing the comand on the powershell, both times it hung on for a couple of second (so it seem it does something) but then no .dae is created
am i doing something wrong?

p.s the command i am using is: ".\XRConvertersMain.exe importxmf I:\X4 export I:\X4 export\assets\units\size_s\ship_arg_fighter_02.xml"
same problem here.this is on winblows 10

Lc4Hunter
Posts: 2170
Joined: Sun, 2. Apr 06, 16:15
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Lc4Hunter » Fri, 7. Dec 18, 10:00

Ok, now i got it...
I forgot the 3ds max of course is able to import DAE files... :D

Image

User avatar
Perahoky
Posts: 450
Joined: Fri, 22. Aug 08, 16:04
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Perahoky » Fri, 7. Dec 18, 11:01

I think we should move these tutorials into the egosoft x-wiki
wiki.egosoft.com

Thank you for your tutorial :)
"Hope is the last force i have"
"This is how liberty dies, with thounderous applause"
***Modified***

Xenon472
Posts: 162
Joined: Fri, 19. Jun 09, 20:07
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Xenon472 » Fri, 7. Dec 18, 16:04

Binkley-Spacetrucker wrote:
Fri, 7. Dec 18, 02:18
Xenon472 wrote:
Fri, 7. Dec 18, 00:53
I am trying to export some model files and i followed your guide fine untill i run XRConverter command but it does nothing, i both tried running the command from a bat file and writing the comand on the powershell, both times it hung on for a couple of second (so it seem it does something) but then no .dae is created
am i doing something wrong?

p.s the command i am using is: ".\XRConvertersMain.exe importxmf I:\X4 export I:\X4 export\assets\units\size_s\ship_arg_fighter_02.xml"
same problem here.this is on winblows 10
i found a workaround:
make a .bat in the folder you unpacked the cat/dat with the following comands:

Code: Select all

FOR /R "..\<folder name>\assets\units" %%f IN (*.xml) do (
  XRConvertersMain.exe importxmf "..\<folder name>" "%%f"
  )
pause

!!! <folder name> is the folder you unpacked the cat/dat !!!

this bat convert every ship in .dae (if you want to convert other assets change the folder "units" with the name of the folder the asset is located)
(i am really not sure on why this work and doing one model at time does not :? )

Binkley-Spacetrucker
Posts: 3
Joined: Sun, 2. Dec 18, 02:10

Re: How To: Export Models, Re-Import. (Blender)

Post by Binkley-Spacetrucker » Sat, 8. Dec 18, 10:43

Xenon472 wrote:
Fri, 7. Dec 18, 16:04
Binkley-Spacetrucker wrote:
Fri, 7. Dec 18, 02:18
Xenon472 wrote:
Fri, 7. Dec 18, 00:53
I am trying to export some model files and i followed your guide fine untill i run XRConverter command but it does nothing, i both tried running the command from a bat file and writing the comand on the powershell, both times it hung on for a couple of second (so it seem it does something) but then no .dae is created
am i doing something wrong?

p.s the command i am using is: ".\XRConvertersMain.exe importxmf I:\X4 export I:\X4 export\assets\units\size_s\ship_arg_fighter_02.xml"
same problem here.this is on winblows 10
i found a workaround:
make a .bat in the folder you unpacked the cat/dat with the following comands:

Code: Select all

FOR /R "..\<folder name>\assets\units" %%f IN (*.xml) do (
  XRConvertersMain.exe importxmf "..\<folder name>" "%%f"
  )
pause

!!! <folder name> is the folder you unpacked the cat/dat !!!

this bat convert every ship in .dae (if you want to convert other assets change the folder "units" with the name of the folder the asset is located)
(i am really not sure on why this work and doing one model at time does not :? )
did everything as described and it looks like this:
D:\X4Mod\CAT_Export>FOR /R "..\CAT_Export\assets\units" %f IN (*.xml) do (XRConvertersMain.exe importxmf "..\CAT_Export" "%f" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\cockpit_arg_l_bridge_01.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_destroyer_01.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_miner_liquid_01.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_miner_solid_01.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_trans_container_01.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_trans_container_02.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_trans_container_03.xml" )

D:\X4Mod\CAT_Export>(XRConvertersMain.exe importxmf "..\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\ship_arg_l_trans_container_04.xml" )
etc...
not one single .DAE file is produced :(

sobfiggis
Posts: 2
Joined: Sat, 1. Dec 18, 08:51
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by sobfiggis » Sat, 8. Dec 18, 22:22

Binkley-Spacetrucker wrote:
Sat, 8. Dec 18, 10:43
not one single .DAE file is produced
I was having the same issue until I did the following two things.

1: I stopped using directory shorthand for the arguments. Use full paths.

2: remove the trailing backslash for the directory where you unpacked the assets.

Examples:

WORKS:

Code: Select all

.\XRConvertersMain.exe importxmf "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked" "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked\assets\units\size_s\ship_arg_s_fighter_02.xml"
DIDNT WORK (note trailing slash):

Code: Select all

.\XRConvertersMain.exe importxmf "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked\" "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked\assets\units\size_s\ship_arg_s_fighter_02.xml"
DIDNT WORK:

Code: Select all

.\XRConvertersmain.exe importxmf .\unpacked .\unpacked\assets\units\size_s\ship_arg_s_fighter_01.xml

Binkley-Spacetrucker
Posts: 3
Joined: Sun, 2. Dec 18, 02:10

Re: How To: Export Models, Re-Import. (Blender)

Post by Binkley-Spacetrucker » Sun, 9. Dec 18, 00:42

sobfiggis wrote:
Sat, 8. Dec 18, 22:22
Binkley-Spacetrucker wrote:
Sat, 8. Dec 18, 10:43
not one single .DAE file is produced
I was having the same issue until I did the following two things.

1: I stopped using directory shorthand for the arguments. Use full paths.

2: remove the trailing backslash for the directory where you unpacked the assets.

Examples:

WORKS:

Code: Select all

.\XRConvertersMain.exe importxmf "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked" "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked\assets\units\size_s\ship_arg_s_fighter_02.xml"
DIDNT WORK (note trailing slash):

Code: Select all

.\XRConvertersMain.exe importxmf "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked\" "C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\unpacked\assets\units\size_s\ship_arg_s_fighter_02.xml"
DIDNT WORK:

Code: Select all

.\XRConvertersmain.exe importxmf .\unpacked .\unpacked\assets\units\size_s\ship_arg_s_fighter_01.xml
did it and got the same:

PS D:\X4Mod\CAT_Export> .\XRConvertersMain.exe importxmf "D:\X4Mod\CAT_Export" "D:\X4Mod\CAT_Export\assets\units\size_l\
ship_arg_l_trans_container_05.xml"
PS D:\X4Mod\CAT_Export>

runs for 2 seconds,no error message but NO DAE is produced

Lc4Hunter
Posts: 2170
Joined: Sun, 2. Apr 06, 16:15
x4

Re: How To: Export Models, Re-Import. (Blender)

Post by Lc4Hunter » Sun, 9. Dec 18, 11:05

I had a bit more time for playing around and converting models to DAE and importing them to 3ds Max works...
The texture coordinates are also ok, i just had to apply the correct texture to the ship... the name of the texture is added to the parts name

Image
Image

I hope this is the same in blender?
It would be great to find a way to load the textures directly during import to the model..

---

Edit: Got it.

If you oben the DAE via Notepad++ it looks like this:
Image

I replaced the path prefix to the complete path:
Image

And this is the result (and yes, the textures look like this...)
Image

Post Reply

Return to “X4: Foundations - Scripts and Modding”