Improving UE4 Shader Compile Times
May 27, 2019
Hey! Just a note, this has been pulled from my old site so, while this site is being built, some things may not work correctly or look right during the migration.
So if you're here, I'm going to take a lucky guess and say you feel shader compilation is slow and you want to speed it up.
Well, I'm happy to say that you're in luck! Speeding up the Shader Compiler is as easy as changing one number, seriously, ONE NUMBER!
I've had this "problem" a few times, I put "problem" in quotes as its actually a feature of the engine! One of the most demanding things is compiling shaders so Shader Compiler is set up to run at a lower priority so it doesn't cause issues with anything else, causing other programs to lag or freeze.
Before we get into it; I wouldn't recommend doing this on a low spec system due to the mentioned reasons. Also; it's only possible on the source version of the engine.
Before I begin, I should mention that I'm doing this on Ubuntu however Windows is the exact same process. I'm not even sure if this does anything on Linux.
1) First of all, if you haven't already, get the source version of the engine. Follow the guide here if you haven't done that yet. [Compiling Unreal Engine 4 From Source]
2) Open the Unreal Engine folder and go to:
3) Open ShaderCompiler.cpp in your favourite text editor, for now, I'm using the default text editor in Ubuntu, and search for "PriorityModifier".
4) As you can see; its set to -1 which is below normal. Increase that to "above normal" which would be 1.
You can set it higher or lower depending on your system performance.
And that's it! Just build the engine again and see a massive improvement in shader compile times. Remember that performance gains will vary from machine to machine. I saw an insane improvement on my main development machine, nearly cutting shader compilation times in half!
Thanks for reading. If this helped you, please consider buying me a coffee on Ko-Fi at https://ko-fi.com/rhyce. Or, you could check out one of my other posts such as;
How To Make Custom Unreal Engine Nodes Easily
Taking In-Game Screenshots With UI in Shipping builds of UE4 Games