Egosoft Blender Mod Tools

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

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

Shuulo (EGO)
Posts: 24
Joined: Fri, 1. Apr 22, 17:56

Egosoft Blender Mod Tools

Post by Shuulo (EGO) » Wed, 12. Apr 23, 19:24

Egosoft Blender Mod Tools
Download link to the tools and examples (also contain textures) (Windows may give a warning that this is not safe to install, you can ignore it)
Blender version required: 3.0+ (tested to work on 3.5)

Installation: Download from link above and follow the installer instructions.

Information: This is the Blender add-on that can be used to export 3D assets (ship, station etc) from blender in a format that is used by the game since 6.00 update.
This tool generates "component" XML based on your blender file, please refer to example files on the proper setup of the assets.

Tips on Convex Hull settings::
- "Max hulls" defines max number of convex hulls that can be generated. This can impact performance, better to use the value as small as possible to cover the needs of your model geometry.
- "Max verts" per hull defines how many point each hull mesh gets. (e.g. a cube has 6 verts), if you want something more round, you need more verts, usually values above 128 are rarely reached.
- "Num Voxels" defines the resolution of the generator. High numbers impact speed of convex hull generation.(max is 10 mil.)
- Fill mode:
Flood - use this when your source mesh is manifold.
Raycast - use this when your source mesh is non manifold.
Surface - use this if your source mesh is a sheet or hollow in another way
IMPORTANT NOTE: Jolt/Convex hulls are "convex', which means concave is not allowed. Mesh like in the screenshot below will be "filled" according to yellow line:
The solution to this can be breaking up convex hull in 2 parts.
Note that its also possible to create own convex hulls from the mesh itself , by using "Mesh->Convex Hull" while in "Edit" mode. In this case make sure the naming of the hull corresponds to the template of generated hulls

Tips on making ID codes to work with new tools (thanks to Axeface) - LINK

Tips on making ship slowdown focrefields Ilike on dock areas):
- Jolt hulls are only needed for things ships can collide with, as you dont collide with the forcefield, they are not required.
- The geometry should enclose the dockarea and "span" a volume containing the docks. So just a flat wall at the entry wont work.
- Tags needed to make it work "triggerpart" "inside"

Steps to update pre-6.00 mod asset to work with Jolt and new modding tools:
(taking into assumption that you are using ships generated with old community converter)
1. Read the readme of installer carefully and setup the tools (make sure the folder names are EXACTLY like installer instructed and your blender file is in p1[assets] folder. Make sure you open the blender file AFTER you put it into the p1[assets] folder.)
2. In Egosoft tools go all the way down to "converter" section and press one of the buttons:
- "Convert" will try to convert your blender scene into the proper format that is used by the exporter. This one will not try to convert UV maps and materials, this is useful if you want only to update collisions for example.
- "Convert (inc UV/VC)" will try to convert your blender scene into the proper format that is used by the exporter, this time using trying to maintain assigned materials and UVs as is. It may not be perfect so pay attention to the look of the model after the conversion. This is the suggested way if you want to do correct clean export of your model.
WARNING! Conversion will only work if your blender file follows the "scheme" of old community converter format. If you are not sure if that is the case try to export your model back from the mod using the old community export function of the tool, and then apply conversion to that file.
3. Go to object mode, select parts you want to generate meshes, navigate to Object->V-HACD, increase Max Hulls to something higher (the more complex the shape is the more you will need, 128 looks fine on Behemoth) and press OK, it can take some time to generate new meshes with (part)_hull_(number) naming template. Make sure those newly generated collision hulls allow access to your ships dockareas.
IMPORTANT NOTE: tool will generate Jolt hulls for all parts in the blender file, if they do not have manually generated Jolt hulls then a very simplistic one will be created, usually in a form of box, that can obstruct correct collisions. Either generate Jolt hulls for all parts in the blender file or assign a "nocollision" tag to those parts that you dont want collisions with
4. Press “Export” button in Egosoft tab, it should create .DAE file in your p1[assets] folder.
5. If it was not open before, you can run now P1 Converter shortcut that was created during installation process. It will create the XXX_data folder with all the "parts" from for your asset as well as "component" XML in p1data folder.

If you want to update only collisions for your old mod asset, from the files it generated take -collision.xmf, -hull.jcs and -mesh.jcs files and drop them into your ship _data folder in the mod. Ship should now work fine.
Example of blend file of Hound L ship from VRO updated

Thanks to BrummBear for helping me with this guide and his unpaid labor.


Return to “X4: Foundations - Scripts and Modding”