2D Ripple Effect

Hello guys!

How can i create a ripple effect in Unity 2D?

I’m developing a match 3 game. It has some power-ups. I want some effect like a ripple when exploding a bomb. I’m not talking about particle systems. Maybe post-processing or something.

Something like this,

Thanks!

I guess you would need to use a shader to create your effect.

1 Like

Thanks for your reply MisterSkitz,

I’ve never touched the shaders. Any guide?

@Yohansandun If you just search for Unity shader tutorials, you get things like this:

That’s a good place to start learning about shaders.

2 Likes

Distortion like this will probably require a post-processing effect to shift pixels on the screen, and without any shader knowledge this will be a challenge to understand. Definitely read up on how shaders work.

I’ll try to describe what’s happening in basic terms:

The shader will use a “grab pass” to access all the pixels on screen.

The fragment function in the shader is what decides what color each pixel will be, it returns an RGBA color value. Each fragment has coordinates and in the case of a sprite, just reads a texture and returns the color at those coordinates to display.

In this case, the shader will be reading the screen pixels, and will offset the coordinates by some amount away from the center of the distortion shape object (by however extreme the distortion is), and use that screen location’s color instead.

Here’s a basic rundown of these concepts:
http://www.psilocybegames.com/captainslog/2017/02/15/heat-wave-shader-effect-tutorial-in-unity-5/

It looks like in your video the ring sprite used for this distortion has some kind of a gradient to it, and the gradient affects how much distortion is applied so there isn’t a harsh edge, and can also be faded out over time.

1 Like

Thank guys!, I’ll dig into shaders. I’ll let you know when i figured it out. Thanks again.

1 Like

Did you figure it out?

3 Likes