Tricks to Speed Up Unreal Shader Compilation

If you’re at all familiar working within the Unreal Engine you’ll have seen that little blinking panel in the bottom right insistently informing you that the engine is ‘compiling shaders’.

This is a normal part of the game development process, but depending on how you’ve implemented the Materials in your project you may have several hundred, or several hundred thousand shaders that Unreal needs to compile. This process can range from a minor inconvenience to completely inhibiting, especially for those on lower-end hardware.

There are a number of tricks you can try that will both reduce the amount of time your shaders take to compile, as well as minimize the number of shaders that require compilation in the first place. Here is a list of those I’ve found most useful in order of efficacy:

  1. Add more Shader Compile Workers
  2. Set your Shader Compile Workers to a higher priority
  3. Reduce the complexity of your Materials
  4. Check your Material settings for unnecessary usages
  5. Reduce shader permutations in your project settings
  6. Minimize editor overhead
  7. Upgrade your hardware

Tried and tested by the Unreal Engine community, these techniques will give Unreal’s compilation tool a boost and help optimize your Material pipeline so you spend more time creating and less time watching a number slowly tick down to zero.

Before we get there, I thought it might be helpful to break down some of these terms. If you’re new to Unreal you might already be asking yourself ‘What is a shader? Why are there so many of them? Why do they take so much time to compile?’

Let’s get you up to speed.

What is a shader?

In Unreal (and computer graphics in general) a shader is a series of specific instructions that detail how an object is visually presented on screen. As your game world is drawn, shaders will inform the engine as to the final color value of each pixel.

It’s worth noting this technology is ubiquitous in graphics programming, not just in game development, and shader creation is a whole discipline in and of itself. It’s a wonderful rabbit hole to explore if you have the inclination.

Shaders range in complexity and associated performance cost. Here are a few common facets of the final look of your game that are affected by shaders in Unreal Engine specifically, just to give you an idea:

  • Color
  • Translucency
  • How your objects respond to light and shadow (including reflection, specularity, and self-shadowing)
  • The world position of the vertices of a 3D polygonal object
  • Tessellation (the dynamic subdivision of a polygon mesh to create denser geometry)
  • Color grading (post-processing)

Shaders Materials

In your adventures online you may come across the term ‘shader’ being used interchangeably with the term ‘material’. This is especially prevalent in Unreal-centered forums and message boards. This can sometimes be a cause for confusion as, although they are definitely not the same thing, in Unreal Engine the line is somewhat blurred.

You can think of a Material as the input a developer feeds into a shader to get a desired outcome. Assigning a texture and modifying float/color parameters are examples of this, as they represent the inputs that the shader then uses to calculate the end result.

In Unreal it gets a little muddy because when you’re using the node-based Material Editor you’re making both at once. In the editor, each node represents a module of HLSL shader code that are linked together to create a custom material/shader combination. A Material defines both the shader instructions and sets the default parameters it will use. This is why you’ll sometimes see Unreal developers using the terms ‘material’ and ‘shader’ to mean the same thing.

An example of five different Materials using the same Shader.

The most important thing to remember for our purposes is that one Material will generate multiple shaders. These are called ‘permutations’, and we’ll go into them in more detail in the next section.

If you’re looking for more context, my guide to Material and Shader Terminology has a more in-depth breakdown of these terms.

Why are there so many shaders to compile?

When Unreal compiles a shader, it takes the combined set of modular instructions you have set up in the Material Editor and generates an HLSL shader that the engine can then use to render the final result. It’s not as simple as that of course, but that’s the general idea.

It won’t have escaped your notice that Unreal compiles far more shaders than there exists Materials in your project. This is because for each Material Unreal will compile a shader for each potential usage case, and there can be a lot of those. You can find some of the common ones in the ‘Usage’ section of your settings panel within the Material Editor.

Each of these “Use with…” checkboxes represents at least one additional shader that needs to be compiled for your Material to support that feature. You can see why things start to add up fast, but that’s not the end of it.

If you’re using Materials which rely on Switches (namely Static and Quality Switches, as Switch Parameters are compiled at runtime), the number of shader permutations for the base Material is doubled for every possible variation.

Landscapes can be especially cumbersome as each component (a square section on the landscape grid) will generate unique permutations as well. For large worlds this alone can easily make the amount of shaders climb into the tens of thousands.

In general, unless you’re modifying a master material with a lot of instances, large-scale shader compilation should only take place the first time you open up a project on a new machine and when you go to package it for distribution.

Now that we know what we’re up against, let’s have a look at ways to reduce how much time the engine needs to spend in shader compilation.

New in Unreal Engine 5

With the release of Unreal Engine 5.0 came a new experimental feature called On-Demand Shader Compilation. It has since left beta, and starting with Unreal 5.1 it comes enabled by default.

With ODSC enabled Unreal will only generate the shaders required to render the currently loaded map rather than every possible permutation. This skips a lot of unnecessary computation, with Epic reporting a decrease in the number of required shader permutations by approximately 60%.

If you’re working in UE5.0 you can enable ODCS by adding the following to your Engine\Config\BaseEngine.ini under [/Script/Engine.RendererSettings]:

r.ShaderCompiler.JobCacheDDC=1

Those Unreal 5.1+ natives have no idea what we went through back in the day.

#1) Add more Shader Compile Workers

When Unreal Engine is running through the motions of compiling your shaders, the Editor itself isn’t actually doing much of the legwork. That burden falls on instances of a smaller program called a ‘Shader Compile Worker’ which runs behind the scenes.

If you’re on Windows you’ll be able to see the Shader Compile Workers in your Task Manager.

If your CPU has multiple threads you may be able to support more simultaneous Shader Compile Workers than Unreal creates by default. You can add more by navigating to Engine\Config\BaseEngine.ini and editing the following line, where x is the number of threads.

NumUnusedShaderCompilingThreads=x

This is a relatively safe setting to play with. If you set the number of unused shader compiling threads too high Unreal will lower it automatically.

Try as it might, it can’t use threads that don’t exist.

#2) Set your Shader Compile Workers to a higher priority

In the Details Tab of your Task Manager you’ll see that the priority setting for each of your Shader Compile Workers defaults to ‘below normal’.

Manually changing this to ‘Normal’ or even ‘Above normal’ will allow Windows to delegate more system resources to your workers, speeding up how fast they can get through your shader queue.

Sorry Mac & Linux users, this is a Windows-only trick. I expect there is a suitable equivalent on other operating systems, but you may have to do some digging to find it.

Heads up

You may be tempted (like I was) to set your Worker’s priority to ‘High’. I would advise against it.

This can give them equal priority to other programs that you need to keep your computer running properly, and can lead to a huge amount of slow down and potentially crash the Editor and/or your computer.

Compiler Booster

It would be remiss of me not to give a shoutout to Compiler Booster, an engine plugin by Ciji Games.

Compiler booster provides an easily accessible interface that lets you set Shader Compile Worker priority from within the Editor. This includes a checkbox that, when enabled, will automatically set each worker’s priority when it becomes available so you don’t need to dive into your task manager every single time.

It also has a safety net in the form of a giant reset button that you can hit if your computer starts to strain and you need to claw back some performance.

The plugin is a fantastic time saver, but just to be clear; Compiler Booster doesn’t do anything more than what could be done yourself by following the steps laid out in this article. That said, at $5.99US it’s inexpensive and it automates a fiddly and sometimes frustrating part of the compile process.

#3) Reduce the complexity of your Materials

Depending on each Material’s mathematical complexity, some will just take longer to compile than others. A Master Material with dozens of features and variations gated by switches will create a lot of unavoidable permutations. Moreover, each permutation will take longer to compile than shaders generated by something simpler, like an unlit Material.

Sometimes this is just the inevitable cost of having amazing looking surfaces in your games.

It pays to audit these larger Materials from time to time to make sure you’re making the most of their complexity. If you’ve got features you’re not using, cut them out and save yourself some time.

#4) Check your Material settings for unnecessary usages

All new Materials are created with a particular setting called ‘Automatically Set Usage in Editor’ set to true. This is a good thing as it means that the engine will only create shader permutations that you need for your specific project. For example, if your Material doesn’t need to be used with spline meshes it won’t create the shader permutations to support that feature.

However if those boxes are checked the engine won’t uncheck them for you if the condition that set it to true no longer applies. If you decide you no longer need the permutations for a particular usage like Niagara sprites, you’ll have to go in and untick that box manually. This would be true even if your Material is no longer applied to any Niagara sprites.

If you’ve got some particularly expensive Materials, especially master Materials with a lot of permutations on their own, it’s worth having a quick look over their your usage settings and making sure you’ve only enabled the features you need. This is particularly relevant if you’ve been prototyping, and throwing a lot of features at the wall to see what sticks.

You can see how this might quickly get out of hand.

#5) Reduce shader permutations in your project settings

In your project settings (towards the bottom of the rendering tab) are two sections called Shader Permutation Reduction and Mobile Shader Permutation Reduction, a series of checkboxes that let you wholesale disable shader permutations for engine features you don’t need. This can significantly reduce the amount of shaders you’ll need to compile.

Making any changes here will require an editor restart, and don’t forget to mouse-over for the tooltip. You’ll want to make sure you’re not using a feature that relies on those shaders or Unreal will kick up a fuss.

#6) Minimize editor overhead

Unreal Engine’s shader compiler uses an asynchronous streaming system where it will queue up shaders to be compiled, and process them one by one as you work. This is sometimes useful because it allows development to continue uninterrupted, but if you want your shaders compiled as fast as possible and out of the way it’s not as helpful.

The Unreal Editor itself is very taxing on your system’s resources, even when you’re not doing anything. This means that a good portion of your CPU (sometimes up to 80%, even when idle!) is busy just managing the editor. This doesn’t leave much space for the Shader Compile Workers to do their thing.

Making sure that the editor is not the active window will help, as Unreal will automatically use less system resources when not in focus (if you’re simulating your game you’ll notice your fps will drop significantly).

If you’d like to keep working though, you can still save some time by toggling off the realtime preview in your viewport by pressing Ctrl+R.

I have had mixed results with this technique, but others have found that setting your editor’s priority to ‘Low’ also helps a great deal.

#7) Upgrade your hardware

If you’ve done everything else and you’re still not satisfied with how fast you can churn through your shader queue it might be time to look at upgrading your hardware. Shader compilation leans almost entirely on your CPU, so if you’re looking to upgrade your rig that’s where I’d start.

Installing the Editor on an SSD is also highly recommended!

Additional resources

Thanks for reading my article on shader compilation. I hope I’ve helped you discover the biggest time sinks in your compile process and helped speed up some of the more frustrating aspects of working within Unreal.

I wouldn’t hold it against you if you were just absolutely sick of hearing about Materials and shaders by now, but if the world of shader development has at all grabbed your interest I’d recommend checking out some of these resources. Creating shaders can be a lot of fun, and there is a vibrant and welcoming community online with a wealth of knowledge.

Best of luck with your projects!

I am a technical artist from Adelaide, Australia. I created techarthub to share my knowledge and love for this industry. I hope you feel it too!

Welcome to techarthub

Hey there, I’m Nick!

Within these digital walls you’ll find a collection of guides and tutorials on a range of topics, as well as the assets, projects, and other resources I’ve created over the years.

Thank you so much for taking the time to look through my work.

I hope you find what you’re looking for!

Join the Community

Join the techarthub Discord Server, a community of technical art enthusiasts just trying to figure it all out together.

If you would like to support the creation of more techarthub content please consider becoming a Patron.

More from techarthub
A step-by-step guide to making your own bullet impact textures in Substance Designer.
Impact Decals are a great way to make your shots feel more powerful. Let's make one!
Get the most out of your static lighting with this comprehensive guide to the Lightmass section of your map’s World Settings.
The love/hate relationship with the framerate display is a mainstay of the game development experience.

Related Posts

This beginner-level Unreal Engine 4 tutorial will show you how to make a simple Distance Measurement Tool using Blueprint.
A closer look at Crunch, the public-domain compression library that can drastically reduce the size of your textures.
An exploration of three different ways to create a hexagonal sphere in Maya.
Scroll to Top