How to Force Shader recompile of everything like the first time you run the engine?

How can we force UE4 to recompile all shaders like the first time you load a new example?

Bump, Need some feedback from anyone please.

Delete your DerivedDataCache folders.

Edit: Derived Data Cache of the Project - Works. THANKS!

This should work, trying now… What you mention is also confirmed in the Docs:

Shader caching and cooking

*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. *

1 Like

So we go…
Documents>Unreal Projects>Project> ?
Build? Config? Content? Intermediate? Saved?

When I search “DerivedDataCache” specifically, a lot of stuff comes up. I will back up my stuff and experiment. But… For future searchers maybe?

Since I had the same issue, the folder I ended up finding that caused the rebuild was:

I dont see build in that folder for my projects. Do you?

No, I’ll keep looking; I forgot about this issue to be honest. And I think that I found a way to have my Shader recompile within the engine itself… Hmmm! Right now I’m using 4.21 and I believe that the reason I got on this thread anyways was because I had messed with my terrain textures and when I’d begun to edit my terrain, some pieces had shown the grid (default) texture for the engine. So I was missing my grass, dirt, etc.

If that’s the issue you’re having in regards to this as well, I believe that you can simply go to your textures, or maybe the materials, and right-click them to have the shader recompile. I’m having my Content folder resave right now, but when it’s done I will get back to this and see if that’s what I did.

You can simply type “recompileshaders all” in the console and it results in basically the same.