Understanding the concepts for cluster backgrounds

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

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

NitramAkloh
Posts: 105
Joined: Fri, 5. May 23, 09:56
x4

Understanding the concepts for cluster backgrounds

Post by NitramAkloh »

In this topic, I am trying to get a better understanding of the difficult subject of own cluster backgrounds with the help of my questions. First of all, it should be noted that I have already read the tutorial by Oganesson https://pastebin.com/5VdtWMLb. However, there are some things that are still unanswered.
All resources and XML definitions are located in the “\assets\enviroments\cluster” directory. In the XML files there, I noticed the connection between the XMF 3D model files and the materials. The latter are listed in the file “\library\materials_library.xml”.
Now to my actual questions and there will certainly be more later:
1. Why does each cluster have its own 3D models (nebula backgrounds, planets, stars, etc.)? As far as I can see, these are only spheres, which then have separate materials (see above file). Why didn't Egosoft use one model for all clusters?
2. The textures of the nebula backgrounds (at least in the base game) all seem to have the same gray color. This leads me to believe that they are colored in a material definition. But how? Or am I misunderstanding this?

Many thanks in advance. :)
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Understanding the concepts for cluster backgrounds

Post by Realspace »

It is correct, vanilla nebulae are a white painting then they get colored but not in materials, it is the light's color of the sector and part is in the mesh itself. You can apply a color thou, both in materials or in the texture itself. This is quite tricky thou, you need to import/export each nebula mesh (xmf) and assign a different material to each. So this material can receive colors or different textures. I made it for my mod STARS to increase the transparency of nebulae and make them dimmer selectivelly, other than making them even more far away (bigger mesh box). This latter is implemented in my XRSGE mod (having the new meshes).
As first, you can have good results by only manipulating the materials, but while planets have each a material of its own, nebulae have all the same material, so as bg stars, as you noticed. Different meshes for each background linked to the same material. But the mapping is different, this answers your first question. They used a single texture for all backgrounds, but different mapping. This probably to reduce size of textures. That material link can be changed by exporting the model into .dae, then changing and importing as xmf.
Take a look at my mod STARS for changing those materials (consider that part of its modifications are visible only is used with xrsge, where you can look for modified xmf's).
NitramAkloh
Posts: 105
Joined: Fri, 5. May 23, 09:56
x4

Re: Understanding the concepts for cluster backgrounds

Post by NitramAkloh »

Hello realspace,
once again, patience is rewarded. At first I thought nobody would be interested in my request. I'm all the more pleased with your answer. Okay, the fog coloring is still giving me a bit of a headache. I once changed the sunlight to bright red for fun. It had an interesting effect on the planets. But the nebulae remained unaffected. I'll have to take another look at the model files myself.
In any case, I now understand why each sector has its own model files. However, I have no acute need to change the UV mapping. So this point has already been resolved.
Well then, I'll keep experimenting. Thanks again.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Understanding the concepts for cluster backgrounds

Post by Realspace »

NitramAkloh wrote: Sat, 17. May 25, 18:04 Hello realspace,
once again, patience is rewarded. At first I thought nobody would be interested in my request. I'm all the more pleased with your answer. Okay, the fog coloring is still giving me a bit of a headache. I once changed the sunlight to bright red for fun. It had an interesting effect on the planets. But the nebulae remained unaffected. I'll have to take another look at the model files myself.
In any case, I now understand why each sector has its own model files. However, I have no acute need to change the UV mapping. So this point has already been resolved.
Well then, I'll keep experimenting. Thanks again.
I think the easiest way to make colored nebulae is to use new textures, that's what I did at least but you can probably use the ego's way. You can try to apply colors like f.i. 255 100 100 (strong red) in materials and see if it makes a difference.
About mapping, I used blender only to import an X4 model (say the milky way, that uses only one texture), to do it you import the cluster using the X4 plugin for Blender and delete all meshes that are not the background. Delete also ALL collisions. Then export as .dae. That file can be opened with a text editor. You can change the material's link to your own. Then create a new material having the name you used in the .dae. This material links to your new texture for background. Here you can also set different transparency. Then you have to use XRebirthTool to convert the .dae into xmf again.
Then using an entry in the cluster file you used, say the milky way so cluster_100, you copy the same entry to your designated cluster. In this cluster's components folder (linked at top) must be put the new xmf you created _lod (collision can be avoided for backgrounds, they are far). Your dae did not generate anyway if you deleted as I told, and in any case do not use newly generated collisions they are bugged and destroy ships inside the sectors...as we experienced in old xrsge versions :)
Of course the material must also be added. With this procedure you can create as many backgrounds you want each having a different texture. Again, look in my STARS mod.
If you learn and do it, please advise me, we could add some new nebulae you do in XRSGE 8 :)

Return to “X4: Foundations - Scripts and Modding”