I am working on unity and trying to make a fish tank water distortion Shader effect with the following requirement:

1.its a 2D top down prospective.

2.every object under/in the fish tank has to be distorted, game objects might pass trough/under the fish tank (distortion) and game object might pass over the fish tank (no distortion) as well.

3.the fish tank does not follow the main camera.

I try to search online and most of the solution I get is to apply the shader to an object or to the main camera which will not meet requirement 3 or 2, can someone give me an ideal on what is the best way to deal with this ? I am working on a mobile game so the solution has to be light weighted on processing power. Many thanks !


2 Answers 2


I think I did something similar to what you are looking for few month ago.

I open-sourced the whole thing on GitHub and tried to keep it simple (script / prefab / shader).

GIF result

How it works

1/ A shader for the water surface

It's a rather simple transparent bumped colored shader

  • with a GrabPass, so it can display everything that has been drawn before
  • with a bump mapping texture

Bump mapping water surface

  • a Color to apply to the grabbed texture
  • an additional sinusoïdal deformation with the magnitude parameter

So it’s basically just a simple transparent shader that applies a color and a bump texture.

Note: I'm not really skilled in writing shaders so this I cannot guaranteed it will be working on every platforms.

2/ A simple trick

The reflection is just a simple trick. For every object we want to reflect in the water, we create a new mirroded sprite!

Before the trick

With the trick

Note: I'm not using the right sprite in this picture for the boat reflact but it's just a SpriteRenderer, it could be easily changed.

Note 2: the reflect creation can be automated with a script. That's what I did in my package.


  • 1
    \$\begingroup\$ At least explain what you did in that \$\endgroup\$
    – Bálint
    Mar 16, 2017 at 20:59
  • \$\begingroup\$ Sure, I just did, feel free to tell me if this is more appropriate. :) \$\endgroup\$
    – Valryon
    Mar 17, 2017 at 6:55
  • \$\begingroup\$ Thanks, however the situation i am dealing with is something like a car pass under a fish tank (the fish tank is transparent) so only part of the car which is under the fish tank needs to be distorted ... \$\endgroup\$ Mar 17, 2017 at 8:53
  • \$\begingroup\$ @user1998844 I think your best bet is this shader. Just split the car into two separate sprites that are under the same gameobject. One sprite will stay under the water the other will stay over it. Remember, there's no depth to a 2D object. \$\endgroup\$ Mar 17, 2017 at 9:37

Why don't you use two cameras?

One render the the fishtank and whatever will pass under and the other render everything else that shouldn't have distortion.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .