[QUESTION] LOD and Effects distance

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

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

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

[QUESTION] LOD and Effects distance

Post by Mr.Freud » Sun, 19. Jan 20, 12:07

Is it possible to increase LOD and Effects distances past in-game options max? I've tried messing with the config file but any setting above 1.0 seem to actually decrease the distances.

User avatar
Shuulo
Posts: 1629
Joined: Mon, 14. Apr 08, 17:03
x4

Re: [QUESTION] LOD and Effects distance

Post by Shuulo » Sun, 19. Jan 20, 15:47

Mr.Freud wrote:
Sun, 19. Jan 20, 12:07
Is it possible to increase LOD and Effects distances past in-game options max? I've tried messing with the config file but any setting above 1.0 seem to actually decrease the distances.
I beleive there is a draw distanse in some game parameters file, you can try look through file sin libraries, if you unpacked the game.
Also, most effects have set draw distance in effects file, like smalleffect, largeeffect etc, and this distances are defined in defaults or paramaters library, can't remember precisely atm

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Mon, 20. Jan 20, 10:08

Shuulo wrote:
Sun, 19. Jan 20, 15:47
Mr.Freud wrote:
Sun, 19. Jan 20, 12:07
Is it possible to increase LOD and Effects distances past in-game options max? I've tried messing with the config file but any setting above 1.0 seem to actually decrease the distances.
I beleive there is a draw distanse in some game parameters file, you can try look through file sin libraries, if you unpacked the game.
Also, most effects have set draw distance in effects file, like smalleffect, largeeffect etc, and this distances are defined in defaults or paramaters library, can't remember precisely atm
Thank you!
So I've found 3 files:
particle_effects
region_lodvalues
renderparam_library


I'm complete noob in modding, so first thing I tried was just changing parameters. Dropped tweaked files in your mod folder for testing purpose, to see if they're working, but there was no difference.
Then I checked your files in your mod's
libraries
folder and noticed lines like
replace
and
add
and now found out about XML patching thing. I have two questions:
1) Is it necessary to use XML patching method? Or can I just replace default parameters?
2) If It's necessary - How do I do it? Do I need special software for XML patching? If yes, where can I get it? I looked in tutorial section but there's no links to the software needed. Or do I write those lines manually?
p.s. Sorry for taking your time. I probably sound like a complete noob.

User avatar
Shuulo
Posts: 1629
Joined: Mon, 14. Apr 08, 17:03
x4

Re: [QUESTION] LOD and Effects distance

Post by Shuulo » Mon, 20. Jan 20, 10:24

Mr.Freud wrote:
Mon, 20. Jan 20, 10:08

Thank you!
So I've found 3 files:
particle_effects
region_lodvalues
renderparam_library


I'm complete noob in modding, so first thing I tried was just changing parameters. Dropped tweaked files in your mod folder for testing purpose, to see if they're working, but there was no difference.
Then I checked your files in your mod's
libraries
folder and noticed lines like
replace
and
add
and now found out about XML patching thing. I have two questions:
1) Is it necessary to use XML patching method? Or can I just replace default parameters?
2) If It's necessary - How do I do it? Do I need special software for XML patching? If yes, where can I get it? I looked in tutorial section but there's no links to the software needed. Or do I write those lines manually?
p.s. Sorry for taking your time. I probably sound like a complete noob.
XML is just a text file really, there is certainly some software to automate it but i find it redundant for X4 modding.
You can use just Notepad to change XML, i suggest Notepad++ for a start, but i use VSCode.
Those lines are just added manually, find the node in xml file you want to replace or add to and do "diff" thing, refer to my mod files as it seems you are already looking at that :)

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Mon, 20. Jan 20, 12:55

Shuulo wrote:
Mon, 20. Jan 20, 10:24
XML is just a text file really, there is certainly some software to automate it but i find it redundant for X4 modding.
You can use just Notepad to change XML, i suggest Notepad++ for a start, but i use VSCode.
Those lines are just added manually, find the node in xml file you want to replace or add to and do "diff" thing, refer to my mod files as it seems you are already looking at that :)
So I edited
renderparam_library
I looked at your files as an example and to me it looks like I did it right way, but Im not sure. Could you please take a look if you have time?
https://drive.google.com/open?id=1kku22 ... MCtXo34m_u
One file is original another one is edited for comparison

User avatar
Shuulo
Posts: 1629
Joined: Mon, 14. Apr 08, 17:03
x4

Re: [QUESTION] LOD and Effects distance

Post by Shuulo » Tue, 21. Jan 20, 01:05

Mr.Freud wrote:
Mon, 20. Jan 20, 12:55
Shuulo wrote:
Mon, 20. Jan 20, 10:24
XML is just a text file really, there is certainly some software to automate it but i find it redundant for X4 modding.
You can use just Notepad to change XML, i suggest Notepad++ for a start, but i use VSCode.
Those lines are just added manually, find the node in xml file you want to replace or add to and do "diff" thing, refer to my mod files as it seems you are already looking at that :)
So I edited
renderparam_library
I looked at your files as an example and to me it looks like I did it right way, but Im not sure. Could you please take a look if you have time?
https://drive.google.com/open?id=1kku22 ... MCtXo34m_u
One file is original another one is edited for comparison
Diff seems to be correct. Though i have no idea what impact those changes have.

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Tue, 21. Jan 20, 11:15

Shuulo wrote:
Tue, 21. Jan 20, 01:05

Diff seems to be correct. Though i have no idea what impact those changes have.
no impact at all. It's probably hardcoded or Im missing something. Thank you for help :)

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

Re: [QUESTION] LOD and Effects distance

Post by Max Bain » Tue, 21. Jan 20, 11:50

Mr.Freud wrote:
Tue, 21. Jan 20, 11:15
Shuulo wrote:
Tue, 21. Jan 20, 01:05

Diff seems to be correct. Though i have no idea what impact those changes have.
no impact at all. It's probably hardcoded or Im missing something. Thank you for help :)
Hi, no its not hardcoded (except for asteroids, they seem to be hardcoded). I have a private mod that increases LOD disctances for all ships and details. It works pretty well. I guess for effects its the same.
When I am back home I will post what you have to do. The Renderparam_library is the right file to look into.
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

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Tue, 21. Jan 20, 17:00

Max Bain wrote:
Tue, 21. Jan 20, 11:50
Mr.Freud wrote:
Tue, 21. Jan 20, 11:15
Shuulo wrote:
Tue, 21. Jan 20, 01:05

Diff seems to be correct. Though i have no idea what impact those changes have.
no impact at all. It's probably hardcoded or Im missing something. Thank you for help :)
Hi, no its not hardcoded (except for asteroids, they seem to be hardcoded). I have a private mod that increases LOD disctances for all ships and details. It works pretty well. I guess for effects its the same.
When I am back home I will post what you have to do. The Renderparam_library is the right file to look into.
Thank you!

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

Re: [QUESTION] LOD and Effects distance

Post by Max Bain » Tue, 21. Jan 20, 21:58

The first example will increase the distance you see the more detailed LODs for S sized ships and the second one does the same for the engines. Hope that helps.

Code: Select all

<diff> 	
	<replace sel="//renderparameters/lodrules/rule[@name='dbglodrule_ship_s']">
		<rule name="dbglodrule_ship_s" range="30000.0" sizecontrib="50" speed="2.0" priority="1" lodradius0="200" lodradius1="100" lodradius2="10" lodradius3="3">
		  <connections>
			<tag name="ship_s" />
		  </connections>
		</rule>  
	</replace>	
	<replace sel="//renderparameters/lodrules/rule[@name='dbglodrule_engine']">
			<rule name="dbglodrule_engine" range="20000.0" sizecontrib="50" speed="1.0" lodradius0="50" lodradius1="25" lodradius2="10" lodradius3="5">
			  <connections>
				<tag name="engine" />
				<tag name="enginejet" />
			  </connections>
			</rule>
	</replace>	
</diff>
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

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Wed, 22. Jan 20, 00:08

Max Bain wrote:
Tue, 21. Jan 20, 21:58
The first example will increase the distance you see the more detailed LODs for S sized ships and the second one does the same for the engines. Hope that helps.

Code: Select all

<diff> 	
	<replace sel="//renderparameters/lodrules/rule[@name='dbglodrule_ship_s']">
		<rule name="dbglodrule_ship_s" range="30000.0" sizecontrib="50" speed="2.0" priority="1" lodradius0="200" lodradius1="100" lodradius2="10" lodradius3="3">
		  <connections>
			<tag name="ship_s" />
		  </connections>
		</rule>  
	</replace>	
	<replace sel="//renderparameters/lodrules/rule[@name='dbglodrule_engine']">
			<rule name="dbglodrule_engine" range="20000.0" sizecontrib="50" speed="1.0" lodradius0="50" lodradius1="25" lodradius2="10" lodradius3="5">
			  <connections>
				<tag name="engine" />
				<tag name="enginejet" />
			  </connections>
			</rule>
	</replace>	
</diff>
Thanks! Would've never figured that out myself.
p.s. MASSTRAFFIC EVERYWHERE! lol

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Fri, 24. Jan 20, 22:00

I'm trying to figure out how to increase draw distance of stations docking area light. Anyone has any idea? Increasing overall stations draw distance doesn't have the effect on a docking area light.
I mean this light
https://imgur.com/rN66IFz

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Sat, 25. Jan 20, 01:00

I have found how to increase asteroids draw ranges. Tweak "region_lodvalues".
Here's Argon Prime. I tweaked it to extreme values(but not max) so FPS drop A LOT. Also they eat a lot of RAM. Afraid to check other sectors :D
https://steamuserimages-a.akamaihd.net/ ... 13BDE6DC5/
https://steamuserimages-a.akamaihd.net/ ... 9302921F5/

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

Re: [QUESTION] LOD and Effects distance

Post by Max Bain » Sun, 26. Jan 20, 20:49

Mr.Freud wrote:
Sat, 25. Jan 20, 01:00
I have found how to increase asteroids draw ranges. Tweak "region_lodvalues".
Here's Argon Prime. I tweaked it to extreme values(but not max) so FPS drop A LOT. Also they eat a lot of RAM. Afraid to check other sectors :D
https://steamuserimages-a.akamaihd.net/ ... 13BDE6DC5/
https://steamuserimages-a.akamaihd.net/ ... 9302921F5/
Thats cool! Thanks for sharing the solution :)

Edit: There is no "region_lodvalue" Can you tell me what exact value you have edited?
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

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Mon, 27. Jan 20, 14:07

Max Bain wrote:
Sun, 26. Jan 20, 20:49
Mr.Freud wrote:
Sat, 25. Jan 20, 01:00
I have found how to increase asteroids draw ranges. Tweak "region_lodvalues".
Here's Argon Prime. I tweaked it to extreme values(but not max) so FPS drop A LOT. Also they eat a lot of RAM. Afraid to check other sectors :D
https://steamuserimages-a.akamaihd.net/ ... 13BDE6DC5/
https://steamuserimages-a.akamaihd.net/ ... 9302921F5/
Thats cool! Thanks for sharing the solution :)

Edit: There is no "region_lodvalue" Can you tell me what exact value you have edited?
region_lodvalues is xml file in libraries. Its in 08 catalogue

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

Re: [QUESTION] LOD and Effects distance

Post by Max Bain » Mon, 27. Jan 20, 14:31

Thanks. But do you have a clue what all these values mean?

Code: Select all

<distance minobjectsize="2500" component="250000" render="250000" calculation="270000" chunksize="128" />
Would be very interesting to know what else we can change here except the range until objects pop up...

Works great btw for the asteroids popping up far earlier. THink it will only effect GPU performance and not overall game performance if the graphics card is good.
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

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Mon, 27. Jan 20, 15:19

Max Bain wrote:
Mon, 27. Jan 20, 14:31
Thanks. But do you have a clue what all these values mean?

Code: Select all

<distance minobjectsize="2500" component="250000" render="250000" calculation="270000" chunksize="128" />
Would be very interesting to know what else we can change here except the range until objects pop up...

Works great btw for the asteroids popping up far earlier. THink it will only effect GPU performance and not overall game performance if the graphics card is good.
First is the size of an object. 2nd seems to be the level of detail IMO. 3rd and 4th are distances at which object renders and its position calculated. The last one - chunksize - I'm not sure exactly but when I was experimenting with the settings and doubling those parameters game would stop launching at some point and would hang in processes constantly getting more RAM unless I doubled chunksize too. Maybe it's amount of resources available for each size?
Im not sure if it's about GPU - with x2 of those settings in asteroid heavy sectors I see that CPU is loaded a lot and GPU usage drops to the point where it even downclocks because not needed. I have 9900k and 2080ti

Zano
Posts: 9
Joined: Sun, 18. Jan 04, 09:47
x4

Re: [QUESTION] LOD and Effects distance

Post by Zano » Fri, 7. Feb 20, 14:53

hey guys i need some help with region_lodvalues.xml trying to figure out how to change the draw distance on asteroids, i can't get the patching done right, pointing me in the right direction is much appreciated :)

Code: Select all

<diff> 
    <!--XXL-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="2500" component="250000" render="450000" calculation="270000" chunksize="256" />
    </replace>
    <!--XL-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="1000" component="30000" render="264000" calculation="166000" chunksize="128" />
    </replace>
    <!--L-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="500" component="30000" render="160000" calculation="82000" chunksize="62" />
    </replace>
    <!--M-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="100" component="30000" render="80000" calculation="42000" chunksize="32" />
    </replace>
    <!--S-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="50" component="10000" render="20000" calculation="12000" chunksize="16" />
    </replace>
    <!--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 -->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="25" component="10000" render="20000" calculation="6000" chunksize="8" />
    </replace>
    <!--XS-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="10" component="4000" render="8000" calculation="6000" chunksize="8" />
    </replace>
    <!--XXS-->
	<replace sel="//regionlods/distances/distance">
    <distance minobjectsize="0" component="2000" render="4000" calculation="4000" chunksize="8" />
    </replace>
</diff>

Mr.Freud
Posts: 301
Joined: Sat, 16. Nov 13, 20:20
x4

Re: [QUESTION] LOD and Effects distance

Post by Mr.Freud » Fri, 7. Feb 20, 16:51

Zano wrote:
Fri, 7. Feb 20, 14:53
hey guys i need some help with region_lodvalues.xml trying to figure out how to change the draw distance on asteroids, i can't get the patching done right, pointing me in the right direction is much appreciated :)
like this (with default parameters)

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//regionlods">
<regionlods>
   <distances>
    <!--XXL-->
    <distance minobjectsize="2500" component="2500000" render="2500000" calculation="2700000" chunksize="256" />
    <!--XL-->
    <distance minobjectsize="1000" component="300000" render="1640000" calculation="1660000" chunksize="128" />
    <!--L-->
    <distance minobjectsize="500" component="30000" render="80000" calculation="82000" chunksize="32" />
    <!--M-->
    <distance minobjectsize="100" component="30000" render="40000" calculation="42000" chunksize="16" />
    <!--S-->
    <distance minobjectsize="50" component="10000" render="10000" calculation="12000" 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="10000" calculation="6000" chunksize="2" />
    <!--XS-->
    <distance minobjectsize="10" component="4000" render="4000" calculation="6000" chunksize="2" />
    <!--XXS-->
    <distance minobjectsize="0" component="2000" render="2000" calculation="4000" chunksize="2" />
  </distances>
</regionlods>
</replace>
</diff>

Zano
Posts: 9
Joined: Sun, 18. Jan 04, 09:47
x4

Re: [QUESTION] LOD and Effects distance

Post by Zano » Fri, 7. Feb 20, 19:58

Mr.Freud wrote:
Fri, 7. Feb 20, 16:51
Zano wrote:
Fri, 7. Feb 20, 14:53
hey guys i need some help with region_lodvalues.xml trying to figure out how to change the draw distance on asteroids, i can't get the patching done right, pointing me in the right direction is much appreciated :)
like this (with default parameters)

Thanks working perfectly :)

Post Reply

Return to “X4: Foundations - Scripts and Modding”