logoalt Hacker News

teamonkeyyesterday at 9:28 PM1 replyview on HN

Unreal’s limitation is that it doesn’t know how a shader will be used until it actually tries to render it on the target hardware. This is a trade-off to gain flexibility and rendering performance. The engine has to compile shaders on the fly when it is first used, which is fine if the shader is simple, but nowadays that usually is not the case.

There are ways to make a player’s PC compile shaders before realtime play begins, but it takes some setup and smaller devs might not know how to do it. This is most likely the reason why stuttering happens.

On fixed hardware targets (consoles, Steam Deck) you can ship precached shaders as you know everything about the target hardware.


Replies

formerly_provenyesterday at 10:33 PM

Console vs PC is a red herring since UE games still stutter on consoles, people just notice that less because most games run at 30 fps anyway. You can read Unreal's own blog posts on this and they'll actually explain that this is mostly down to their material system (and game logic/scripts reaching into it) being designed to create nearly infinite shader variations on the fly in response to arbitrary world/game states. This design choice separates engines which have shader stutters from those which do not.

https://www.unrealengine.com/tech-blog/game-engines-and-shad... https://medium.com/@GroundZer0/what-unreal-doesnt-tell-you-a... https://therealmjp.github.io/posts/shader-permutations-part1...

show 1 reply