Shader Compiler
Pre-compile material, Niagara and PSO shaders in game to remove shader compilation stutter.
Unreal Engine can hitch while shaders are compiled the first time a material or Niagara system is rendered. The plugin gives you two tools:
ABP_ShadersCompilerloads every material and Niagara system of the project ahead of time, e.g. in a loading screen or main menu.- PSO precompilation nodes report and speed up the compilation of the bundled PSO cache and PSO precaching in packaged games.
ABP_ShadersCompiler
Drag and drop ABP_ShadersCompiler into your menu level.
Get a reference to the actor and call its Start function.
Bind to On Shader Compiled to update a progress bar and to On Finish to continue to the game.
Avoid compiling shaders in the editor: it also compiles the engine's built-in materials and can greatly increase RAM usage. Test it in a packaged build.
Variables
Use these variables to display progress, e.g. Materials Count / Materials Length.
| Pin | Type | Description |
|---|---|---|
| Materials CountOutput | Integer | Number of materials whose shaders have been compiled. |
| Materials LengthOutput | Integer | Total number of materials to compile. |
| Niagara CountOutput | Integer | Number of Niagara systems compiled. |
| Niagara LengthOutput | Integer | Total number of Niagara systems to compile. |
| Shaders CountOutput | Integer | Number of shaders compiled so far (materials + Niagara). |
| Shaders LengthOutput | Integer | Total number of shaders to compile. |
Start
Starts the shader compilation.
Stop
Stops the shader compilation.
On Started
Called when the compilation starts.
On Shader Compiled
Called every time a shader has been compiled.
| Pin | Type | Description |
|---|---|---|
| Shaders CompiledOutput | Integer | Number of shaders compiled so far. |
On Finish
Called when every shader has been compiled.
PSO precompilation & shader nodes
Get Shader Precompile Progress
SubsystemPSOs still compiling (bundled PSO cache + PSO precaching). Works in packaged games.
FEUSShaderPrecompileProgressStruct| Field | Type | Default | Description |
|---|---|---|---|
| Remaining | int | 0 | PSOs still to compile (bundled PSO cache + PSO precaching). |
| In Progress | bool | false | — |
Set Shader Precompile Mode
SubsystemFast/Precompile while a loading or "preparing shaders" screen is visible, Background while playing.
EEUSShaderPrecompileModeEnum| Value | Description |
|---|---|
| Background | Small batches: compiles while playing with minimal hitches. |
| Fast | Larger batches: use while a loading screen is shown. |
| Precompile | Everything as fast as possible: use behind a "preparing shaders" screen. |
Get All Materials
Every material asset in the project (asset registry), e.g. to warm up shaders on a loading screen.
Get All Niagara Systems
Every Niagara system asset in the project (asset registry).
Are Shaders Compiling
Shaders (editor) or PSOs (packaged game: bundled PSO cache + PSO precaching) are still compiling.
On Shaders Ready
SubsystemEvent dispatcher of the subsystem, fired once all pending PSO compilation finished (after some was pending). Bind to it from your loading screen and switch to Set Shader Precompile Mode Background when it fires.