I tried to implement what teodron suggested:
vec2 uv = gl_FragCoord.xy / resolution.xy;
float sepoffset = 0.005*cos(iGlobalTime*3.0);
if (uv.y > 0.3 + sepoffset)// is air - no reflection or effect
gl_FragColor = texture2D(texture, vec2(uv.x, -uv.y));
// Compute the mirror effect.
float xoffset = 0.005*cos(iGlobalTime*3.0+200.0*uv.y);
//float yoffset = 0.05*(1.0+cos(iGlobalTime*3.0+50.0*uv.y));
float yoffset = ((0.3 - uv.y)/0.3) * 0.05*(1.0+cos(iGlobalTime*3.0+50.0*uv.y));
vec4 color = texture2D(texture, vec2(uv.x+xoffset , -1.0*(0.6 - uv.y+ yoffset)));
//vec4 finalColor = vec4(mix(color.rgb, overlayColor, 0.25), 1.0);
gl_FragColor = color;
It looks pretty close (it's hard to tell without the base image) but you can tweak the parameters.
You may see it in action there: https://www.shadertoy.com/view/Xll3R7
- I had to invert the y coordinate since I was getting the image upside down, but it may depend of what you pass into resolution.xy; if the result is inverted for you, just uninvert uv.y
- I changed your uniform declarations so it works with shadertoy. You can ignore those changes.
- You will need however to add a uniform providing the time and use it in place of iGlobalTime (which is the time in seconds)
- I added a tide effect since it looks like there is one on your example but it's hard to tell (see sepoffset variable). You may remove it if you don't like it
- I removed the overlay color since it was not looking good, and your example didn't had one
- To tweak the effect to your taste:
- change the factor of iGlobalTime to speedup/slowdown the effect (you can change each of them separately if you want, let's say accelerate the x movement and slow down the y movement)
- change the cos() factor to amplify/attenuate the effect
EDIT: I changed the yoffset to include the modification from @cepro