Freeze when saving Material being compiled

When saving a Material that was recently edited and not compiled for preview/apply yet, the editor may freeze for an unspecified amount of time while it is trying to catch up with compiling shaders. This is probably unintended as killing the engine using the task manager results in the material being saved but not compiled and no progress was made compiling other shaders.

In my project, which when opened on a different computer, that results in a freeze of over 2.5 hours as it tends to compile over 14000 shaders - even though we only have 283 materials total. (How do you get 14000 shaders from 283 materials? We need some sort of statistics display for that on the material as to how many shaders it will create…)

Reproduction Steps:

  • Create a new blank project, include Starter Content (on 4.11)
  • Create a new material, put some logic inside it that makes it do whatever.
  • Close the Editor, open 4.12, convert in place
  • Open the created material, modify the graph, save
  • Editor freezes until the material was compiled.

Hello Xaymar,

This is not a bug, but expected that your computer is going to run a bit slower when shaders are compiling. If you are opening a copied project or converted project for the first time, then you will generally want to wait for your shaders to compile as your machine is utilizing a good bit of processing power to compute the shaders. The 283 materials and 14,000 shaders sounds about the right number. Shader compile times depend on the complexity of your materials and your machine.

Within each material you can toggle the statistics to view the instruction count for static and dynamic lighting, vertex shader, and texture samplers. You can also use the Shader Complexity visualizer within the viewport toolbar to observe the complexity of your materials placed in the scene. I assisted a user not long ago who had a question about optimizing his shaders.

If you have further questions or need additional assistance, please let me know.

Thank you,

Hey Andrew,

I think you missed what I said in the Report. The Editor actually freezes and no work is being done. (Only UE4Editor.exe is using CPU, ShaderCompileWorker is nowhere to be found.) If this is intended however, then consider this report invalid.

Sincerely,

Xaymar

I just tried to run the test again, on an even lower spec machine than the original one I tested, and did not get the freezing/unresponsiveness you are reporting.

Could you provide me with your ‘dxdiag’?

Thanks,

Here is my DxDiag: http://pastebin.com/raw/2jLrB0he

While it shows that I have two GPUs for some reason, I only have one R9 285 card using Driver version 16.6.1.
Hope it helps tracking down where things go wrong.

There are known and reported issues with these series cards while working in the editor. One in specific causes a silent crash on the 285/290 and 385/390 AMD series cards. For reference the bug mentioned is UE-21389.

Would you mind doing me a favor and the next time this issue occurs, bring up the task manager, and check to see if there are any UnrealSub processes running?

Thanks,