Sometimes you need more advanced functionality to achieve a desired look, and a custom shader pass might help you.
Art by Michael Gerard
UE4 reads .usf files (Unreal Shader Files) from the Engine/Shaders folder. Any new shaders need their source files placed here. As of 4.17, shaders can also be read from a plugin (Plugin/Shaders). You should enable r.ShaderDevelopmentMode=1 in your ConsoleVariables.ini file for ease of development. Check out the documentation for more information.
Start by adding a new .usf file in your Engine/Shaders folder and calling it MyTest.usf. Then add a simple pass-through Vertex Shader and a Pixel Shader that returns a custom color:
// MyTest.usf // Simple pass-through vertex shader void MainVS( in float4 InPosition : ATTRIBUTE0, out float4 Output : SV_POSITION ) { Output = InPosition; } // Simple solid color pixel shader float4 MyColor; float4 MainPS() : SV_Target0 { return MyColor; }
Now, in order to get UE4 to pick up the shader and start compiling it, you need to declare a C++ class. Start with the Vertex Shader: