Unreal Engine 5 – Sharpening Post Process Effect
Setting up the Material Domain
First, we create a basic material, open and select our shader and set ‘Material Domain’ to ‘Post Process’.
Screen Shifting
For the start, we need to create 4 Vector2 nodes. These Vector2 nodes will contain the values (0 and 0.001), (0 and -0.001), (-0.001 and 0), (0.001 and 0). Now we are using the Add node to add a TextureCoordinate Node (UTiling = 1 / VTiling = 1) to every Vector2 node. Now the end result of our Add nodes goes into a separate SceneTexture node which is set to PostProcessInput0. In addition to, we’re creating another SceneTexture node (PostProcessInput0), where we put only the TextureCoordinate Node as an input.
(Quick Tipp: The Vector2 node values that we have are affecting the shifting of our SceneTexture UV. So when we increase the value, it will also increase the area of the “sharpen” which we are getting later after the Subtract node in the next step.)
Combining the SceneTextures
For our next step, we need to combine the first 4 SceneTexture nodes which have our Vector2 nodes as input. So we’re using the Add node to combine the first SceneTexture node with the second SceneTexture node and the third SceneTexture node with the fourth SceneTexture node. From there, we are using our Add node again to add our Add nodes together. Combining the 4 SceneTexture nodes together, we now need to divide it by 4. Now we just need to subtract our end result with the SceneTexture node with the TextureCoordinate Node as the input.
The end result gives us “mask” which will show the area where our sharpen effect will happen.
Exposing Parameter and Finalizing
To increase the strength on our sharpen, we need to multiply our “subtract output” with a scalar parameter (It’s useful to expose parameters to change them later with a material instance in real time). Before we finish, we need to put a desaturation node after our multiply node to make sure no colors are bleeding in when we go overboard with the strength value. Now, to complete the tutorial, we need to take the output of our Desaturation node and use an Add node with our SceneTexture node with the TextureCoordinate Node as the input. For the last step we need to connect our Add output in our Emissive Color slot of our Shader and we’re done.