[Question] How to change texture?

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

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

Post Reply
torrang
Posts: 14
Joined: Fri, 21. Dec 18, 03:10
x4

[Question] How to change texture?

Post by torrang » Fri, 4. Jan 19, 04:47

Hello,
I'm new with x modding.
I found some texture to be changed while playing. like ad in station...
So i read several post and extracted x4 resources with XRCatTool.
As i understand, if i want to change ad texture i have to make same directory root like this

original dir : /assets/textures/ad_signs/p1_holograph_ads_01_diff.gz
my mod dir : <mod_name>/assets/textures/ad_signs/p1_holograph_ads_01_diff.gz

so i extracted original texture file with 7zip and edited dds file with paint.net and compress with 7zip.
make it to tar and compress to gz again and finally put content.xml in my mod dir.

but the new texture is not applied.
so i tried to found similar mod that change texture but there's no texture mod right now.. (this forum, nexusmods)
Anyone can help me?

Thanks :)

snackynak
Posts: 35
Joined: Sun, 12. Feb 12, 07:59
xr

Re: [Question] How to change texture?

Post by snackynak » Fri, 4. Jan 19, 05:40

I'm also new to modding, but just so happened to be messing with texture files as well. I think you need to create a diff file for material_library.xml in your mod's libraries folder. You will find something like this if you search for "p1_holograph_ads_01" in the material_library.xml file

Code: Select all

<material name="p1_holograph_ads_01" shader="P1_complex_unlit.fx" blendmode="ADDITIVE" preview="none">
      <properties>
        <property type="Color" name="color_emissive" r="255" g="255" b="255" a="255" value="(color 255 255 255)" />
        <property type="BitMap" name="diffuse_map" value="assets\textures\fx\white_01_diff" />
        <property type="Float" name="diffuseStr" value="2" />
        <property type="Integer" name="dblend1" value="1" />
        <property type="BitMap" name="diffuse2_map" value="assets\textures\ad_signs\p1_holograph_ads_01_diff" />
        <property type="Float" name="diffuse2Str" value="1.0" />
        <property type="Integer" name="dblend2" value="1" />
        <property type="BitMap" name="diffuse3_map" value="assets\textures\fx\lcd_screen_01" />
        <property type="Float" name="diffuse3Str" value="1.0" />
        <property type="Float" name="alpha1Str" value="1.0" />
        <property type="Float" name="alpha2Str" value="1.0" />
        <property type="Float" name="alpha3Str" value="1.0" />
        <property type="Float" name="angle_fade_speed" value="1.0" />
        <property type="Float" name="angle_fade_offset" value="0.0" />
        <property type="Float" name="camera_fade_range_near_start" value="0.0" />
        <property type="Float" name="camera_fade_range_near_end" value="0.1" />
        <property type="Float" name="camera_fade_range_far_start" value="200.0" />
        <property type="Float" name="camera_fade_range_far_end" value="400.0" />
        <property type="Float" name="softparticle_range_min" value="0.0" />
        <property type="Float" name="softparticle_range_max" value="0.0" />
        <property type="Float" name="base_hue_shift" value="0.0" />
        <property type="Float" name="base_brightness_shift" value="2.0" />
      </properties>
    </material>

Code: Select all

 <property type="BitMap" name="diffuse2_map" value="assets\textures\ad_signs\p1_holograph_ads_01_diff" />
This is the line that probably needs to be replaced.

Code: Select all

 <property type="BitMap" name="diffuse2_map" value="extensions\Your Mod\assets\textures\ad_signs\p1_holograph_ads_01_diff" />
To maybe something that looks like this. I'm no good at sniping specific lines like that, but you could try replacing the whole entry.

So it may look like this:

Code: Select all

<diff>
<replace sel="/materiallibrary/material[@name='p1_holograph_ads_01']">
<material name="p1_holograph_ads_01" shader="P1_complex_unlit.fx" blendmode="ADDITIVE" preview="none">
      <properties>
        <property type="Color" name="color_emissive" r="255" g="255" b="255" a="255" value="(color 255 255 255)" />
        <property type="BitMap" name="diffuse_map" value="assets\textures\fx\white_01_diff" />
        <property type="Float" name="diffuseStr" value="2" />
        <property type="Integer" name="dblend1" value="1" />
        <property type="BitMap" name="diffuse2_map" value="extensions\Your Mod\assets\textures\ad_signs\p1_holograph_ads_01_diff" />
        <property type="Float" name="diffuse2Str" value="1.0" />
        <property type="Integer" name="dblend2" value="1" />
        <property type="BitMap" name="diffuse3_map" value="assets\textures\fx\lcd_screen_01" />
        <property type="Float" name="diffuse3Str" value="1.0" />
        <property type="Float" name="alpha1Str" value="1.0" />
        <property type="Float" name="alpha2Str" value="1.0" />
        <property type="Float" name="alpha3Str" value="1.0" />
        <property type="Float" name="angle_fade_speed" value="1.0" />
        <property type="Float" name="angle_fade_offset" value="0.0" />
        <property type="Float" name="camera_fade_range_near_start" value="0.0" />
        <property type="Float" name="camera_fade_range_near_end" value="0.1" />
        <property type="Float" name="camera_fade_range_far_start" value="200.0" />
        <property type="Float" name="camera_fade_range_far_end" value="400.0" />
        <property type="Float" name="softparticle_range_min" value="0.0" />
        <property type="Float" name="softparticle_range_max" value="0.0" />
        <property type="Float" name="base_hue_shift" value="0.0" />
        <property type="Float" name="base_brightness_shift" value="2.0" />
      </properties>
       </replace>
</diff>
This may be incorrect though, because I have no clue really.

torrang
Posts: 14
Joined: Fri, 21. Dec 18, 03:10
x4

Re: [Question] How to change texture?

Post by torrang » Fri, 4. Jan 19, 06:10

snackynak wrote:
Fri, 4. Jan 19, 05:40
I'm also new to modding, but just so happened to be messing with texture files as well. I think you need to create a diff file for material_library.xml in your mod's libraries folder. You will find something like this if you search for "p1_holograph_ads_01" in the material_library.xml file

Code: Select all

<material name="p1_holograph_ads_01" shader="P1_complex_unlit.fx" blendmode="ADDITIVE" preview="none">
      <properties>
        <property type="Color" name="color_emissive" r="255" g="255" b="255" a="255" value="(color 255 255 255)" />
        <property type="BitMap" name="diffuse_map" value="assets\textures\fx\white_01_diff" />
        <property type="Float" name="diffuseStr" value="2" />
        <property type="Integer" name="dblend1" value="1" />
        <property type="BitMap" name="diffuse2_map" value="assets\textures\ad_signs\p1_holograph_ads_01_diff" />
        <property type="Float" name="diffuse2Str" value="1.0" />
        <property type="Integer" name="dblend2" value="1" />
        <property type="BitMap" name="diffuse3_map" value="assets\textures\fx\lcd_screen_01" />
        <property type="Float" name="diffuse3Str" value="1.0" />
        <property type="Float" name="alpha1Str" value="1.0" />
        <property type="Float" name="alpha2Str" value="1.0" />
        <property type="Float" name="alpha3Str" value="1.0" />
        <property type="Float" name="angle_fade_speed" value="1.0" />
        <property type="Float" name="angle_fade_offset" value="0.0" />
        <property type="Float" name="camera_fade_range_near_start" value="0.0" />
        <property type="Float" name="camera_fade_range_near_end" value="0.1" />
        <property type="Float" name="camera_fade_range_far_start" value="200.0" />
        <property type="Float" name="camera_fade_range_far_end" value="400.0" />
        <property type="Float" name="softparticle_range_min" value="0.0" />
        <property type="Float" name="softparticle_range_max" value="0.0" />
        <property type="Float" name="base_hue_shift" value="0.0" />
        <property type="Float" name="base_brightness_shift" value="2.0" />
      </properties>
    </material>

Code: Select all

 <property type="BitMap" name="diffuse2_map" value="assets\textures\ad_signs\p1_holograph_ads_01_diff" />
This is the line that probably needs to be replaced.

Code: Select all

 <property type="BitMap" name="diffuse2_map" value="extensions\Your Mod\assets\textures\ad_signs\p1_holograph_ads_01_diff" />
To maybe something that looks like this. I'm no good at sniping specific lines like that, but you could try replacing the whole entry.

So it may look like this:

Code: Select all

<diff>
<replace sel="/materiallibrary/material[@name='p1_holograph_ads_01']">
<material name="p1_holograph_ads_01" shader="P1_complex_unlit.fx" blendmode="ADDITIVE" preview="none">
      <properties>
        <property type="Color" name="color_emissive" r="255" g="255" b="255" a="255" value="(color 255 255 255)" />
        <property type="BitMap" name="diffuse_map" value="assets\textures\fx\white_01_diff" />
        <property type="Float" name="diffuseStr" value="2" />
        <property type="Integer" name="dblend1" value="1" />
        <property type="BitMap" name="diffuse2_map" value="extensions\Your Mod\assets\textures\ad_signs\p1_holograph_ads_01_diff" />
        <property type="Float" name="diffuse2Str" value="1.0" />
        <property type="Integer" name="dblend2" value="1" />
        <property type="BitMap" name="diffuse3_map" value="assets\textures\fx\lcd_screen_01" />
        <property type="Float" name="diffuse3Str" value="1.0" />
        <property type="Float" name="alpha1Str" value="1.0" />
        <property type="Float" name="alpha2Str" value="1.0" />
        <property type="Float" name="alpha3Str" value="1.0" />
        <property type="Float" name="angle_fade_speed" value="1.0" />
        <property type="Float" name="angle_fade_offset" value="0.0" />
        <property type="Float" name="camera_fade_range_near_start" value="0.0" />
        <property type="Float" name="camera_fade_range_near_end" value="0.1" />
        <property type="Float" name="camera_fade_range_far_start" value="200.0" />
        <property type="Float" name="camera_fade_range_far_end" value="400.0" />
        <property type="Float" name="softparticle_range_min" value="0.0" />
        <property type="Float" name="softparticle_range_max" value="0.0" />
        <property type="Float" name="base_hue_shift" value="0.0" />
        <property type="Float" name="base_brightness_shift" value="2.0" />
      </properties>
       </replace>
</diff>
This may be incorrect though, because I have no clue really.


This way is correct. It's working now! So when i want to change something, have to check in libraries directory too. Thank you snackynak!

MrWolf82Ger
Posts: 1
Joined: Fri, 27. Sep 19, 11:17

Re: [Question] How to change texture?

Post by MrWolf82Ger » Fri, 27. Sep 19, 12:03

Howdy (and Hello as i´m new to X Forums) .

I´m playing around with texture files. Editing existing files isn´t really a problem for me. The hard part for me is scripting.

I´ve created a diff/normal & specular file & are ready to use.

My question is: Is it even possible (and if how) to bring them ingame (diff is already there & works).
i guess i have to add some lines with normal_map & specular_map in material libary, and that´s a problem for me because i don´t know how.

I want to add some depth to the picures. I´ve done this in other games with an editor & i know how it works, but in X it´s scripting, and thats not my strength.
Can anyone help here?

Cheers. :)

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

Re: [Question] How to change texture?

Post by Axeface » Sat, 28. Sep 19, 20:27

torrang wrote:
Fri, 4. Jan 19, 04:47

make it to tar and compress to gz again and finally put content.xml in my mod dir.
Thanks for this thread. Im trying to change a texture myself but it just wont work. Can I ask what you mean when you say 'make it to tar'? I was under the impression that the texture files are DDS files with no extention, compressed in a gz file. YOu say you compress twice?

Realspace
Posts: 1372
Joined: Wed, 15. Nov 06, 10:21
x4

Re: [Question] How to change texture?

Post by Realspace » Sun, 12. Apr 20, 19:29

Compressing them twice, first tar then gz did not work for me. But the DDS format seems to make a difference, maybe I am using an ancient version of Photoshop, CS6, the nvidia exporter, but the only format that seems to work is dxt5 alpha, tried the 32 uncompressed but textures were not read. Even the fake mod did not work, only the xml in libraries plus dxt5 format. the compressed file must not contain the .dds in the name. It is driving me crazy, overall I d prefer to work on the meshes. Does anyone knows whether the X3 meshes are compatible with this engine? I could even use the X2s ones in X3 and change only the textures. Am working on the skybox of course, as always this is a great game but some small artist choices at Ego spoil a bit the immersion for me :D . I have the whole set of backgrounds I made for X3, it is a simple box afterall, importing it would be the easiest way.

Post Reply

Return to “X4: Foundations - Scripts and Modding”