When working on Unreal Engine projects, you may encounter an issue where the ShaderCompileWorker process consumes a large amount of CPU resources, causing your system to slow down significantly. This can be particularly frustrating when you need to compile shaders frequently during development. From my own experience with similar issues and after researching solutions on the official Unreal Engine forums, I have compiled several effective steps to address this problem and improve the performance of your Unreal Engine project.
Here is Step-by-Step Solutions to Optimize Shader Compilation Performance in Unreal Engine:
Verify Graphics RHI Configuration
Ensure that the correct Graphics RHI (Rendering Hardware Interface) settings are specified in your project’s configuration file. This can prevent excessive CPU usage during shader compilation.
- Navigate to the
Config/DefaultEngine.ini
file in your project directory. - In the section
[Script/WindowsTargetPlatform.WindowsTargetSettings]
, ensure the following settings are correctly specified: - For Windows:
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
- For Linux/MacOS:
DefaultGraphicsRHI=DefaultGraphicsRHI_Vulkan
Properly setting these parameters ensures that Unreal Engine uses the appropriate graphics API, which can help mitigate high CPU usage during shader compilation and help to avoid ShaderCompileWorker issues.
Clean Up Project-Specific Intermediate Files
If the issue persists in a specific project, try cleaning up intermediate files and recompiling the project:
Delete the following directories within your project folder:
Intermediate
Build
Binaries
DerivedDataCache
After deleting these directories, recompile your project. This process helps in removing any corrupted or outdated cache files that might be causing the high CPU usage.
Global DerivedDataCache Cleanup
If the problem occurs across all projects, consider deleting the global DerivedDataCache folder and recompiling your project:
- The
DerivedDataCache
folder can be located in one of the following paths:C:\Users\YourUserName\AppData\Local\UnrealEngine\Common\DerivedDataCache
%PathToUnrealEngineFolder%\UE_5.4\Engine\DerivedDataCache
Deleting this folder forces Unreal Engine to regenerate shader cache, which can resolve issues related to excessive CPU usage.
Automating DerivedDataCache Cleanup
To streamline the cleanup process, you can use a script to automate the deletion of the DerivedDataCache folder. Below is a sample Python script that can help you automate this process.
Remember to replace the path to your Unreal Engine installation folder in the script:
1 | import os |
By following these steps, you can effectively manage and resolve the high CPU usage issue caused by ShaderCompileWorker in Unreal Engine, ensuring smoother and more efficient development.
Useful links: