Is their an easy way to force an entire folder or the editor to compile all shaders? I want to do some Level Design work (With the Infinity Icelands pack) but, I’m spending way to much of my time waiting on the Editor slowly compiling shaders every time I want to look at a Mesh.
(1) How can I force UE4 to compile all shaders at once, so I can wait for X time for to it ALL to compile, so I can just worry about my Art.
Once shaders are compiled, they are stored in the Derived Data Cache. They contain, in their key, a hash of all the inputs to the compile, including shader source files. That means that changes to shader source files are automatically picked up every time you re-launch the engine or do a ‘recompileshaders changed’.
When you are modifying FShader Serialize functions, there is no need to handle backward compatibility, just add a space to a shader file that is included by that shader.
When cooking assets, material shaders are inlined into the material’s package, and global shaders are stored seperately in a global shader file which allows them to be loaded early in the engine startup.
The only “DerivedDataCache” folder I can find is in my… HDD > Users > Shared > Epic Games > UE_4.15 > Engine
Deleting that did force UE4 to compile “some” shaders, but not the ones I wanted in my Infinity Icelands pack, as the Static Meshes still need their shaders compiled.
Going to my project folder… HDD > Users > MyUserName > Documents > Unreal Projects > LevelDesign_01
Shows no “DerivedDataCache”…
Looking on google for where the heck this folder is located is also very vague. Am I deleting the correct folder?
“You can fill your DDCs at any time by running the following command:
UE4\Engine\Binaries\Win64\UE4Editor.exe ProjectName -run=DerivedDataCache -fill
Epic Games does this on a nightly basis to ensure that the DDC is always primed”
That is not merely shaders though but all derived data, regardless a ‘primed’ DDC should ensure that editor load times are unhindered.
I know this is old but just in case you want to do what OP asked: just use content browser in UE4, go to the folder, select all meshes and press right click. Wait for it to finish and the shaders will be compiled. This is the same as dragging all of them to the scene, as cyaoeu said, but I guess easier so you don’t have to delete them later (and easier if you have dynamic lightning and such)
This is great. I also used the filters to select all "Material"s, and it compiled a few other shaders. Probably ones used by particles systems and other things not related to meshes.
Ho yeah, right on my friend. All fixed now! I can’t believe I did not think about that haha. So use to open the demo map for project that I forget about this.
Not sure what works or doesn’t anymore. The rebuild of DDC didn’t help me with rebuilding shaders for running in a “standalone game”, and that cache doesn’t seem to stay after you close the window. What worked for me was filtering at the “All” folder level for “material”, then selecting all materials, right clicking on them and selecting save. It builds shaders for each one as it saves them.
I also tried: r.ShaderCompiler.JobCacheDDC=1
I thought it worked once, but then I was right back to 12k shaders compiling, so not sure what happened. But the right click and save thing seems to be working so far.