Unreal Engine 4 titles and stuttering/hitching

Discussion in 'Games, Gaming & Game-demos' started by Carfax, Dec 20, 2019.

  1. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    As many of you know, UE4 games are well known for having a stuttering problem. I used to think it was due to the asset streaming efficiency of the engine, but now I know that isn't the case; at least most of the time.

    The past few months have seen two major UE4 titles come to PC, Jedi Fallen Order and Gears 5. The former being DX11 and the latter being DX12. While I had no problems with Gears 5 when it launched (it ran beautifully), the last few patches have left the game with serious performance issues on my rig. Gears 5 would run absolutely horribly on my rig, with lots of lag and hitching and stuttering. This is a far cry from how it ran originally when it launched, and I've been tearing my hair out trying to figure out why this has happened.

    I tried reinstalling Windows 10, different drivers, disabling control flow guard, different SSD, different antivirus all to no avail.

    What fixed it in the end was something so simple, you could not believe. I merely turned shader cache on in the NVidia driver control panel! :eek: Doing this fixed every problem I had with the game's performance.

    The setting is typically turned on by default globally, but I've always disabled it because I didn't want any unnecessary writes to my SSD. Plus I've never really known it to have a significant impact on performance generally speaking.

    But now it seems that games are actually being designed with shader caches in mind. While Gears 5 originally had no problem running without shader cache turned on, but the developer changed something in how the game is programmed and now it runs like crap if shader cache is disabled. Why would they do this?

    Probably to reduce CPU cycles and make it so that lower spec machines can run the game properly. Shader compilation is something that the CPU does on the fly in real time, and depending on how many threads are available for that function and how fast the CPU is, can make a huge difference in a player's overall experience. It's also probably the number one cause of stuttering in PC games, especially if shader compilation is running on the same thread as the renderer. So what shader cache does is store the pre-compiled shaders so that they only need to be fetched rather than actually compiled in real time, lowering CPU time.

    This seems like an excellent concept to reduce CPU time and stuttering, but from my experience, it depends on the 3D engine if it's useful or not. With Frostbite 3 games for example, turning the shader cache on doesn't seem to have much of an effect, and this is likely because the Frostbite 3 engine is more parallel than UE4. By that I mean it has more threads available for rendering and shader compilation, so the latter running in real time doesn't interfere with rendering and cause lag and stuttering.

    Battlefield 5 needs at least a straight quad core to run properly, while Gears 5 will run decently on a dual core with SMT enabled. You get the point.

    Anyway, I enabled shader cache for Jedi Fallen Order as well and voila, stuttering and hitching diminished by roughly 90%! It's still there, but compared to how it was before it's literally night and day. And I have the game installed on a fast NVME SSD. It's likely that the other 10% is due to the game's weak streaming and single threaded nature because of DX11.

    TLDR; Shader cache must be enabled on all modern UE4 titles to have good performance and to minimize stuttering and hitching. :cool:
     
    Smough likes this.
  2. Astyanax

    Astyanax Ancient Guru

    Messages:
    4,449
    Likes Received:
    1,289
    GPU:
    GTX 1080ti
    DirectX 12 creates pipeline and shader caches, i didn't believe the nvcp control covers either as they are application generated by nature.
     
  3. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    ^^ That's a good point. It shouldn't be possible, but perhaps something has changed with NVidia's drivers over the past few months. I was blaming the games themselves, but maybe it's the drivers. All I know is that Gears 5 was practically unplayable for me with tons of lag and stutter, but after enabling shader cache, it's now absolutely perfect. Jedi Fallen Order was certainly playable before enabling shader cache, and in fact, I beat the game with it turned off. But since turning it on, stuttering has diminished significantly and the game is much more fluid.

    Since shader cache is turned on by default, it seems that some games now require it to function properly when it comes to shader management.
     
  4. Astyanax

    Astyanax Ancient Guru

    Messages:
    4,449
    Likes Received:
    1,289
    GPU:
    GTX 1080ti

  5. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    That's definitely useful information, but it doesn't explain my performance issues when shader cache is set to off. Shouldn't PSOs be unaffected by the shader cache being disabled since according to that blog, PSOs are generated either before or during gameplay and should be stored in VRAM once they're compiled?
     
  6. mbk1969

    mbk1969 Ancient Guru

    Messages:
    8,414
    Likes Received:
    5,299
    GPU:
    GeForce GTX 1070
    Do you have 100GB SSD? Shader cache folder is small, and files in it should be created only once - when game creates/allocates shader for the first time. So no big and no frequent write operations.
     
  7. Astyanax

    Astyanax Ancient Guru

    Messages:
    4,449
    Likes Received:
    1,289
    GPU:
    GTX 1080ti
    the limits on the shader cache have been lifted for a while, it grows past Gigabytes in size now.
     
  8. mbk1969

    mbk1969 Ancient Guru

    Messages:
    8,414
    Likes Received:
    5,299
    GPU:
    GeForce GTX 1070
    For 10-20 games?

    PS "Limits"? Do you think one game can produce shaders for GBs?
     
  9. Astyanax

    Astyanax Ancient Guru

    Messages:
    4,449
    Likes Received:
    1,289
    GPU:
    GTX 1080ti
    Not this decade.

    Who knows about the future though, theres a lot going to be happening in stuff like cyberpunk and star citizen.
     
  10. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    I have a Samsung 960 Pro 1TB SSD, and an 850 Pro 1TB as well. That said, space wasn't the primary issue for why I disabled shader cache globally. As I said in my OP, the setting can either help or harm games, so it should really be done on a case by case basis.

    I just played Forza Horizon 4 and that game is smooth as butter and is DX12. You have to wonder why Gears 5 is so dependent on the shader cache, when other DX12 games don't have that problem.
     

  11. ramthegamer

    ramthegamer Ancient Guru

    Messages:
    3,778
    Likes Received:
    208
    GPU:
    Gigabyte GTX 970
    I have star wars and the game runs very nicely on my system, so no, it is dependant on the system, i have zero issues with UE4 games, so the problem people are having are basically related to their setups...
     
  12. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    You obviously didn't read the OP. Shader cache is turned ON by default in the driver control panel. Unless you purposely turn it off like me, then you probably would never have encountered these problems. That said, Jedi Fallen Order has a stuttering problem that is universal, regardless of setup or platform. The consoles have way more problems with this game in terms of stuttering, hitching and lag because the game's streaming algorithm has not been optimized well.
     
  13. ShadowDuke

    ShadowDuke Ancient Guru

    Messages:
    3,769
    Likes Received:
    366
    GPU:
    MSI Gaming 970
    Sigh. No!

     
    toyota likes this.
  14. angelgraves13

    angelgraves13 Ancient Guru

    Messages:
    1,636
    Likes Received:
    402
    GPU:
    RTX 2080 Ti FE
    It runs pretty smooth for me. I do have quad channel memory though so my minimums are usually pretty high. Not sure what causes stutters for you.
     
  15. SpajdrEX

    SpajdrEX Ancient Guru

    Messages:
    2,139
    Likes Received:
    460
    GPU:
    Sapphire RX5700XT
    No stuttering here also.
     

  16. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    I have quad channel as well. As I said in my OP, the reason is because you likely have shader cache enabled by default. Gears 5 seems to be an anomaly however, because even if shader cache is disabled, the game isn't supposed to react in that manner as it is a DX12 game and DX12 games supposedly have superior resource management.

    Jedi Fallen Order I can kind of understand because it's using DX11 and probably uses no more than 4 threads altogether, so shader compilation is likely being piggybacked on a single thread.
     
  17. K.S.

    K.S. Ancient Guru

    Messages:
    2,054
    Likes Received:
    532
    GPU:
    EVGA RTX 2080 Ti XC
    UE4 doesn't appear to have any known-bad issues of note far as anyone's aware of or any documented review yet. Sure 1, 2 games? A GoW and a SW game but that doesn't really reflect the engine just because they were developed with poorly coded respective rendering pipelines...

    Mmm... BFV is Frostbite note sure how that got inserted into there; beyond that I'm confused...
     
  18. XenthorX

    XenthorX Ancient Guru

    Messages:
    2,878
    Likes Received:
    800
    GPU:
    EVGA XCUltra 2080Ti
    Unreal Engine is used from Disney attraction parks, to animated serie, architectural visualization, Serie and Movies previz/realtime render (Mandalorian serie anyone?), a ton of video games.
    It's a powerhouse built on 30 years of game making experience and tons of AAA games released.
    There's nothing wrong with it.

    Check this, i'm a single developer on Unreal Engine, testing some clouds technology for my procedural planets:

     
    Last edited: Dec 21, 2019
    Archvile82, Carfax and mbk1969 like this.
  19. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    Perhaps I was too hasty in saying UE4 in general has this problem, but these Gears 5 issues I was having really pissed me off. Generally speaking, I've always had very positive things to say about UE4 and I've defended it many times in debates on these forums.

    However, it does have a reputation for stuttering that seems to have carried on from UE3/3.5. From my own experiences, the stuttering is definitely related to shader compiling. I don't know about you guys, but for me Gears 5 is atrocious without shader cache enabled. It never used to be like that I think, which is why I created this thread to investigate and see if I was the only one.

    The reason why I brought up Frostbite was to show that not all 3D engines require shader cache to be on to have smooth gameplay.
     
  20. Carfax

    Carfax Ancient Guru

    Messages:
    2,673
    Likes Received:
    311
    GPU:
    NVidia Titan Xp
    C'mon man, you know me. I've defended UE4 countless times and been very positive about it on these forums. But my experiences with Gears 5 (one of the most optimized UE4 titles to date) these past few weeks has left me bewildered.

    It seems that the game now requires shader cache turned on to function properly. Without it, it's a lag and stutter fest. I don't know what's going on with that. As a DX12 game, it's supposed to compile all the shaders before or during gameplay and it shouldn't have these major performance problems that require the shader cache to fix them.

    Yeah I know man. That's why I'm glad you responded to this thread. :D Do you still have Gears 5 installed by chance?
     
    XenthorX likes this.

Share This Page