[TUTORIAL] How to add a Holo-Monitor

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

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

Post Reply
User avatar
Posts: 192
Joined: Fri, 22. Nov 13, 22:09

[TUTORIAL] How to add a Holo-Monitor

Post by Litauen » Sun, 9. Feb 20, 21:43

In this guide, I will show you how to add a holographic monitor.

A working example could be seen in this mod: Manager Plus
The same technique was used in X-Rebirth's mod Capital Ship Bridge


We will add a monitor to the manager who sits in the Manager's Office.
From this moment I will refer to the holographic image as 'monitor' to save time and space. Keyboard and other stuff can be added in a similar way based on your imagination.

At first let's create mod's folder in 'Steam/streamapps/common/X4 Foundations/extensions' folder. (Note, that other mods can be located in the '/Documents/Egosoft/X4/.../extensions' folder, but for our mod this will not work because we will add additional assets and the game would not recognize them if they would be in the /Documents... folder).

I called this mod: "Manager Plus" and named the folder "lt_manager_plus". It has the following structure:


You should download Manager Plus mod and use the folder structure and files as a baseline.

content.xml describes the mod, you can copy-paste it and change details inside based on your needs.

To simplify the editing we will totally overwrite the file which describes the manager's office, that would be "room_gen_managersoffice_01.xml"

We copy this file from the extracted game's files to the folder /assets/interiors/rooms and we will have:


Also, we copy the whole folder with all its contents "room_gen_managersoffice_01_data".

Now we need to tell the game to use our copied files in the game instead of the original files. For that we need to tell the game where to look for the manager's office 'component' - e.g. description in XML.

This is done in the file /index/components.xml

We add XML patch "code" to the file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <replace sel="//entry[@name='room_gen_managersoffice_01']/@value">\extensions\lt_manager_plus\assets\interiors\rooms\room_gen_managersoffice_01</replace>
This code tells the game, that component with the name 'room_gen_managersoffice_01' is described in the mod's file '\extensions\lt_manager_plus\assets\interiors\rooms\room_gen_managersoffice_01' (xml extension can be ommited).

Then we need to edit the file itself. We open '\extensions\lt_manager_plus\assets\interiors\rooms\room_gen_managersoffice_01.xml' and inside we edit the line at the top:

Code: Select all

<source geometry="\extensions\lt_manager_plus\assets\interiors\rooms\room_gen_managersoffice_01_data"/>
Here we tell the game where the 'geometry' of the component is located. In human language - where the 3D files (geometry) of the Manager's Office (component) are located.

After these changes, the game (after restart) will use the files from the mod's folder.

We can add holo-monitor now.

At first, let's create an image of the monitor. Based on the 3D file I am using, the picture of the monitor should be a rectangle with the size of 2048x2048.

Use any software to make a picture you want. My monitor looks like this:


Notice that the majority of the picture is black. Black space will be transparent in the final result.

Now save this image and convert it to the DDS format picture (DDS DXT1). I use DXTBmp software for it. Photoshop has a DDS plugin for the same task.


When we have a DDS image, rename it to 1.dds. And compress to the gz file. I use 7-Zip software to archive files to .gz. Looks like this:


Place this 1.gz file to the folder /textures/monitors:


Now we need to tell the game to use this file as a texture. For that we have a file /libraries/material_library.xml with the following 'code':

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<add sel="/materiallibrary" >
	<collection name="heads">
		<material name="displayBlock_gen0001" shader="P1_simple_unlit.fx" blendmode="ADDITIVE" preview="none">
			<property type="BitMap" name="diffuse_map" preload="1" value="extensions\lt_manager_plus\textures\monitors\1"></property>
			<property type="Float" name="diffuseStr" value="2"></property>		
Important parts here are the lines:

Code: Select all

<collection name="heads">
<material name="displayBlock_gen0001" shader="P1_simple_unlit.fx" blendmode="ADDITIVE" preview="none">
<property type="BitMap" name="diffuse_map" preload="1" value="extensions\lt_manager_plus\textures\monitors\1">
That is:
  • collection name "heads"
  • material name "displayBlock_gen0001"
  • path to our texture: "extensions\lt_manager_plus\textures\monitors\1"
Now we need a 3D element to put our texture on.

For this I use files part_m1-collision.xmf and part_m1-lod0.xmf. They should be in the folder: \extensions\lt_manager_plus\assets\interiors\rooms\room_gen_managersoffice_01_data

Just copy-paste these files and feel free to use them.

part_m1-collision.xmf file can be used unchanged.

File part_m1-lod0.xmf inside holds the information about the texture it uses.

We need to open it with Hex Editor (I use HxD) and inside we see:


In red I marked the part where our texture is described.

As you can see it is 'heads.displayBlock_gen001' same as in our texture description:

Code: Select all

collection name "heads"
material name "displayBlock_gen0001"
Here if you need to use second texture (as I use for a keyboard), you can change to displayBlock_gen0002 for example and save as a new file:


And use this file for a second element. As an example check Manager Plus mod as there I use the second element for the keyboard.

Now as we have our 3D element and texture connected, we need to tell our component in the XML file to place holo-monitor in the scene.

This is done in the file \extensions\lt_manager_plus\assets\interiors\rooms\room_gen_managersoffice_01.xml by adding following section:

Code: Select all

<connection name="Connection18" tags="part detail_l nocollision forceoutline  ">
		<position x="0" y="1.5" z="-8"/>
		<rotation yaw="0" pitch="-15" roll="0" />
		<part name="part_m1">
				<lod index="0">
						<material id="1" ref="heads.displayBlock_gen0001"/>
				<max x="0.0950315" y="0.2610982" z="0.2626635"/>
				<center x="3.576279E-07" y="0" z="4.768372E-07"/>
Here the most important parts are:

connection name="Connection18" - make sure you add connection which is not existent in the file to do not overwrite the old connections. If last connection has a name Connection17 - name yours Connection18 and so on.

<part name="part_m1"> indicates to use 3D element from the files: part_m1*.xmf. In our situation these are part_m1-lod0.xmf and part_m1-collision.xmf

<material id="1" ref="heads.displayBlock_gen0001"/> indicates the texture we are using: heads.displayBlock_gen0001 (but it seems this line can be removed, it does not impact anything - texture from the xmf file will be used in any case).

Now restart the game and you should see the holo-monitor on the manager's table.

It takes some time to adjust the position and the placement of the monitor at the start.
It is done by using these parameters:

Code: Select all

<position x="0" y="1.5" z="-8"/>
<rotation yaw="0" pitch="-15" roll="0" />
Upon changing them, a quick reload with F9 is enough to see the changes, no need for a full game restart.

Happy modding!


Posts: 240
Joined: Fri, 25. Jan 19, 04:26

Re: [TUTORIAL] How to add a Holo-Monitor

Post by DeadAirRT » Mon, 10. Feb 20, 01:48

Excellent guide. If i ever manage to make my way to graphical mods I'm sure this will be a great intro.

User avatar
Misunderstood Wookie
Posts: 350
Joined: Mon, 15. Mar 04, 09:07

Re: [TUTORIAL] How to add a Holo-Monitor

Post by Misunderstood Wookie » Fri, 14. Feb 20, 15:05

Nice and I use that exact mod btw.
MOD Aspiring Freelancer GameStart
MOD Variety and Rebalance Overhaul Icon Pack
I lost my Hans and should not be flying Solo.

Post Reply

Return to “X4: Foundations - Scripts and Modding”