runnable fragment

SHKWater

shaderkit material glsl runnable fragment MIT
code snippet
precision mediump float;
uniform float u_time;
uniform sampler2D u_texture;
varying vec2 v_tex_coord;
varying vec4 v_color_mix;
//
// Warps a textured node to create a water rippling effect.
// NOTE: This must be applied to something that has a texture.
// Uniform: u_speed, how many fast to make the water ripple. Ranges from 0.5 to 10 work best; try starting with 3.
// Uniform: u_strength, how pronounced the rippling effect should be. Ranges from 1 to 5 work best; try starting with 3.
// Uniform: u_frequency, how often ripples should be created. Ranges from 5 to 25 work best; try starting with 10.
//
// This works by using a nearby pixel color rather than the original pixel color. Which neighbour is
// chosen depends on the algorithm: we pass the original coordinate, speed, and frequency