Epic Found a Way to Stop Stuttering in Unreal Engine 5 Titles

Listen to this article
0:00
Key points
  1. The stuttering is caused by modern games using too many shaders, which taxes the GPU. 
  2. Epic recommends games developers do precompilation to reduce runtime compilation. 
  3. Pipeline State Object caching is Epic’s solution.

Epic Games pinpointed the root cause of a widespread issue with stuttering affecting titles developed in Unreal Engine 5: there are too many shaders to load in real time, overwhelming the GPU.

When describing the reason for stuttering, Epic Games said, “a render engine discovers that it needs to compile a new shader right before it uses it for drawing something, so everything stops while waiting for the driver to finish compilation. To understand why this can happen we need to take a closer look at how shaders are translated into code that runs on the GPU.”

A GPU binary compiled for AMD is incompatible with NVIDIA, and even within the same vendor, instruction sets can vary between different hardware generations. In essence, Epic games cannot simply make a single code and distribute it out to fix the issue – if the problem was in relation to the CPU and not GPU, they could do that. 

Instead, Epic Games is introducing and recommending Pipeline State Objects precaching and Asynchronous compilation to resolve the issue. 

Pipeline State Object precaching is “a technique to determine potential PSOs at load time.” It essentially estimates a subset of possible, then attempts to precompile the necessary shaders in a cache, rather than relying solely on real time rendering alongside gameplay. 

If the game requires a previously compiled PSO (Pipeline State Object), the game pulls it from the cache rather than fully rendering it from scratch. 

This solution is limited in application, since the bundled cache is essentially useless if the environment changes according to the players’ actions. 

“Gathering it is resource-intensive and it must be kept up to date when content changes. The recording process might not be able to discover all the PSOs in games with very dynamic worlds: for example, if objects change materials based on player actions.

“The cache can become much larger than what’s needed during a play session if there’s a lot of variation between sessions, e.g. if there are many maps, or if players can choose one skin out of many,” said Epic Games’ representative.

Their workaround was to introduce PSO precaching, which determines potential PSOs at load time – this is not a perfect fix, as the subset is larger than what ends up being used, but it allows shaders to be compiled during loading. 

Related articles

  • Gaming Industry
    EA believes that the Switch 2 Might Provide “Real Energy” to FC and Madden
    • By Cedric Pabriga
    • 3 hours ago
    • 3 min
  • Gaming Industry
    Nintendo Has a Strategy in Place Against Nintendo Switch 2 Scalpers
    • By Cedric Pabriga
    • 5 hours ago
    • 2 min
  • Gaming Industry
    PlatinumGames Parts Ways with Game Directors and Removes Various Projects from its Website
    • By Terry Oh
    • 9 hours ago
    • 2 min
  • Gaming Industry
    Hitman and Forza Horizon 4 Co-Developer Sumo Digital Ends Independent Development, Layoffs Likely
    • By Terry Oh
    • 11 hours ago
    • 2 min