Flickering Headlights Issue

Discussion in 'TSW General Discussion' started by geloxo, Mar 5, 2021.

  1. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,698
    Hi,

    This issue is driving me crazy for a long time as it started to reproduce at the end of last year and nowadays it is happening very frequently. It appears randomly at any route, with any rolling stock and also AI trains suffer it. As you can see in the attached pictures there are rendering cycles where headlights are are turned on and then off resulting in very fast intermitent light (see illuminated track ahead in the pics).

    TS2Prototype-Win64-Shipping 2021-03-05 22-47-34.png

    TS2Prototype-Win64-Shipping 2021-03-05 22-47-33.png

    Normally you just restarted the game and the issue was gone but now it persists even after several restarts, which is a pain indeed and very annoying.

    But the most bizarre situation happened to me today. I realized that the issue was visible even it you are at the ESC menu. It is supposed that game is paused there (or at least the simulation is paused). Additionally I was recording a video to explain the issue and then everytime I started recording the issue was gone. As soon as I stopped the recording with the external application then the issue went back instantly.

    Did you guys have this issue as well? Anybody knows what could be causing this?

    Cheers
     
    Last edited: Mar 6, 2021
  2. Callum B.

    Callum B. Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    1,638
    Likes Received:
    2,844
    Are you using DX12? I have been experiencing this issue in DX12 as well for the past few months, and it only seems to be getting worse. Before, I was able to mitigate the issue by setting a 90FPS cap, but now it appears whenever it wants. Every update seems to make DX12 mode operate worse and worse, with higher stuttering and more strange artefacting. Of course, I cannot blame DTG for this because DX12 is unsupported (despite that they should be focusing core efforts on its development, in my opinion).

    If anyone is experiencing this in DX11 I would be curious to know. So far, I have not been able to replicate this issue in DX11.

    Cheers
     
    • Like Like x 1
  3. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,698
    Hi,

    Yes I have DX12 enabled. That could explain the results. I will go back to DX11 mode just in case as this issue is too annoying indeed. As you say it´s not DTG fault as it´s not supported so far. Thanks for the help.

    Cheers
     
  4. Shaun123

    Shaun123 Well-Known Member

    Joined:
    Jan 22, 2018
    Messages:
    501
    Likes Received:
    1,339
    Yep, DX12 plus letting the frame rate go uncapped = flickering lights.

    All using FXAA instead of TAA produces the same.
     
    • Like Like x 1
  5. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,698
    I had to go back to DX12 as the stuttering and lag are horrible without it. Today I have noticed that the headlights flickering effect is produced on full screen mode only. If I go windowed the flickering disappears and returns as soon I go back to fullscreen. Bizarre...

    Also the effect appears to be produced by the headlights reflection on the top of the rails surface, not by the headlights sources themselves. Two or three small light sources are created on the rails which are the ones responsible for the flickering on the environment around, as they are switched on and off producing the strobo effect, while the train headlights remain steady all the time.

    You can see them by disabling antialias (TAA) as TAA makes them diffuse. The small light spheres are clearly visible on the rails when you pan view around. With TAA enabled you can barely see the reflections but you still notice that rails has some reflections:

    TS2Prototype-Win64-Shipping 2021-03-14 00-01-13.png

    With TAA disabled you see them very clearly. They are the ones that are indeed flickering:

    TS2Prototype-Win64-Shipping 2021-03-14 00-00-59.png

    Maybe this helps to identify the reason for the problem and a potential fix. If somebody knows about a fix please share it.

    Cheers
     
    Last edited: Mar 13, 2021
    • Like Like x 1
    • Helpful Helpful x 1
  6. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,698
    Ok guys, good news. I found a possible solution for the lights flickering when using DX12 mode ;) We need to add the following parameter to engine.ini:

    r.FinishCurrentFrame=1​

    According to unreal docs this parameter does the following:

    If on, the current frame will be forced to finish and render to the screen instead of being buffered. This will improve latency, but slow down overall performance.

    This one is a performance killer and for DX11 is not an option as fps frop dramatically but with DX12 gameplay is still smooth even if fps drop a bit. Indeed with it the average FPS are more stable. This variable is disabled in game default settings.

    To test it I did the following:
    1. Without adding it yet to the engine.ini I waited for the issue to be reproduced in game.
    2. Then I injected it using the unreal console (using r.FinishCurrentFrame 1) and the flickering was gone.
    3. I disabled it back in the console afterwards (using r.FinishCurrentFrame 0) and the flickering problem was reproduced again.
    If someone could please test it as well using the same method we could confirm it as a valid solution for the issue and we could again use DX12 as the performance is by far better than with DX11 mode. After this it seems the root problem are the buffered frames.

    Cheers
     
    Last edited: Mar 15, 2021
    • Like Like x 1
  7. fanta1682002

    fanta1682002 Well-Known Member

    Joined:
    Dec 22, 2019
    Messages:
    1,175
    Likes Received:
    561
    ok go to text
     
  8. trainside

    trainside New Member

    Joined:
    Apr 15, 2021
    Messages:
    18
    Likes Received:
    16
    I've been reading here on forum on the the different posts on DX12 and the various issues it involves including the flickering headlights and "dust" on the windscreen. I've had same issues including windscreen going completely opaque. So I thought I share how I solved them.

    I experimented with the different command variables for Unreal Engine 4 found on this page https://digilander.libero.it/ZioYuri78/ including reading different post on other forums including Reddit. For me the command variable that caused the issues is r.AmbientOcclusionLevels

    By default this is set to r.AmbientOcclusionLevels=-1 in Train Sim World 2

    I solved these issues by adding the command variable r.AmbientOcclusionLevels=1 to Engine.ini

    [/Script/Engine.RendererSettings]
    r.AmbientOcclusionLevels=1

    When changing to r.AmbientOcclusionLevels=1 Ambient Occlusion will be without soft addition but it's hardly noticeable.

    Note* I'm running Train Sim World 2 on a 4k monitor (3840x2160). I'm not sure if changing to r.AmbientOcclusionLevels=1 will be more noticeable on a lower resolution monitor.

    The same thing happens for me (flashing headlights, dust and opaque windscreen) with the command variables r.AmbientOcclusionLevels=0, r.AmbientOcclusionLevels=2 and r.AmbientOcclusionLevels=3.

    I don't know what is different with the command variable r.AmbientOcclusionLevels=1 except what is explained on https://digilander.libero.it/ZioYuri78/ searching for r.AmbientOcclusionLevels

    I hope this can be of some help.
     
    • Helpful Helpful x 2
    • Like Like x 1
  9. hyperlord

    hyperlord Well-Known Member

    Joined:
    May 20, 2019
    Messages:
    1,245
    Likes Received:
    1,270
    Thanks for sharing your findings!
    So, did I get this right that when you set

    r.AmbientOcclusionLevels=1 (was 4 for me, changed it now)

    the headlight flickering dissapears without the need to set r.FinishCurrentFrame=1 ?

    Because that would make it possible for me to switch over to DX12 ;-)
     
  10. Callum B.

    Callum B. Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    1,638
    Likes Received:
    2,844
    I tried it out on a Köln to Düren S-Bahn service and did not see any flickering, so it seems to be working, though I will need to test it more. Definitely a good find!

    Cheers
     
    • Helpful Helpful x 1
  11. trainside

    trainside New Member

    Joined:
    Apr 15, 2021
    Messages:
    18
    Likes Received:
    16
    Yes
     
  12. Cotax

    Cotax Well-Known Member

    Joined:
    Mar 25, 2021
    Messages:
    150
    Likes Received:
    329
    Will try this settings. I have this problem - maybe this will solve it! Will report.

    [​IMG]
     
  13. kosti.nuuja

    kosti.nuuja Well-Known Member

    Joined:
    Oct 14, 2020
    Messages:
    514
    Likes Received:
    1,233
    No help. Still fickering.
     

Share This Page