The shader permutation problem: why and how to fix it

Started by JeGX, October 18, 2021, 06:04:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


It is no secret that we tend to have a bit of a problem with shader permutations in real-time graphics. It's such a bad problem that it not only affects graphics programmers, but also trickles down to all of the other content creators that use an engine. If you don't believe me, just go ahead and search for "unreal compiling shaders meme" on Google images and see what comes up.

If people are making memes about an issue then you know it's pretty bad, and the shader permutation situation can indeed be pretty bad. It's frustrating because collectively we have put a lot of effort into fixing or mitigating the problem, and yet it still hasn't really gone away. It's also frustrating because I've seen people trivialize it with suggestions like "just don't make so many shaders!" or "just use branching!" which I think misses a lot of the nuance and context of the problem. To help with those latter two, I thought I would spend some time talking about why permutations continue to be a problem and also give a little bit of history on how we got to this point. In part 2 I'll then talk a bit about the various options we have available that can help us to get out of this mess, and expand on what's good and bad about them.

- The Shader Permutation Problem - Part 1: How Did We Get Here?
- The Shader Permutation Problem - Part 2: How Do We Fix It?

Shader compile time - Unreal Engine

Shader compile time - Unreal Engine