Unreal Engine devs suggest a potential solution to shader compilation stuttering in games

Alfonso Maruccia

Posts: 2,511   +934
Staff
Utterly Unplayable: Unreal Engine is one of the most popular middleware solutions for developing games and other interactive experiences, particularly on PC and Mac. Created by Epic Games, it is also notorious for stuttering and graphics performance issues. However, the developers are actively working to address these problems once and for all.

If you've played a game released in the past few years, you're likely familiar with the frustrating experience of shader compilation stutter. Shaders are small programs executed directly by the GPU to handle various tasks required for rendering complex, feature-rich 3D graphics. When a rendering engine needs to compile a new shader just before drawing a scene on screen, everything comes to a halt while the GPU driver completes the task, resulting in the infamous stuttering effect many modern games suffer from.

Shader stuttering has become so widespread that Epic Games is now working to eliminate this multi-platform scourge of real-time graphics. Developers working on the Unreal Engine recently explained the importance of shader compilation and the root causes of stuttering. Kenzo ter Elst, Daniele Vettorel, and other Epic Games engineers have been developing a new system called PSO precaching, which, in theory, could make shader stuttering a thing of the past.

Pipeline State Objects (PSOs) are a method used by modern GPUs to bundle shaders and other graphics settings for a draw request into a single "unit," Epic developers explained, allowing them to be executed more efficiently. These PSOs can be built at any time and, theoretically, leveraged to optimize shader compilation, preventing stuttering during rendering.

Before Unreal Engine 5.2, Epic recommended that developers bundle the most common PSOs into a cache, allowing games to precompile most of the shader code during loading screens. However, converting bytecode shaders into GPU-specific binary code remains computationally demanding, and the cache often requires frequent updates in the ever-evolving environments of modern games.

According to Unreal Engine developers, PSO precaching could eliminate stuttering caused by this issue. The engine would analyze a recently loaded object and select a specific "subset" of all possible PSOs needed to render it. While this subset would still be larger than the actual PSOs used for rendering, it would be far smaller than the millions of possible rendering combinations.

With PSO precaching, precompilation would be significantly faster, introducing only a small, unnoticeable delay of just a few frames. Epic developers claim this system can "eliminate" PSO compilation stuttering for materials and work seamlessly with user-generated content. However, global shaders not associated with materials – such as those used for post-processing effects like motion blur – could still cause rare instances of stuttering the first time they are compiled. Unreal Engine's engineers are actively working to resolve this issue as well.

Permalink to story:

 
Could it be "optimization?" As nice as the idea of UE5 is, it's really not making any "playable" games. They need to get their **** together. It's not that the engine is *bad* it's that developers have no idea how to use it and just expect everyone to own a 4090.
 
Why is no one talking about DX12 "Work Graphs" anymore?

https://devblogs.microsoft.com/directx/d3d12-work-graphs/

"With Work Graphs, complex pipelines that are highly variable in terms of overall “shape” can now run efficiently on the GPU, with the scheduler taking care of synchronization and data flow. This is especially important for producer-consumer pipelines, which are very common in rendering algorithms. The programming model also becomes significantly simpler for developers, as complex resource and barrier management code is moved from the application into the Work Graph runtime."
 
Shader compilation stutter is basically modern gaming's version of "Please insert Disc 2." Except instead of a seamless transition, your screen freezes for three seconds while your GPU tries to solve the meaning of life.
 
In the early days, like doom3, games had a single shader for the entire game. Now a single material is made of number of combined shaders. It is these complex materials that are made of various combinations of shaders that makes it so hard to do them in advance. At the same time I wonder how hard can it be to maintain a list of all materials in the game?
 
You can have a well optimized game in 2025 lol just not from Unreal engine.
Cryengine game Kingdom Come 2 is shaping to be well optimized from the word on yt.
Maximum facepalm! Cloak engaged.

 
It'll only help if developers actually choose to use it, just like shader precompilation before loading into the game. Not many do, even if they do many don't do it well enough, so unfortunately I don't have much hope for this.
 
A bit off-topic from shaders, but I have to say, UE5 seems to be a detriment for gaming. I don’t understand why it feels so inefficient, but every game that uses it seems to have absurd system requirements just to hit 1440p, and sometimes even 1080p.

I get that it comes with a lot of "new features," but honestly, I don’t see a huge improvement. If a game is engaging, I’m not sitting around admiring reflections in windows and puddles. Sure, it looks better—maybe 10-20%—but it feels like you need 100-200% more GPU power to achieve that.

Maybe my aging 3070 Ti is part of the problem, and I just haven’t experienced these features at their best. But that’s kind of my point. If the enhancements are barely noticeable in actual gameplay, are they really worth the performance cost?
 
The UE5 showed alot of potential - but from what the reports says, it's hard to work with, especially when it comes to optimization. Would be nice to see a game that managed to actually make the best out of what UE5 is supposedly able to do.
But then again, look at Indiana jones, on a modified Id tech 7 engine - looks awesome, runs awesome - maybe we're just moving past the UE engine alltogether
 
One would think this would have been seen during the development process. Why wasn't this addressed prior to releasing the engine or at a minimum prior to releasing a game. It seems know stuttering would have been a priority to fix.
 
The UE5 showed alot of potential - but from what the reports says, it's hard to work with, especially when it comes to optimization. Would be nice to see a game that managed to actually make the best out of what UE5 is supposedly able to do.
But then again, look at Indiana jones, on a modified Id tech 7 engine - looks awesome, runs awesome - maybe we're just moving past the UE engine alltogether

Unreal dev and engine contributor here.
I don't think thats true at all.
 
Unreal dev and engine contributor here.
I don't think thats true at all.
I think that for most devs, Unreal Engine is too big and complex with a lot of black box code. "Optimisations" are not the priority besides the usual things that you can control somewhat like draw calls, polygons, etc.
 
Unreal dev and engine contributor here.
I don't think thats true at all.
Well, not going to speak for you - you are probably very good at what you do. But fact is, thus far very few games made in the UE5 engine has been released as well optimized. There’s a reason that people respond with scepticism and not excitement when a new game is announced being developed in the UE5 engine.
The showcase of features for it was great, but when people get their hands on it and it suffers both in the performance and stuttering department - people tend to get put off
 
A bit off-topic from shaders, but I have to say, UE5 seems to be a detriment for gaming. I don’t understand why it feels so inefficient, but every game that uses it seems to have absurd system requirements just to hit 1440p, and sometimes even 1080p.

I get that it comes with a lot of "new features," but honestly, I don’t see a huge improvement. If a game is engaging, I’m not sitting around admiring reflections in windows and puddles. Sure, it looks better—maybe 10-20%—but it feels like you need 100-200% more GPU power to achieve that.

Maybe my aging 3070 Ti is part of the problem, and I just haven’t experienced these features at their best. But that’s kind of my point. If the enhancements are barely noticeable in actual gameplay, are they really worth the performance cost?
The problem is it is a "one size fits all" solution which means it doesn't actually fit anything right, just well enough. Both of Ubisoft's specific game engines (AnvilNext and Snowdrop) seem to be able to do shader compilation on the fly good because they are Open World specific game engines while UE5 is not.
 
Back