[MOD] Asteroid Fade-in

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

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

ziplock815
Posts: 296
Joined: Wed, 8. Oct 14, 20:30

Re: [MOD] Asteroid Fade-in

Post by ziplock815 » Mon, 1. Jun 20, 00:04

Max Bain wrote:
Sun, 31. May 20, 13:28
Btw, is there a mod that reduces the density of asteroid fields? Should be a good way to increase performance and there are more than enough asteroids for mining anyway.
Would love to use this one really. It's sad to see how fps drops to 10 in some sectors like Second Contact and Nopileo's Fortune.

Falcrack
Posts: 4927
Joined: Wed, 29. Jul 09, 00:46
x4

Re: [MOD] Asteroid Fade-in

Post by Falcrack » Mon, 1. Jun 20, 05:52

I would love to use this mod if it did not have an FPS impact. But seeing as how the fps impact appears significant, I'll take higher FPS over popping in asteroids!

Max Bain
Posts: 1458
Joined: Wed, 27. Jun 18, 19:05
x3ap

Re: [MOD] Asteroid Fade-in

Post by Max Bain » Mon, 1. Jun 20, 11:45

@SirNukes:

I just had a look into your mod. I tried to lower the distance in defaults.xml but then I had pink steroids (only the very big ones). As if they had no texture at all, no matter how close I flew. Why is that? What value determines when the textures will be loaded correctly?
edit:
Ok it seems they only appear when I teleport into an asteroid field and then all big chunks in a specific radius are pink.

edit2:
I tried to lower the "visible distance" in defaults to test how it will look if asteroids fade in closer but even 200.000 will remove your fade in effect completely for all asteroids. Is there a value I can adjust to say the game when asteroids shall start to fade in? I cant find it so far.
XR Ship Pack (adds several ships from XR) Link
Weapon Pack (adds several new weapons) Link
Economy Overhaul (expands the X4 economy with many new buildings) Link
X4 Editor (view stats of objects and make your own mod within a few clicks) Link

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [MOD] Asteroid Fade-in

Post by SirNukes » Tue, 2. Jun 20, 09:05

Version 1.1 is up, with an alternate method of keeping XXL asteroids drawing that doesn't put aiscript into high attention mode.

This actually took a while to figure out. In the end, turns out that an asteroid that is targetable has an active component, and when it has a component it gets culled from vision if its zone isn't "visible". The solution is to reduce targeting distance on XXL asteroids down to 30-40km or so. A couple quirks to this: existing saves still have the long distance components on their xxl asteroids, so they can still get some pop-up. I don't know if that will fix itself over time. Secondly, flying away from a targeted asteroid will keep its component alive, which will cause it to vanish when its zone goes low attention; the asteroid will reappear when clearing the target if still inside the fade distance. (Those two quirks really threw off my testing.)

@Max Bain
Certain files need to be in a subst cat/dat to work. It sounds like you maybe extracted the shader spec file? I recall that causing purple textures. Anyway, default zone visibility range is no longer modified in 1.1.

The fade distance is set by custom asteroid lod xmf files tying into uniquified per-asteroid material entries which define start/end fade distances that match the region_lodvalues. They then link to uniquified shaders that are modified to enact the dithering.

Mycu
Posts: 408
Joined: Fri, 28. Sep 12, 08:30
x4

Re: [MOD] Asteroid Fade-in

Post by Mycu » Tue, 2. Jun 20, 13:50

Tried version 1.1 few minutes ago. Improvement in FPS is significant.
Currently (on the same save that I've checked previusly) it seems that I have same FPS with and without mod.
Only noticable thing is vanilla LOD change behaviuor.
Nice improvement.
X3 AP 3.1 + XRM
X3 AP 3.1 + LU

Max Bain
Posts: 1458
Joined: Wed, 27. Jun 18, 19:05
x3ap

Re: [MOD] Asteroid Fade-in

Post by Max Bain » Wed, 3. Jun 20, 00:19

SirNukes wrote:
Tue, 2. Jun 20, 09:05
@Max Bain
Certain files need to be in a subst cat/dat to work. It sounds like you maybe extracted the shader spec file? I recall that causing purple textures. Anyway, default zone visibility range is no longer modified in 1.1.

The fade distance is set by custom asteroid lod xmf files tying into uniquified per-asteroid material entries which define start/end fade distances that match the region_lodvalues. They then link to uniquified shaders that are modified to enact the dithering.
Tested V1.1 and yes, its much faster. Well done!

You were correct, that I was working on an extracted version of your mod.

So if I want to increase the LOD distance of asteroids, I need to change the xmf files, the materials and the region_lodvalues? And they all need to match with each other? Especially the first part sounds like a lot of work :(.
XR Ship Pack (adds several ships from XR) Link
Weapon Pack (adds several new weapons) Link
Economy Overhaul (expands the X4 economy with many new buildings) Link
X4 Editor (view stats of objects and make your own mod within a few clicks) Link

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [MOD] Asteroid Fade-in

Post by SirNukes » Wed, 3. Jun 20, 01:10

If you want to change how far away asteroids spawn/fade in, you could change region_lodvalues and diff the new material entries with updated fade start/end values after this mod. Or just change region_lodvalues and run the script in the git repo.

If you specifically want to change lod switching distances, that shouldn't touch my stuff. You might have luck playing around with renderparam_library, and maybe attaching different render rules to regions.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [MOD] Asteroid Fade-in

Post by SirNukes » Wed, 3. Jun 20, 07:57

Updated to 1.2 with different dithering logic that doesn't track with screen pixels. Also reduced fade-in period to cap at 15 km start to end.

Max Bain
Posts: 1458
Joined: Wed, 27. Jun 18, 19:05
x3ap

Re: [MOD] Asteroid Fade-in

Post by Max Bain » Wed, 3. Jun 20, 10:40

edit: my mistake. Got it already.
XR Ship Pack (adds several ships from XR) Link
Weapon Pack (adds several new weapons) Link
Economy Overhaul (expands the X4 economy with many new buildings) Link
X4 Editor (view stats of objects and make your own mod within a few clicks) Link

Mycu
Posts: 408
Joined: Fri, 28. Sep 12, 08:30
x4

Re: [MOD] Asteroid Fade-in

Post by Mycu » Wed, 3. Jun 20, 12:01

New dithering in 1.2 makes this transition less noticable with camera angle change.
This mod in current state fixes for me one of the major immersion breaker in X4.
X3 AP 3.1 + XRM
X3 AP 3.1 + LU

Max Bain
Posts: 1458
Joined: Wed, 27. Jun 18, 19:05
x3ap

Re: [MOD] Asteroid Fade-in

Post by Max Bain » Wed, 3. Jun 20, 12:09

Just some more feedback. I tested the mod with increased view distances and even when I saw tons of asteroids, I got stable 60fps. The only cases where the fps went down are when fog was in the asteroid belt. Then the fps could go down to 35 (even with your reduced fog mod).

Here are my region_lodvalues (playing with Ryzen 3600 and gtx 1070, 16GB ram) (materials have been adjusted accordingly):

Code: Select all

			<!--XXL-->
			<distance minobjectsize="2500" component="30000" render="300000" calculation="300000" chunksize="128" />
			<!--XL-->
			<distance minobjectsize="1000" component="30000" render="264000" calculation="264000" chunksize="64" />
			<!--L-->
			<distance minobjectsize="500" component="30000" render="150000" calculation="150000" chunksize="32" />
			<!--M-->
			<distance minobjectsize="100" component="30000" render="100000" calculation="100000" chunksize="16" />
			<!--S-->
			<distance minobjectsize="50" component="10000" render="20000" calculation="20000" chunksize="8" />
			<!--XS Special, this rule was made by Simon for Objects like the Lockbox which has a size of ca 37.5m and was faded out a bit too early -->
			<distance minobjectsize="25" component="10000" render="20000" calculation="6000" chunksize="2" />
			<!--XS-->
			<distance minobjectsize="10" component="4000" render="6000" calculation="6000" chunksize="2" />
			<!--XXS-->
			<distance minobjectsize="0" component="2000" render="4000" calculation="4000" chunksize="2" />
Its impressive how much the fog reduces performance even when you nearly not notice it while on the other hand you can have thousands of asteroids in the view and have a stable 60 ftp :o
XR Ship Pack (adds several ships from XR) Link
Weapon Pack (adds several new weapons) Link
Economy Overhaul (expands the X4 economy with many new buildings) Link
X4 Editor (view stats of objects and make your own mod within a few clicks) Link

User avatar
Phinixa
Posts: 320
Joined: Sun, 4. Apr 10, 01:47
x4

Re: [MOD] Asteroid Fade-in

Post by Phinixa » Thu, 11. Mar 21, 14:51

Guess this mod is obsolete now that proper alpha-blend(judging from WeritGaming's youtube video) fade in is added to 4.0!
***modified*** 4 life!

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [MOD] Asteroid Fade-in

Post by SirNukes » Thu, 11. Mar 21, 19:19

I just checked, and the beta does indeed add alpha transparency to the base game. Though it still has the problem with big asteroids popping in with zone visibility. I'll hop over to the beta forum and make a post on how to fix it, after which my mod will be fully obsolete.

(A bit of a shame, since I am proud of the scripted lod/material patches and shader tweaks to make this mod work, but fading is still best as part of the standard game.)

|K.O.S.H.
Posts: 3724
Joined: Fri, 19. Dec 03, 10:36
x3tc

Re: [MOD] Asteroid Fade-in

Post by |K.O.S.H. » Fri, 12. Mar 21, 08:54

SirNukes wrote:
Thu, 11. Mar 21, 19:19
I just checked, and the beta does indeed add alpha transparency to the base game. Though it still has the problem with big asteroids popping in with zone visibility. I'll hop over to the beta forum and make a post on how to fix it, after which my mod will be fully obsolete.

(A bit of a shame, since I am proud of the scripted lod/material patches and shader tweaks to make this mod work, but fading is still best as part of the standard game.)
No shame. You made the game much better for many ppl (like me) for months.
Thank you for that.

See it that way: Even the developers appreciate your work so much, that they include it in the product!
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

R-TEAM
Posts: 133
Joined: Sun, 25. Dec 11, 19:50
x4

Re: [MOD] Asteroid Fade-in

Post by R-TEAM » Fri, 12. Mar 21, 10:44

Would be nice to have an updated 4.x mod where the big asteroids fade in is still here .... as i think the implementing from egosofts side (if it come) will take time ....

User avatar
Phinixa
Posts: 320
Joined: Sun, 4. Apr 10, 01:47
x4

Re: [MOD] Asteroid Fade-in

Post by Phinixa » Fri, 12. Mar 21, 15:21

|K.O.S.H. wrote:
Fri, 12. Mar 21, 08:54
SirNukes wrote:
Thu, 11. Mar 21, 19:19
I just checked, and the beta does indeed add alpha transparency to the base game. Though it still has the problem with big asteroids popping in with zone visibility. I'll hop over to the beta forum and make a post on how to fix it, after which my mod will be fully obsolete.

(A bit of a shame, since I am proud of the scripted lod/material patches and shader tweaks to make this mod work, but fading is still best as part of the standard game.)
No shame. You made the game much better for many ppl (like me) for months.
Thank you for that.

See it that way: Even the developers appreciate your work so much, that they include it in the product!
Indeed this mod is awesome and made travel-mode way more pleasent! So thanks SirNukes <3
***modified*** 4 life!

Falcrack
Posts: 4927
Joined: Wed, 29. Jul 09, 00:46
x4

Re: [MOD] Asteroid Fade-in

Post by Falcrack » Mon, 15. Mar 21, 11:44

This was a great mod, thanks for making it!!! The new effect in 4.0 b11 does look better, but I'm glad you helped inspire Egosoft to add that in.

steamjr00000000
Posts: 11
Joined: Mon, 13. Sep 21, 14:05

Re: [MOD] Asteroid Fade-in

Post by steamjr00000000 » Sat, 25. Sep 21, 13:40

This MOD doesn't work for me (4.10, GOG version). It makes asteroids invisible.

Falcrack
Posts: 4927
Joined: Wed, 29. Jul 09, 00:46
x4

Re: [MOD] Asteroid Fade-in

Post by Falcrack » Sun, 26. Sep 21, 07:00

steamjr00000000 wrote:
Sat, 25. Sep 21, 13:40
This MOD doesn't work for me (4.10, GOG version). It makes asteroids invisible.
This mod is obsolete since Egosoft added their own official version of fading in asteroids. I would remove this mod.

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [MOD] Asteroid Fade-in

Post by SirNukes » Tue, 28. Sep 21, 21:46

Git/steam are updated now (to 1.4), which seems to fix the invisible asteroids in my quick testing. I don't know what the problem was, but just rerunning my mod construction script appears to have worked.

And yes, egosoft added their own fade-in logic, which you can use if you prefer. I don't like the way theirs works, personally, since it still tends to have a lot of pop to it.

Post Reply

Return to “X4: Foundations - Scripts and Modding”