Skip to content

Instantly share code, notes, and snippets.

@not-fl3
Created October 1, 2020 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save not-fl3/066dfb1e63d3c28d1b5519854d59afe8 to your computer and use it in GitHub Desktop.
Save not-fl3/066dfb1e63d3c28d1b5519854d59afe8 to your computer and use it in GitHub Desktop.
FRAGMENT_SHADER
precision lowp float;
varying vec2 uv;
varying vec2 uv1;
uniform vec4 _Time;
uniform sampler2D Texture;
uniform sampler2D _ScreenTexture;
#define amp 0.02
void main() {
vec2 p = uv;
vec2 h = uv1 * 0.02;
float time = _Time.x;
h.x += sin(h.y * 15. + time * 2.) / 30.;
h.y += cos(h.x * 10. + time * 2.) / 30.;
p.x += sin((h.y + h.x) * 15. + time * 2.) / (400. + (10. * sin(time)));
p.y += cos((h.y + h.x) * 15. + time * 2.) / (400. + (10. * sin(time)));
vec3 res = texture2D(_ScreenTexture, p).rgb * vec3(0.8, 0.8, 0.9) + vec3(0.0, 0.0, 0.04 * sin(h.y * 15. + time * 2.)) * cos(h.x * 10. + time * 2.);
gl_FragColor = vec4(res, 1.0);
}
VERTEX_SHADER
attribute vec3 position;
attribute vec2 texcoord;
varying lowp vec4 color;
varying lowp vec2 uv;
varying lowp vec2 uv1;
uniform mat4 Model;
uniform mat4 Projection;
void main() {
vec4 res = Projection * Model * vec4(position, 1);
uv = res.xy / 2.0 + vec2(0.5, 0.5);
uv1 = position.xy;
gl_Position = res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment