The objective of this shader is to distort the camera screen when an enemy is close to you or facing directly to your forward view direction, getting more distortion when the action time is increasing. With it, we simulate the remaining life points you have, getting a fully dark screen when you are dead.
It is designed in Unity, as an image effect shader. It’s written in HLSL language, modifying the fragment function.
To develop this shader, we use different inputs:
private void OnRenderImage(RenderTexture source, RenderTexture destination) {
Graphics.Blit(source, destination, material);
}
You can find the code here: Distortion Shader