I would like to implement the following running effect in Unity. When the player character moves, it creates some sort of rings around it to give the impression of high speed.
I have searched for shockwave effects, ripple effects, water-drop effects but I either (1) could not get them to work on a specific region of the screen (most were post-processing effects that work on the whole screen), or (2) they did not look like this one.
I then tried to reverse-engineer this effect -- visually that is. I grabbed a screenshot of the player movement and it shows the following.
So basically I noticed a ring around the player where the terrain image is distorted. I have constrained that ring within the red ring to show it better. I have also added the red box to bring your attention to the image distortion I am talking about.
So my naïve interpretation of this effect is that it creates few rings of increasing size around the player, and it shows them one by one over time.
This kind of reduces my problem to creating one ring that blurs the terrain image like shown in the screenshot: some sort of elongated blurred pixels.
Now, I know next to nothing about shaders. I found this page (How to apply Image effect only on specific part of objects?) that implements a pixelating shader that can be applied to an object. So I used it as a starting point. I now have this ring:
and I need help changing the following shader function (taken from the previous link) to show the kind of distortion I want.
float4 frag(v2f IN) : COLOR
{
float2 steppedUV = IN.grabPos.xy / IN.grabPos.w;
steppedUV /= _PixelSize / _ScreenParams.xy;
steppedUV = round(steppedUV);
steppedUV *= _PixelSize / _ScreenParams.xy;
//Sampling GrabTexture according to screen capture positon, tex2DProj is equivalent to tex2D (grabPos.xy / grabpos.w)
return tex2D(_GrabTexture, steppedUV);
}
Any help is very much appreciated.