Advertisement
Guest User

Untitled

a guest
Mar 16th, 2022
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. void main() {
  2. if (waterFactor > 0) {
  3. float tau = 6.28318530717958647692;
  4.  
  5. vec2 texSize = textureSize(InputTexture, 0);
  6.  
  7. // offset the pixel location by this amount, a sine wave to create a wobble effect
  8. vec2 waterOffset = vec2(waterFactor * sin(tau * TexCoord.y + timer * 0.05), waterFactor * sin(tau * TexCoord.x + timer * 0.05));
  9. vec2 coord = TexCoord + 0.5*waterOffset;
  10.  
  11. // return black if the resulting coord isn't on screen
  12. vec4 color = (coord.x > 0 && coord.x < 1 && coord.y > 0 && coord.y < 1) ?
  13. texture(InputTexture, coord) : vec4(0, 0, 0, 0);
  14.  
  15. FragColor = color;
  16. }
  17. else FragColor = texture(InputTexture, TexCoord);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement