[UE5] Compiling Shaders On Every Startup

Hey! I started learning UE5 last week just before the release the other day (I’ve since updated to the latest version). Since starting I’ve noticed it says “compiling shaders”. I tried to look into this more but most of the information is for UE4 and didn’t work for me on UE5. I know this has been asked a lot before, but like I said most information is for UE4.

From what I understand it’s only supposed to do this once (or after a big project change) and store it in some sort of cache so next time it’s a lot quicker? For me, it compiles it every time I launch the same, basic project with no changes and it takes roughly 30 minutes to compile sometimes over 8,000 shaders. Then sometimes does it again when the editor has actually opened. This is very annoying as I have to plan when I want to be creative and can’t do much else with my computer in the meantime.

I haven’t got the most high-end computer possible but seems fine running UE5 after the shaders have finished compiling. I understand it’s probably important for UE5 to function fully but surely you shouldn’t have to plan an hour before every time you want to use UE5?

This software looks awesome and I really can’t wait to use it properly, but at the moment it just feels very discouraging to use and I really don’t want this to put me, or others, off learning it because of this.

7 Likes

I’m also having this problem. What’s worse, is that the actual compilation is moving at a snail’s pace (much more than an hour for me). I have a 12-core 24-thread processor but the editor is only using 5-6% of my CPU to compile the shaders. Really hoping someone has a fix for this.

1 Like

This might help (994) Compiling Shaders Unreal Engine 5 start up issue FIX FOR MAC IOS - YouTube

The same solution is also mentioned here UE4 "Compiling Shaders" is super slow - Real Time VFX

Tried it, and the start up speed does become fast. However, shaders are compiled when I open an existing project. And the compilation is as slow as before. I try to modify the WorkerProcessPriority value in the BaseEngine.ini configuration file. Then the compilation becomes faster.

1 Like

Regarding worker count, UE5 introduced some new settings in BaseEngine.ini: ShaderCompilerCoreCountThreshold and PercentageUnusedShaderCompilingThreads. The documentation is quite self-explanatory:

; Core count threshold.  Below this amount will use NumUnusedShaderCompilingThreads.  Above this threshold will use PercentageUnusedShaderCompilingThreads when determining the number of cores to reserve.
ShaderCompilerCoreCountThreshold=12
; Percentage of your available logical cores that will be reserved and NOT used for shader compilation
; 0 means use all your cores to compile Shaders
; 100 means use none of your cores to compile shaders (it will still use 1 core).
PercentageUnusedShaderCompilingThreads=50

From what I understand from ShaderCompiler.cpp:3427, for a machine with 24 threads, this new default has the side effect of changing worker count from 21 (24 - 3 unused defined by NumUnusedShaderCompilingThreads in BaseEngine.ini) in UE4 to 12 (24 * 50%) in UE5.
You can set PercentageUnusedShaderCompilingThreads=0 but that might starve your machine, or increase ShaderCompilerCoreCountThreshold to a value > to your thread count so you keep 3 threads for editor/game tasks.
Cheers!

1 Like

Any help for a non-coder who is trying to get UE5 shader compiling to load much faster?

I tried the fix posted by @yaoyuh involving the semi colon delete from that one file. It seem to have improved start up a wee bit, but I’m trying to run this on macbooks w MS/HS learners come August and they aren’t going to be able to wait 20+ minutes for compiling to kick in JUST to start up UE5, much less work on a project.

after it has compiled the shaders
you must save the scene for the cached shaders to stick or you wasted time.
Remove all platforms you aren’t really building for like linux and choose only ogl or vulkan, not both.
If your ddc is at default, then if your main drive is near full its always going to happen.
change your ddc to a different drive, it can grow to many gigs

1 Like

Hello,

The compiling Shaders numbers simply isn’t even going down. So I cannot enter my editor.
Also, Unreal Engine is using 0% of my CPU, so I’m very stuck.

all the solutions i c everywhere assume something is happening, but for me simply nothing happens.

First time i opened the project I had to w8 0 seconds now it doesn’t even compile 1 shader.
explorer_e5ezudv8d2

obvious question
do other projects still compile or is it any project
you can also take a clean project and just copy the content folder into it and try that

(Version 5.0.1 in MacBook Pro)

So. A couple of months ago I applied this fix:

And it worked fine, for some time. But some days ago it started to happen again, even though that parameter in ConsoleVariables.ini is still set to 0. I’m not sure why it happened again. It seems it started happening when I opened “UnrealEditor” directly instead of “Epic Games Launcher”, but I can’t see why it might be the reason, and I just don’t have time to discover it by trial and error, so there’s that. I suspect that there must be another cause (e.g. files in the DDC path had an almost zero size and I have no clue about DDC but it doesn’t look right).

Today, I applied this fix as well:

It seemed to help me to compile the shaders a bit faster in the beginning (but not a big deal). It still took me more than 3 hours to 1) open the project and 2) wait until the “Preparing Shaders” step finished.

After my project was finally ready, I saved the scene so the compiled shaders are cached as @christuusgnosis suggested here: [UE5] Compiling Shaders On Every Startup - #6 by christuusgnosis

And then I closed everything and reopened the project. Now it’s working again. I think the only really relevant action I took was just wait until everything is loaded and stable, and then save everything and restart.

I’m not happy about this. It can happen again at any time.

You have it.
make sure the ddc isn’t too small and is set up correctly
then when you open a new proj
you walk away for an hour (or sometimes more)
The UE5 city sample took 3 hours to compile the shaders
City Park environment takes about 1.5 hours
but once they ahave completely compiled
if you save, the build data for the meshes and shaders is saved
so it should load in minutes after
unless you change platform settings
The same applies to building a packaged game
the first time takes looooong
and each time you redo it it will go fast as long as you did a build before

Thanks for the reply. I hope it doesn’t happen again. But, if it does, I’ll simply leave the project opening while I’m going to bed.

My guess is aggressive compilation of content in the project’s folders, even when that content is not in any map (possibly due to some kind of bug). Which can be an issue every time the editor (rightfully) decides all the shaders (in the project) need to be recompiled.
If I understand correctly, the engine can be reconfigured to use ODSC instead.

To do it for all projects, I added to the [SystemSettings] section of
C:\Program Files\Epic Games\UE_5.0\Engine\Config\Windows\WindowsEngine.ini:

[SystemSettings]
...
;Activate ODSC for all projects
r.ShaderCompiler.JobCacheDDC=1

Now after creating a new project with starter content, only 150 or so shaders get compiled! \O/
And if I put the JobCacheDDC=0 and reopen that project, sure enough a cr*p-ton of shaders get queued for compilation again.

1 Like

I managed to solve the problem by reinstalling UE5 completely and I also moved the cache folders to another drive just in case, the original drive wasn’t full, nowhere near and I don’t know if that helped but thought I’d mention it.

Also sorry for not replying, kind of lost motivation after that issue but picked it up again recently! Thanks for all the suggestions :slight_smile:

1 Like

Just my 2 Cents…
I also reinstalled the engine coming from 5.0.2 to 5.0.3 now. This worked!

1 Like

I’ll try that. I can’t move constant compiling shaders.