Download

Why do I need thousands of shaders?

Hi,

I’m not sure why I only thought of this now – after two years working with UE4 – but why do we need to compile thousands of shaders? When I mess with a material, it recompiles the shader so it’s obviously on-demand. So why is it necessary to build so many up front? There’s no way my game uses so many.

Thanks for any info,
Jin

The Editor uses several shader files and apparently when you create new materials the Editor will also generate several shader files for previews on the viewport…
It dumps the old copy of the shader you are editing with material editor then loads a new one; but *apparently *the old generated files are kept and are always recompiled too instead of deleted…
The editor also ships with several hundred megabytes of default 3d assets so the Editor also generates several shaders for those assets as well.

There must be something breaks if any shader is deleted while Editor is running so maybe graphics developers of engine just decided to leave it the way it is.
I don’t know the universe of graphics programming so I have no idea why this engine in particular is this way.