A Call For Dx12 - Engine.ini Optimizations For Ue V4.26

Discussion in 'TSW General Discussion' started by geloxo, Dec 29, 2021.

  1. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I´m back with the game customization and with a call for developers to fully support DX12 in game due to the massive performance and stability gain obtained with UE 4.26. But there are still some old implementations that need a review as they create bottlenecks during tile loading and therefore the horrible hitching we can´t get rid of.

    The best solution to prevent stuttering is using G-sync (Nvidia) or Freesync (AMD) monitors or setting a fixed FPS target (40, 50 or 60 are fine) in game or in your graphics card control panel if you have a standard monitor. The reason is that many of the processing in game happens one or multiple times per frame and is distributed in several threads by UE, so having an stable FPS rate without sudden drops helps a lot for stability and smoothness. For the Nvidia case first check that your monitor supports it or is compatible with it in this link. Then activate it using Nvidia's control panel as follows and be sure that you select the "Highest available" refresh rate option to avoid that games set it to lower values. This prevents that compatible monitors which only support G-sync above 48Hz or 60Hz are forced to work on ranges where they are not fully compatible with G-sync technology. Remember to run game in full screen mode to get the best results with G-sync, even if windowed full screen mode is also supported.

    Note1: currently Nvidia does not support to enable G-sync on two monitors at the same time (even if this is possible in the control panel). Only your main monitor should have G-sync enabled to avoid errors. It´s better to disable that feature on the second monitor OSD menu directly.

    Note2: currently Windows 11 requires that V-sync is disabled in game and both V-sync and G-sync are enabled at Nvidia panel for G-sync to be enabled. V-sync must be enabled globally (don´t activate it in the games profiles).

    Gsync.jpg

    For those suffering too much stuttering you can also try to switch off HAGS (Hardware Accelerated GPU Scheduling) in Windows. This feature can create a lot of stuttering in many games but this may be dependant on your system so I just recommend it as an optional tweak. You can disable it as explained in the following link.

    My test system:
    • Intel i9-9900k 5 GHz
    • Nvidia RTX 3080Ti
    • 32Gb RAM DDR4 4400 MHz
    • Samsung 860 Pro SSDs
    • LG 38GL950G-B (3840x1600 G-sync monitor)
    My complete engine.ini file is included next. Start on an empty file including the performance optimizations alone and test and tune them if required. Then add the graphical variables and your other own settings. Increase the graphical variables values one by one to tune quality in steps and see the impact of each change on your system to find the best settings for you. Contents will be updated after test results included in the following posts. These settings can also be used with the standard DX11 mode if you prefer it. Texture streaming optimizations are marked in red, core performance optimizations in blue and optional graphical enhancements in green.

    Update 1 (thread sync): game uses an old UE implementation that creates microfreezes when loading heavy tiles or tiles containing moving trains inside. This is caused by game thread and render thread being synced to each other. UE allows to change this and force game thread to sync with RHI thread instead (RHI = Render Hardware Interface). This prevents that threads are stuck waiting until tile loading process is completed and greatly reduces the microfreezes. The following is required to activate this new method:
    • r.GTSyncType=1 (default value is 0 so game was using the old sync method. With 1 we activate the RHI method)
    • r.OneFrameThreadLag=1 (default value is 1 and should not be changed)
    The second variable is not required as it´s already set to 1 by default variables but I keep it in the config to notice its relevance, as it ensures that render thread is running 1 frame behind the game thread so both will stay synced, even if we change the sync method. Setting it to 0 can bring a significant performance loss (I have seen up to 30 fps losses in Hamburg station area during tests). More info about this method can be found in this link. I have seen the best results in game using this new approach when frame time limit and granularities variables are also kept as low as possible in order to obtain the best and lowest latency on the running threads.

    Update 2 (optimized texture streaming): in order to improve playability on heavy routes texture streaming shall be used with UE 4.26 as it avoids negative impacts on performance. But to prevent blurry textures and increase its capabilities the following optimizations are needed:
    • r.Streaming.FramesForFullUpdate (default value is 5. Reducing it speeds up the streaming calculations and reduces the blurry textures on high detailed cabs and scenery)
    • r.Streaming.PoolSize (default is 2500. Defines the amount of VRAM to be used for streaming. Should not be too big to leave room on your graphics card for the 3D rendering and normally not higher than its total amount of memory. Normally no more than 4Gb should be enough to deal with most of the routes but you can increase it if you have more memory)
    • r.Streaming.MaxTempMemoryAllowed (default is 200. Defines the temporary memory available to resize textures during streaming. This is a part of the pool not any additional memory so it should be always lower than the pool size but big enough to avoid delaying the streamer. Normally 1/4 of the total pool size is fine in most cases).
    • r.Streaming.Boost (default is 1. Values above 1 increase the desired texture mip map and provide better quality. This reduces some potential blurry textures on small assets like trackside boards placed at medium distance and enhances the foreground textures. This setting is optional, as it can reduce your performance).
    Configuration

    Current version of complete proposed optimized settings is listed below. Separate configs for Full HD and WQHD / 4K are provided:

    1) Full HD config (tested with 1920x1080 full screen mode and 200% scaling)

    [SystemSettings]
    r.Streaming.FramesForFullUpdate=2
    r.Streaming.PoolSize=8000
    r.Streaming.MaxTempMemoryAllowed=2000
    r.Streaming.Boost=2

    r.GTSyncType=1
    r.OneFrameThreadLag=1
    r.CreateShadersOnLoad=1

    r.Shadow.WholeSceneShadowCacheMb=2000
    gc.TimeBetweenPurgingPendingKillObjects=900
    gc.NumRetriesBeforeForcingGC=5
    gc.MinDesiredObjectsPerSubTask=20
    s.ForceGCAfterLevelStreamedOut=0

    s.ContinuouslyIncrementalGCWhileLevelsPendingPurge=0
    r.ShaderPipelineCache.BatchTime=2
    r.ShaderPipelineCache.BackgroundBatchTime=0
    r.ShaderPipelineCache.PrecompileBatchTime=0
    s.AsyncLoadingTimeLimit=2
    s.PriorityAsyncLoadingExtraTime=1
    s.UnregisterComponentsTimeLimit=2
    s.LevelStreamingActorsUpdateTimeLimit=2
    s.PriorityLevelStreamingActorsUpdateExtraTime=1
    s.LevelStreamingComponentsUnregistrationGranularity=10
    s.LevelStreamingComponentsRegistrationGranularity=50
    r.Streaming.NumStaticComponentsProcessedPerFrame=500

    r.ViewDistanceScale=2
    foliage.LODDistanceScale=4
    r.StaticMeshLODDistanceScale=0.25
    r.SkeletalMeshLODBias=-2
    r.Shadow.MaxResolution=4096
    r.Shadow.MaxCSMResolution=4096
    r.Shadow.DistanceScale=2
    r.Shadow.TransitionScale=2
    r.Shadow.CSM.TransitionScale=2
    r.Shadow.RadiusThreshold=0.005


    2) WQHD and 4K config (tested with 3840x1600 full screen mode and 150% scaling)

    Use the same variables as in the Full HD config case but reduce scaling to 150% or your system will struggle to handle such a big resolution. As lower fps values are expected due to higher resolutions the creation/destruction rates may need to be adjusted if you find some microfreezes, as they are the ones allowing the best fine tuning until they are optimally balanced. In this case you may need to decrease the following variables until you find the best combination for your system (check variables full explanation in the performance section):

    s.LevelStreamingComponentsUnregistrationGranularity
    s.LevelStreamingComponentsRegistrationGranularity
    r.Streaming.NumStaticComponentsProcessedPerFrame


    3) The "crazy horse" config (tested with both FHD and WQHD configs)

    The following settings can be used on high-end systems to take advantage of an odd behaviour due to the way unreal engine handles the loading of new levels. Higher quality settings can indeed reduce microfreezes much more than lower quality settings by means of increasing viewdistance and loading bigger amount of high detail LODs, textures and skeletal meshes earlier than the objects come to the foreground of player´s camera. This early loading and progressive memory usage prevents sudden bottlenecks while switching from one map tile to the next one while still taking advante of streaming benefits because that reduces LOD switching and texture resizing calculations on each frame. Use the same variables as in the previous configs cases and increase some or all of the following variables to set quality to its top limits (they are anyway limited to the overall max draw distance currently implemented in game):

    r.ViewDistanceScale=10
    foliage.LODDistanceScale=10
    r.StaticMeshLODDistanceScale=0.1
    r.SkeletalMeshLODBias=-10

    Note: if you have enough memory available in this case you can also set r.Streaming.PoolSize to your graphics card total amount of memory (and increase r.Streaming.MaxTempMemoryAllowed in accordance) to get the best possible streaming performance.

    Take into account that such high quality settings will have a massive impact on performance, in particular at big stations/yards with moving trains inside or when used together with high screen resolutions/scalings.


    Performance

    There´s a setting which is optional because it can have a negative impact on performance on some systems: r.TextureStreaming=0. This disables texture streaming and forces game to store high resolution textures in memory instead of adjusting them dynamically, which is better for quality but one of the effects of disabling it are microfreezes when loading some map tiles containing moving trains inside. On the other hand when texture streaming is enabled it reduces the overall workload and allows to smooth the heavy tiles loading. However some adjustments are still needed to prevent blurry textures, specially on high resolution cabs like the TGV one. They are included in the above optimized config. If you still prefer to disable texture streaming just replace the variables in red in my config by r.TextureStreaming=0. More info about the texture streaming feature is available in this link.

    The following block are some of the things that, together with garbage collector, creates most of the bottlenecks as it delays the threads on every frame, so reducing variables to the min values helps a lot to maintain smooth FPS and prevent stuttering as these artificial delays create lag during new tiles loading. Remember that independently from the used settings, whenever the new tile has to be loaded it will load at once, even if the pending processes are not finished, so it´s better to come to the loading point with the lowest possible latency. They just book some miliseconds per frame to manage shaders and to create and destroy the new objects. Increase them a bit if you find sound cuts or too frequent hitching and decrease them if you find lag during tile loading:
    • r.ShaderPipelineCache.BatchTime (default 16)
    • r.ShaderPipelineCache.BackgroundBatchTime (default 0)
    • r.ShaderPipelineCache.PrecompileBatchTime (default 0)
    • s.AsyncLoadingTimeLimit (default 5)
    • s.PriorityAsyncLoadingExtraTime (default 15)
    • s.UnregisterComponentsTimeLimit (default 1)
    • s.LevelStreamingActorsUpdateTimeLimit (default 5)
    • s.PriorityLevelStreamingActorsUpdateExtraTime (default 5)
    The next block deals with the amount of elements to destroy (the first variable) and to create (the other two variables) periodically. You may need to adjust them to your system capabilities and there are no magic numbers here. If you face bottlenecks you would need low values while if your system performs well you can take advantage of higher ones. Very basic rule of thumb from estimating variable values (the theory behind it):

    If game runs at 50fps, with 1ms frame time delay and granularity of 10 we would be requiring threads to handle around 500 objects per second (unregistration, registration or static objects creation depending on the granularity variable we set). For a granularity of 20 it will be 1000 objects and so on. The higher the frame delay the more time we give to threads to perform the task but the higher the potential microlags. The effective results depend on many factors such as which other tasks are pending, how your hw performs, how stable the fps are, etc, but it gives you an idea of what we are setting here. Min values for any of those variables should be always 1.
    • s.LevelStreamingComponentsUnregistrationGranularity (default 5)
    • s.LevelStreamingComponentsRegistrationGranularity (default 10)
    • r.Streaming.NumStaticComponentsProcessedPerFrame (default 50)
    With gc.TimeBetweenPurgingPendingKillObjects we define one of the main features of garbage collector: the interval in seconds to periodically clean unused objects. Too low values can unnecesarily delay the running threads while too high values can increase the memory usage. Default is 60 seconds. Other variables were also included to disable garbage collector being triggered just on the tile loading event and avoid the lag it creates.

    Another relevant variable is r.Shadow.WholeSceneShadowCacheMb. This is the size of the cache for the whole scene shadows. As we are running 4096 shadows this could be increased a bit to help performance as declared by unreal engine documentation. Anyway we don´t need crazy values here as shadows have a short diewdistance in game and therefore not a lot of high detail ones will be rendered at once. Normally something below 2Gb could be more than enough. Default is 150.

    Graphical settings

    These variables are optional and just enhance quality. Some comments about them and their impact in game are included next:
    • r.ViewDistanceScale produces a severe impact on performane even on high end systems when using values above 2, as it affects the quality of rails, catenary and overall draw distance, so don't go too extreme with it if you intend to use other high quality variables to tune LODs or shadows as well. I suggest to set this variable to 2 or 3 and don´t go beyond 3. Default is 1.
    • r.SkeletalMeshLODBias is the other variable that can have severe impact on performance as it defines the quality of distant trains. The value of -3 can be a problem on routes with frequently spawned trains one after the other inside the tiles, like the commuter ones. You can use -1 if you face performance issues. I suggest to set this variable to -2 or -3 and don´t go beyond -3. Default is 0.
    • r.StaticMeshLODDistanceScale defines the quality of buildings and structures. Min value is 0 but I recommend to use 0.1 instead to still have a kind of LOD scale. Value of 0.25 already prevents the pop in effect of buildings and structures. You can use 0.5 or 0.75 if you face performance issues. Default is 1.
    • foliage.LODDistanceScale defines the quality of distant trees. Value of prevents the pop in effect of trees. You can use 4 or 3 if you face performance issues. Default is 1.
    • Very important: don´t use the alternative variable foliage.ForceLOD=0 which is suggested in some configuration posts as this kills performance in routes with dense forests because it won´t allow any transition between tree LODs. As a general rule don´t use any variable that forces the highest detail LOD (LOD 0) without allowing it to change over the distance to camera or variables that disable the LOD system in any way. Those variables are just intended for debugging purposes to test the LODs themselves. Always use the scale variables instead as they just adjust the transition distances but still keep the LOD system active.
    Additional shadows configuration is explained in the this post.

    I recorded a short video in Hamburg-Lübeck route with my mobile (as it´s not possible to record the real effect of a G-sync monitor without recording the monitor itself) and despite the poor quality you can see how good the tile loading is now.



    A similar video recorded now with a TGV train to see the smooth rendering at some of the highest speeds in game.



    In my opinion this needs a testing on Dovetail side as the improvement is really significant for many of the heavy routes, so the sooner we have it fully supported the better for the performance and the gameplay.

    Cheers
     
    Last edited: Aug 2, 2022
    • Like Like x 36
    • Helpful Helpful x 8
  2. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,735
    Likes Received:
    17,949
    Unfortunately, your graphics settings reduce older hardware to slideshow-level framerates. On my i5/3GHz + GTX 1060, they're completely unusable.
     
    • Like Like x 3
  3. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    I tried DX12 and changed it back sharpish, too much stuttering.
     
  4. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Limit the FPS in game to 50 or above (whatever your system is able to handle). This is what prevents the stuttering if you don´t have a G-sync monitor. Whenever your system is able to stay at the FPS target you should not have any stuttering, just the tile loading hitching.

    I have mine limited to 85 in game, even if I use a G-sync monitor, as this prevents massive drops and therefore helps to get stability while rendering.

    Cheers
     
    Last edited: Dec 29, 2021
    • Like Like x 1
  5. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I just updated the first post with a better quality recording. This time I just used a 60 fps cap in game as you can´t record the results of G-sync in a game capture. As you can see there´s no stuttering provided that your system is able to maintain that fps limit and it only happens when your fps drop below it (see fps counter of top left corner). The tile loading hitching is still minimal as in the previous case when using DX12. G-sync is by far the best solution to remove stuttering completely but running at a fixed fps rate still provides good results.

    I forgot to activate the stereo mix, so that´s why sound vanishes in some cases in the recording.

    Cheers
     
    Last edited: Dec 29, 2021
    • Like Like x 1
  6. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,735
    Likes Received:
    17,949
    ROTFL!

    I'm lucky to get 35
     
    • Like Like x 2
  7. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    No need to expect 1000fps on every system... But if you want to get rid of stuttering just cap game to 30fps or the best value your system can reach. I just tried to explain that DX12 behaves much better in terms of performance to prevent the stuttering and tile hitching than DX11 does, specially on hevay routes :)

    Cheers
     
  8. robski

    robski Member

    Joined:
    Jul 11, 2019
    Messages:
    72
    Likes Received:
    89
    Hi all,
    you guys are real experts on the .ini settings, does anyone know how to change the distance signals can be seen?
    Or is that just the draw distance?
    Thanks
     
  9. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I don´t know how, as apparently they are independent items, meaning that they are not affected by any of the standard scaling variables:

    r.ViewDistanceScale
    r.StaticMeshLODDistanceScale
    r.SkeletalMeshLODBias

    Even setting those variables to their lowest or max values still displays the signals at the same positions for a given scene.

    By the way there was a copy/paste error from my notes in my previous post settings in the shadows section. We should change: r.Shadow.CSM.MaxCascades=2 by r.Shadow.RadiusThreshold=0.01. The first setting indeed reduces the cascades shadows quality while the new setting increases the small objects shadows and allows trackside cabinets, boards or catenary to produce much detailed shadows. Please just use Shadow.RadiusThreshold=0.01 or any value lower than 0.01 to get better shadows. Original post updated.

    Cheers
     
    Last edited: Dec 29, 2021
    • Like Like x 1
  10. JBViper

    JBViper Well-Known Member

    Joined:
    Jun 3, 2020
    Messages:
    330
    Likes Received:
    799
    I have just integrated your settings, and I confirm, Hauptstrecke Hamburg-Lübeck is much smoother. I used to have a lot of stuttering, a horror at times, and now it is almost non-existent! Thanks

    In addition, I have increased the following parameters :
    foliage.LODDistanceScale=5
    r.ViewDistanceScale=5
    and I added :
    r.BloomQuality=5
     
    • Like Like x 1
  11. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Nice to see that. Yes this may need a bit of fine tuning but it helps a lot. I´m currently doing some more research and testing but it clearly reduces stuttering and tile loading micro freezes. Indeed UE 4.26 seems to have improved many things in terms of rendering performance, so we are on the good way.

    Be careful with r.ViewDistanceScale. This is by far the one having the biggest impact. It increases three things: rails, catenary and overall scenery and also increases at the same time drawdistances + details. Indeed going above 4 seems not to increase drawdistance any further (or at least it´s not noticeable). However it adds a lot of extra workload as all the shadows/reflections related to those objects now rendered at higher detail are also rendered at higher detail as well. I have seen that a value of 3 starts to create serious problems on big yards and heavily populated tiles, so I´m not going any further than that. A value of 2 is even already demanding but indeed the value of 3 helps to process big scenes better than a value of 2 as distant things are preloaded into your system earlier.

    You also don´t need r.BloomQuality=5 if you are using the game graphical options max settings. This value is the default one for that max preset but there´s no problem to keep it in your file anyway. It´s just duplicated.

    One of the things I liked more from latest updates is that ambient light color shading changes a bit depending on the time of the year you chose. This is Hagen route in a December clear morning which brings darker green and brown colors to the scene compared to summer for instance, where they are more vivid. With the detailed shadows settings and the darker color shading it looks really pretty now.

    TS2Prototype-Win64-Shipping 2021-12-30 04-07-01.png

    Cheers
     
    Last edited: Dec 30, 2021
    • Like Like x 1
    • Helpful Helpful x 1
  12. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    How do these setting perform on LGV because that used to stutter terribly on DX12. Is this also greatly improved?
     
  13. davidh0501

    davidh0501 Well-Known Member

    Joined:
    Apr 29, 2020
    Messages:
    1,134
    Likes Received:
    1,638
    Sadly I don’t know enough to contribute to this discussion.

    But wouldn’t it be helpful if a knowledgable dev could join in and help clarify some of the details.
    Smooth running is the holy grail of software, and if Joe and Adam can occasionally join in the forum chat, why can’t others.
     
  14. JBViper

    JBViper Well-Known Member

    Joined:
    Jun 3, 2020
    Messages:
    330
    Likes Received:
    799
    Thank you geloxo for all your details, I'm rediscovering some roads now.
    As you mention, it would be nice if DTG would integrate it natively, especially the loading of the tiles which is becoming more and more visible since a year (impacting even the sound sometimes), the scenery around the track being more and more realistic and therefore busy.
     
  15. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    Be an improvement if they had DLSS implemented, I have Everspace2 with it and it is maxed out and plays smooth as butter. Just for us that only flirted with DX12, how does one activate it in-game again, its been a while.
     
    • Like Like x 3
  16. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Just add -DX12 to the launch options in steam (right click on TSW2 --> Properties --> General)

    Cheers
     
  17. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    Thank you.
     
  18. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    Is this line no longer needed? r.Streaming.HLODStrategy=2. Cheers
     
  19. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    geloxo I have very similar hardware to you apart from I have a 9700k at 5GHZ and a RTX3080TI. I also use a Gsync screen although I play at 1440p with 200% screen percentage. I have tried your settings on LGV and it stutters every few seconds. Even at low speeds This simply does not happen in DX11. By the way with those settings I am running at about 60fps on LGV.
     
  20. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    Below are the settings I use currently in DX11 mode. These are also from yourself and helped the stuttering immeasurably. Unfortunately I do not own Hamburg Lubeck but I do own Dresden Riesa.


    r.TextureStreaming=0
    r.CreateShadersOnLoad=1
    s.ForceGCAfterLevelStreamedOut=0
    s.ContinuouslyIncrementalGCWhileLevelsPendingPurge=0
    gc.TimeBetweenPurgingPendingKillObjects=0
    gc.LowMemory.TimeBetweenPurgingPendingKillObjects=0
    gc.LowMemory.TimeBetweenPurgingPendingLevels=0
    s.UnregisterComponentsTimeLimit=1
    s.LevelStreamingComponentsUnregistrationGranularity=10000
    s.LevelStreamingActorsUpdateTimeLimit=1
    s.PriorityLevelStreamingActorsUpdateExtraTime=1
    s.LevelStreamingComponentsRegistrationGranularity=10000
    r.Streaming.NumStaticComponentsProcessedPerFrame=10000
    r.ViewDistanceScale=3
    r.StaticMeshLODDistanceScale=0.25
    r.LandscapeLOD0DistributionScale=4
    foliage.LODDistanceScale=5
    r.Shadow.DistanceScale=2
    r.Shadow.TransitionScale=2
    r.Shadow.CSM.TransitionScale=2
    r.DynamicRes.FrameTimeBudget=0
    r.MaxAnisotropy=16
    r.Streaming.HLODStrategy=2
    s.AsyncLoadingTimeLimit=1
    s.PriorityAsyncLoadingExtraTime=0
    r.Shadow.WholeSceneShadowCacheMb=2048
    r.SkylightIntensityMultiplier=1
    r.AmbientOcclusion.Method=1
    r.GTAO.FalloffEnd=300
    r.GTAO.SpatialFilter=0
    r.GTAO.NumAngles=2
    r.GTAO.UseNormals=1
    r.GTAO.ThicknessBlend=0

    Thanks.
     
  21. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    As soon as you use r.TextureStreaming=0 the textures are fully loaded in memory as this disables the whole texture streaming, so the other setting is not needed. They both do basically the same thing. You can use r.Streaming.HLODStrategy=1 for instance, as this would limit the textures LOD, but with the value of 2 they are called to be loaded at the higher LOD, so it´s not adding anything extra compared to disabling the streaming itself.
     
  22. TKessel

    TKessel Well-Known Member

    Joined:
    May 5, 2021
    Messages:
    489
    Likes Received:
    1,223
    I just tried this Engine.ini Settings and I can only say thank you! Runs smooth and looks fantastic! Running on an AMD Ryzen 5800X paired with a RX6800XT.
     
  23. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    First thing to consider is that LGV is very demanding in general as there are many tile loading processes next to the other and some with very high detail but I don´t have any stuttering when driving slow. I just face the microfreezes of the tile loading when running fast. Anyway I just started testing it today.

    But I see some things on your settings which may not be optimal:

    You missed the most important setting for DX12: r.FinishCurrentFrame=1. It removes the buffered frames. This one is not needed in the case of DX11 but can be used too. Just try it. Buffered frames are not needed with a powerfull card as it is already able to develop high frame rates by itself.

    gc.TimeBetweenPurgingPendingKillObjects=0 --> this should not be 0 as it disables the cleaning and may rise your memory usage like crazy. Put something >0. Default value is 60 (seconds). You can try 10, 30, 100, 300, etc

    gc.LowMemory.TimeBetweenPurgingPendingKillObjects=0 --> this can be removed as your system will never go low of memory
    gc.LowMemory.TimeBetweenPurgingPendingLevels=0 --> same thing. This can be removed as well

    s.LevelStreamingComponentsUnregistrationGranularity=10000 --> I tried also such values and they can hurt more. Try between 1-10.
    s.LevelStreamingComponentsRegistrationGranularity=10000 --> same as before. Try between 1 to 10
    r.Streaming.NumStaticComponentsProcessedPerFrame=10000 --> same as before. This one can be something between 10, 50 or 100 as this deals with static objects while the other two deal with sounds, which usually are not so many at the same time compared to static objects. Take into account that very high values may produce hitching when loading tiles.

    Cheers
     
    Last edited: Dec 30, 2021
  24. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Ok... Interesting and fresh results after testing LGV. I just removed r.FinishCurrentFrame=1 as overall performance is severely affected in this route. Anyway this setting is only needed if you experience issues like flickering headlights or things like that when using DX12 (that was the case with the previous engine version). By using buffered frames you can get higher FPS, so this does not hurt unless your CPU is struggling.

    Main advantage when using DX12 in LGV is almost half of the memory usage than with DX11. This combined with the improved tile loading that DX12 allows produces a super smooth gameplay even at high speeds. There are still some very detailed areas which are hard to load but this is something I can´t figure out how to solve. As an average I can hit 80fps here so for me DX12 is a winner again. As before there are no CPU spikes and the memory usage is really low.

    LGV.jpg

    As part of the testing I introduced some modifications to my config which I would consider more optimal now:

    [SystemSettings]
    r.MotionBlurQuality=0
    r.TextureStreaming=0
    r.CreateShadersOnLoad=1
    s.ForceGCAfterLevelStreamedOut=0
    s.ContinuouslyIncrementalGCWhileLevelsPendingPurge=0
    gc.TimeBetweenPurgingPendingKillObjects=90
    s.AsyncLoadingTimeLimit=1
    s.PriorityAsyncLoadingExtraTime=1
    s.UnregisterComponentsTimeLimit=1
    s.LevelStreamingActorsUpdateTimeLimit=1
    s.PriorityLevelStreamingActorsUpdateExtraTime=1
    s.LevelStreamingComponentsUnregistrationGranularity=1
    s.LevelStreamingComponentsRegistrationGranularity=1

    r.Streaming.NumStaticComponentsProcessedPerFrame=10
    r.ViewDistanceScale=2
    foliage.LODDistanceScale=5
    r.StaticMeshLODDistanceScale=0.25
    r.SkeletalMeshLODBias=-3
    r.Shadow.MaxResolution=4096
    r.Shadow.MaxCSMResolution=4096
    r.Shadow.DistanceScale=2
    r.Shadow.TransitionScale=2
    r.Shadow.CSM.TransitionScale=2
    r.Shadow.RadiusThreshold=0.005
    ts2.passenger.DensityScale=2
    ts2.dbg.Camera.MaxVerticalHeight=10000
    gc.NumRetriesBeforeForcingGC=1
    gc.MinDesiredObjectsPerSubTask=10

    Note: r.FinishCurrentFrame=1 is not required anymore unless you face flickering headlights issues (produced in old UE 4.23)

    Basically I reduced the garbage collector cleaning interval to optimize memory usage and the granularity related to sounds destruction/creation to get the lowest possible latency. As the lowest latency allows also higher FPS at the end more amount of objects can be processed per second as the threads are not delayed artificially, which improves the overall performance. I also added the last two rows, which reduce even more the microfreezes caused by new tile loading. They avoid that too many objects are stacked in the cleaning process by triggering the garbage collector earlier and with smaller sets of subtasks each time. Default values for those variables are 10 and 128.

    Cheers
     
    Last edited: Dec 30, 2021
    • Like Like x 2
    • Helpful Helpful x 1
  25. dhekelian

    dhekelian Well-Known Member

    Joined:
    Nov 24, 2020
    Messages:
    2,054
    Likes Received:
    2,671
    It would be great to know any nVidia control panel settings to implement as well. I have 3060TI for instance.
     
  26. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    This is what I have at NVIDIA. I left vsync on as I needed for my second monitor, which is not G-sync compatible, but you can turn it off when using G-sync.

    nvidia.jpg

    An in the G-sync settings I have enabled both fullscreen and windowed modes. In the past the windowed mode didn´t work so well acording to some users but I didn´t find any issue when running games in borderless windowed mode.

    upload_2021-12-30_20-16-48.png

    Cheers
     
    Last edited: Jan 11, 2022
    • Helpful Helpful x 1
  27. dhekelian

    dhekelian Well-Known Member

    Joined:
    Nov 24, 2020
    Messages:
    2,054
    Likes Received:
    2,671
    Thank you geloxo.
     
  28. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    That's brilliant. Thank you, I will do some more testing myself tomorrow. To be fair my DX11 settings in LGV weren't that great when I tested at high speed, but were better at low speed.

    I know there used to be an issue with gauges appearing very blurred the faster you went. Is this now fixed in the new Unreal version?
     
  29. HeyYoPaulie!

    HeyYoPaulie! Well-Known Member

    Joined:
    Jan 23, 2021
    Messages:
    165
    Likes Received:
    381
    Curious to hear if you own Sherman Hill, and If so, what FPS are you getting with those settings?

    Anything above foliage.LODDistanceScale=1.5 almost halves frame rates on that route. And that's with a high spec PC (5600X, RTX 3080, PCIe 4.0 SSD)
     
    • Like Like x 2
  30. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I didn´t face any gauges issues nor issues in general with DX12 so far. It seems the UE 4.26 better supports it.

    I don´t have Sherman Hill, sorry. Will wait for the next sales and bug fixing cycles to get it as I got tired or bugs on day 0 releases with the older DLCs :D But this could be caused by the shadows as well. As I explained increasing LOD details also increases their shadows details, that on the other hand are normally increased themselves by other settings too. The best to diagnose is to test settings one by one to see which is the guilty one and don´t go too agressive with them. We are rendering a lot of things anyway and computers have their limits.

    Cheers
     
  31. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    The end of testing for today. The following four variables appear to be hopefully some of the latest remaining (if not the last ones) that create artificial lag on each frame, so setting them to 1ms just allows to get rid of many of the remaining microfreezes during tile loading:

    r.ShaderPipelineCache.BatchTime=1
    r.ShaderPipelineCache.BackgroundBatchTime=1
    r.ShaderPipelineCache.PrecompileBatchTime=1

    Similary to the sounds case they book some ms per frame to handle the shaders cache. With all the performance tweaks together we have saved around 50ms per frame. Although this is a very rough estimation taking into account that the typical order of magnitude for the unreal threads could be around 25ms, so we have freed the double of the latency on every frame, which is simply amazing. These are the details of the extra time we saved by reducing the lags produced by the default values:

    s.AsyncLoadingTimeLimit +4ms
    s.PriorityAsyncLoadingExtraTime +14ms
    s.LevelStreamingActorsUpdateTimeLimit +4ms
    s.PriorityLevelStreamingActorsUpdateExtraTime +4ms
    r.ShaderPipelineCache.BatchTime +15ms
    r.ShaderPipelineCache.BackgroundBatchTime (it was disabled, so probably it booked infinite time until completion)
    r.ShaderPipelineCache.PrecompileBatchTime +9ms

    As a result of this we can see LGV to its best, just putting the game to its knees in one of the worse environments including lights, shadows, tile loading, terrain meshes and the top speed so far. The results are self explanatory as we have virtually no freezes and a seamless tile loading under a stable 80fps rendering. Just take a look to the catenary poles as a reference. I´m so excited to see the results :D I quickly recorded a video with the mobile to see G-Sync in action (quality is not good again, sorry):



    So game can handle demanding scenarios but it seriously needs optimization as the default config variables are not allowing it to reach its best performance. I hope this helps and developers can take a look to it.

    Cheers
     
    Last edited: Jan 1, 2022
    • Like Like x 2
  32. Callum B.

    Callum B. Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    1,638
    Likes Received:
    2,844
    I'm not sure how many of these settings really affect the performance and how many are placebo, but I can confirm that after adding the core performance tweaks to my Engine.ini, a quick high-speed run on Köln-Aachen watching the frametime graph revealed immediate improvements. Good work! I'll see about creating a side-by-side comparison video later.

    Good work, geloxo.

    Cheers
     
  33. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    They are not placebo, thrust me. The main reason for the improvement is the removal of artificial delays in the running threads. We basically don´t need them as the new tiles will be always loaded when they need to be loaded, no matter which settings you used. Those delays are expected to allow the system to "pre-process" some work some ms just before the tile is visible and to perform the regular tasks while being inside the current tile to help performance. But when setting them too high you are creating a lot of lag at all places, not only at the border of the neighbouring tiles, so when you come to the event of loading the new tiles you have even more pending work to do than if your system would have done it on it´s own according to its available resources. If you try to load a yard with several trains on it then the threads can´t be that fast to do it due to those extra delays they need to wait. That´s why a low latency helps to load big tiles faster and this is the reason why DX12 mode is performing much better to achieve that and therefore to improve overall performance.

    This is Munich station with my settings and an amazing 4x viewdistance. One of the top challenging tiles for most systems. Look at the FPS counter and the resources monitoring: 56 fps, just a 20% average and 35% peak CPU superstable usage and just 4.7 Gb used by game. This is simply impossible with the default configuration. This tile loaded at 25 fps in the past if I was lucky...

    upload_2021-12-31_4-31-10.png

    I´m sure that other systems will improve as well. Maybe they need some tunning with the graphical quality if they can´t handle so much but at the end of the day the 3D loaded by this game is not as complex as in other games but engine uses a brute force approach inherited from the past when this is not really needed nowadays for modern systems. If developers just dedicate some time to fine tune it we can have amazing results. They don´t even need to change the code but just redefine the project variables.

    Cheers
     
    Last edited: Dec 31, 2021
    • Like Like x 3
  34. fanta1682002

    fanta1682002 Well-Known Member

    Joined:
    Dec 22, 2019
    Messages:
    1,175
    Likes Received:
    561
    i have Sherman Hill, .foliage.LODDistanceScale=1 48fps
    foliage.LODDistanceScale=5 24fps
    i pc i7 6900k+gtx1080ti sli ram32gb
     
    Last edited: Dec 31, 2021
    • Helpful Helpful x 1
  35. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I remember that Clinchfield had also severe impact on fps when using high lods on trees, as it has a lot of trees also, so performance impact was higher. It could be possible that they simply used in those new routes more detailed trees, or with a different LOD setting than the ones of the rest of the routes. Also the foliage density matters in such situation.

    There´s a variable that you can try to tune that: foliage.DensityScale (default value 1). Maybe reducing it a bit can help with Sherman Hill if you still want to keep the high LODs on the trees. This should reduce the amount of trees but I didn´t test it myself as I don´t have that route.

    Cheers
     
    Last edited: Dec 31, 2021
  36. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    For me DX12 still makes stutters bad, even following your settings, in particular, Riesa Dresden is the worst route for stutters and pauses irrespective of what DX version I'm using but less so with 11? My rig has an RTX3080 i9000k with 32Gb of ram and Steam installed on an M.2 drive.
    As far as I am concerned these stutters and pauses were introduced at or during the release of South Eastern high speed and were documented at the time, as far as I am aware there hasn't been an acknolwdgement of the issue?
    best settings under DX11 for me are:

    [SystemSettings]
    r.ViewDistanceScale=8.0
    r.Shadow.DistanceScale=2.0
    r.ShadowQuality=5
    r.LandscapeLODDistributionScale=3
    r.StaticMeshLODDistanceScale=0.25
    r.SkeletalMeshLODBias=-1
    r.MaterialQualityLevel=0
    r.Color.Mid=0.6
    r.AmbientOcclusionLevels=4
    r.BloomQuality=2
    r.TemporalAASamples=64
    r.PostProcessAAQuality=6
    r.MaxAnisotropy=16
    foliage.LODDistanceScale=8
    grass.densityScale=3
    r.LandscapeLODDistributionScale=3
    r.Tonemapper.Quality=4
    r.Tonemapper.GrainQuantization=1
    r.SceneColorFringe.Max=0
    r.SceneColorFringeQuality=0
    r.SkylightIntensityMultiplier=0.3
    ApplicationScale=0.30

    [/script/engine.renderersettings]
    r.ViewDistanceScale=15
     
    Last edited: Dec 31, 2021
    • Like Like x 1
  37. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    You view distance scale is far to high. Anything over 2 or 3 murders FPS.
     
  38. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    with your latest settings geloxo I have a marked improvement on LGV. Better than stock a stock ini file. Its just a shame about the tile load stutter which sometimes depending on the tile can be as bad as stock but obviously I have improved graphics settings. I am going to try dresden next. I have a video but im not sure how to upload as it is to large at nearly 500mb.
     
  39. doublefine7

    doublefine7 Well-Known Member

    Joined:
    Mar 30, 2020
    Messages:
    635
    Likes Received:
    1,179
    My biggest problem with these settings are that at times route scenery isnt loaded as fast as I drive so it sometimes happens to me that I enter a part of a route which isnt loaded so I drive into emptiness, so I have to go to the pause menu and wait until scenery has been loaded. Is there a specific command for it?
     
  40. Matto140

    Matto140 Well-Known Member

    Joined:
    Oct 11, 2017
    Messages:
    602
    Likes Received:
    786
    Is there a variable that affect visibility of long trains on Sherman Hill? I see that end of my train is always cut?
     
  41. 7orenz

    7orenz Well-Known Member

    Joined:
    Oct 5, 2018
    Messages:
    814
    Likes Received:
    1,062
    In reference only to DX12, some time ago I tried to record 2 identical videos (same route, same time of day, same timetable) between Bochum and Duisburg (HRR). Both videos lasted 40 minutes, The video recorded with the DX12 size about 3GB less than that recorded with the DX11.

    Question: maybe this happens because, even if we don't realize it, with DX12 you gain fps at the expense of the general quality of each single frame?
     
  42. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    My FPS is stable at 60.
     
  43. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Yes, the tile loading microfreeze is a real pain as I can´t figure out was else could be causing it. It´s not the FX particles as it happens even in the middle of the countryside, where no buildings with smoke are placed. It even happens when there are no trains ahead or in an empty scenario created with the editor, so it´s not the skeletal meshes nor the trains physics. On the other hand you may sometimes spawn a yard including several trains parked there without problems and on the other hand struggle with a simple siding placed next to a city. Something else in hidden in the threads or at some of the 3D objects and I can´t find it, but if we could get rid of this microfreeze then game would run perfectly.

    About the train lenght I think this is limited by the engine because also trains don´t visually spawn ahead of you until they are at a given distance, so maybe they are just being hidden after some distance from camera to save performance. Anyway the one that defines their amount of details on the distance is r.SkeletalMeshLODBias. You could try to put negative values like -5 or -10 to test it. They should increase quality more but I didn´t find any noticeable improvement when going below -3, so that´s why I kept that value.

    By the way I have modified the first post variables to reduce the cleaning interval (gc.TimeBetweenPurgingPendingKillObjects) and increased the sounds actors creation (s.LevelStreamingComponentsRegistrationGranularity). I think this may be healthier for most systems as it prevents memory usage and allows a bit more of actors creation in advance.

    Cheers
     
  44. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I didn´t find any evident sign of that in game, but maybe I´m missing something. The size of the video could be just explained by the encoding, if this was performed by your video card when recording it. What application did you use for recording? Maybe the application was also configured to use different codecs o quality presets for DX11 and DX12 recording. Are the bitrates identical in both videos?

    In terms of performance DX12 brings better CPU utilization in addition to better graphics performance for native DX12 cards. Just the two things which are relevant for a simulator with heavy scenes. In addition to that developers have potentially more control on how HW is used by game if they wanted. And don´t forget that with it the implementation of light ray tracing could be amazing. Just watch any of the latest UE 5 videos to see how landscapes and forests could be. There are demos now available where up to 50 million polygons are handled for a single character, so imagine... But that´s the next version of the engine. A long path ahead for us.

    Cheers
     
    Last edited: Dec 31, 2021
  45. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    I think that a problem crept in with asset loading in general, I've seen ground assets pop in in perfect time with the micro freeze, I wish DTG would take a look at it unless they are afraid it just might open a massive can of worms?
     
    • Like Like x 1
  46. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,735
    Likes Received:
    17,949
    Because DTG can't be seen to endorse monkeying around with the .ini file. Same reason they can't be seen to endorse mods or the unofficial editor.
     
    • Like Like x 2
  47. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    New performance optimization discovered. Render and game threads syncronization is using an old approach that creates the microfreezes when loading heavy tiles or tiles including moving trains inside. This can be changed by using a new variable:

    r.GTSyncType=1

    Details and optimized configuration updated in first post. Also due to the relevance of the change I will open a ticket at helpdesk for devs to take a look to this change as it greatly improves the tile loading. I have tested it in many of the more problematic scenarios with very good results. Very heavy tiles are still a challenge but it removes some of the other standard microfreezes and lags. If you want to try it and report results here you are welcome.

    Cheers
     
    Last edited: Jan 3, 2022
    • Helpful Helpful x 4
    • Like Like x 3
  48. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Does this only work with Dx12, or it has benefits while using Dx11 as well?
     
  49. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    This works with both DX11 and DX12. I always get best results with DX12 when using any of the proposed settings but you can still use them with DX11 as well.

    Cheers
     
  50. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Sadly DX12 deosn't seem to have any benefits to me on my system. But I'll try it with DX11, I love to try any perforamnce improvements.
     

Share This Page