Is there a “Catch All” Tweak to solve the notorious UE4 Asset Streaming+Shader Compilation Stutter?

Discussion in 'Game Tweaks and Modifications' started by BlindBison, Apr 4, 2022.

  1. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    I’ve seen a number of console commands and ini tweak thrown around but none of these seem to resolve the issues in my experience.

    A LOT of UE4 PC ports exhibit one or both of these issues with regards to stutter (asset streaming + shader compilation).

    As far as I can tell it’s not a hardware thing and as far as I know it’s just the way the ports were coded or a problem with the engine — not sure we can actually solve it, I’ve never been able to.

    Thanks,
     
    XOWNY likes this.
  2. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Only devs can really solve all issues with stutter and hitching on UE games, because many things are not set during runtime.
    We can only minimize some issues with some commands.
    Here are what I usually use in engine.ini

    [/script/engine.renderersettings]
    niagara.CreateShadersOnLoad=1
    r.CreateShadersOnLoad=1
    D3D12.PSO.DiskCache=1
    D3D12.PSO.DriverOptimizedDiskCache=1
    r.HZBOcclusion=0
    r.AllowOcclusionQueries=1
    r.Shaders.Optimize=1

    [TextureStreaming]
    r.Streaming.Boost=1
    r.Streaming.FullyLoadUsedTextures=1
    r.Streaming.HLODStrategy=2
    r.bForceCPUAccessToGPUSkinVerts=True
    r.Streaming.FramesForFullUpdate=60
    r.Streaming.DropMips=0
    r.Streaming.LimitPoolSizeToVRAM=0
    r.Streaming.MipBias=0
    r.Streaming.UseAllMips=1
    r.Streaming.UseMaterialData=1
    r.Streaming.UseNewMetrics=1
    r.Streaming.UsePerTextureBias=1
    r.Shaders.Optimize=1
    r.Shaders.FastMath=1
    r.UseShaderCaching=1
    r.UseShaderPredraw=1
    r.UseAsyncShaderPrecompilation=1
    r.TargetPrecompileFrameTime=13
    r.PredrawBatchTime=13
    r.AccelPredrawBatchTime=0
    r.AccelTargetPrecompileFrameTime=0
    r.Streaming.DefragDynamicBounds=1
    s.AsyncLoadingThreadEnabled=True
    r.Streaming.PoolSize=0

    [ConsoleVariables]
    AllowAsyncRenderThreadUpdates=1
    AllowAsyncRenderThreadUpdates=1
    AllowAsyncRenderThreadUpdatesDuringGamethreadUpdates=1
    AllowAsyncRenderThreadUpdatesDuringGamethreadUpdates=1
    AllowAsyncRenderThreadUpdatesEditor=1
    AllowAsyncRenderThreadUpdatesEditor=1
    s.AsyncLoadingThreadEnabled=True
     
    Last edited: Apr 5, 2022
  3. Smough

    Smough Master Guru

    Messages:
    984
    Likes Received:
    303
    GPU:
    GTX 1660
    I did this on Remnant From The Ashes and made the game run way, way better, like 90% less stutters, now I can traverse a whole map in the area without a single hitch. They still do happen on random occasions, but is not even close to what this game is without any tweaks.
     
    BlindBison likes this.
  4. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Glad it worked for you.
    You can also add these settings.

     

  5. Smough

    Smough Master Guru

    Messages:
    984
    Likes Received:
    303
    GPU:
    GTX 1660
    These go in [/script/engine.renderersettings]?
     
    BlindBison likes this.
  6. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Yes.
     
    Markie and BlindBison like this.
  7. XOWNY

    XOWNY New Member

    Messages:
    8
    Likes Received:
    4
    GPU:
    RX 5700 XT
    is there an equivalent to UE 3?
     
    BlindBison likes this.
  8. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Is this for the GameUserSettings.ini or a different one (Engine.ini perhaps)? Just want to double check I'm doing the correct file since the save location/installdir often have several inis. Thanks!

    I'm trying to give this a go in "The Forgotten City" which has shader compilation stutter, but I can't seem to track down an ini file that already has that renderer heading present.
     
  9. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    It's for the Engine.ini

    Also try running the game on DX12 mode.
    Just add this to the game's properties on Steam. This will also force a fast shader compiler.

    -dx12 -xgeshadercompile
     
    BlindBison likes this.
  10. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Thanks a lot, that's helpful!
     

  11. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Did it improve your gaming experience?
     
    BlindBison likes this.
  12. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Just tested it for about a 10 minute run (adding those lines to the engine.ini + adding that launch command).

    I verified the game was actually now running in dx12. Overall performance/the framerate was noticeably higher in DX12, but sadly the shader compilation behavior seems to still remain for this game (at least on my system -- though I think when I switched from dx11 to dx12 it had to recompile some of them and once I ran around a bit it seemed to smoothen out greatly for that given area -- I assume because finally all the shaders that were needed were compiled at that point).

    It might be notable that those particular sections you tweaked for the engine.ini simply weren't present for this game so I added them in. The only section that was present by default was the [Core.System] section. Thanks for all the advice, I'll try out those engine.ini tweaks and different dx versions (if available as launch commands) for future UE4 games I play.
     
    Last edited: May 22, 2022
    Horus-Anhur likes this.
  13. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Here is a more complete version of the commands with the new compiler. Just add to the Engine.ini
    Also, try disabling the shader cache on the nVidia Control panel.

    r.XGEShaderCompile=1
    r.XGEShaderCompile.Mode=1
    r.XGEShaderCompile.Xml.BatchGroupSize=256
    r.XGEShaderCompile.Xml.BatchSize=16
    r.XGEShaderCompile.Xml.JobTimeout=0.500000


    EDIT: The Forgotten City has the UE console enabled by default. So you can enter these settings while running the game.
     
    Last edited: May 22, 2022
    BlindBison likes this.
  14. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Thank you very much -- I expect this goes under the [/script/engine.renderersettings] section as well then? (along with your prior engine.ini tweaks -- or did you mean to add this all on its own under that engine.renderersettings section?) Thanks! Sorry to trouble you

    In the meantime I can try accessing the console directly in-game tomorrow. Thanks!
     
  15. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    It doesn't seem to make any difference. As long as it's in the engine.ini
    And as long as it's in a game that uses UE 4.18 or later.
    The Forgotten city is 4.26
     
    BlindBison likes this.

  16. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Thank you very much, will give this a shot!
     
  17. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Out of curiosity is there a reason why there are several duplicate lines in your original/attached Engine.ini tweaks?

    For example, under the [ConsoleVariables] section it looks like some of the lines are listed twice in a row:

    AllowAsyncRenderThreadUpdates=1
    AllowAsyncRenderThreadUpdates=1
    AllowAsyncRenderThreadUpdatesDuringGamethreadUpdates=1
    AllowAsyncRenderThreadUpdatesDuringGamethreadUpdates=1
    AllowAsyncRenderThreadUpdatesEditor=1
    AllowAsyncRenderThreadUpdatesEditor=1
    s.AsyncLoadingThreadEnabled=True


    Thanks! (Sorry to spam you)
     
  18. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Just an error copying and pasting.
    Delete the duplicates. Or don't, as UE will just assume one.
     
    BlindBison likes this.
  19. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,419
    Likes Received:
    1,146
    GPU:
    RTX 3070
    Thanks good to know -- sadly the most recent commands (.XGEShaderCompile=1, etc) didn't appear to resolve the issues in my local tests, argh. I really appreciate your time though, this has given a lot to try for future UE4 titles.
     
  20. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,731
    Likes Received:
    10,818
    GPU:
    RX 6800 XT
    Does this stuttering appear every time you run the game?
    Shader compilation should only appear once for every area, or effect.
    Otherwise it's probably asset streaming issues.
     
    BlindBison likes this.

Share This Page