Using Engine 4.11, I’ve got a C++ plugin using custom shaders ( modified version of UE4ShaderPluginDemo from Github ) and if I modify one of its shaders in engine\shaders and reload the project, it gets stuck at 95% for almost 3 minutes, then loads and my shader changes work. These are simple shaders and shouldn’t take that long. If I make another change to the shader and hit Ctrl+Shift+Period(.) the shader compiles almost instantly and my changes take effect. If I then reload the project it doesn’t get stuck on 95% and loads quick.
Can anyone explain why it’s taking so long to load, I’ve seen this 95% hitch before, but in this simple case, it’s kind of killing iteration as when we make changes to our plugin and shader, we have to reload the project which is taking forever. Almost like the shader compiler is fighting with the project loader or something if done in different threads.
-Enable the “ShaderDevelopmentMode” option in “Engine\Config\ConsoleVariables.ini” to enable the “Ctrl+Shift+.” feature.
-Restart Unreal editor.
-Download UE4ShaderPluginDemo ( GitHub - Temaran/UE4ShaderPluginDemo: A tutorial project that shows how to implement HLSL Pixel and Co )
-Load the project ( the shaders in “<project>\shaders” will be copied to “engine\shaders” everytime on load )
-Open both PixelShaderExample.usf files found in “engine\shaders” and “<project>\shaders” )
-Add the line “OutColor = float4( 1, 0, 0, 1 );” at the end of the shader to both “PixelShaderExample.usf files”.
-Reload the project, should get stuck on 95% for 2-3 minutes ( ouch )
-Hit Play, then fire the gun at one of the cubes, it should turn red
-Now change that last line we added to “OutColor = float4( 0, 1, 0, 1 );” then select anywhere in the viewport and hit Ctrl+Shift+Period(.), it should recompile the shader in 1 second ( yay )
-Hit play again, fire at a box and it should turn green.
-Now that our shader compiled quick, reload the project and notice it loads nice and quick and doesn’t get stuck on 95% and our shader is still working.