Created
May 20, 2018 07:36
-
-
Save akella/05fc2012b43761c5d7420a2ec167bea9 to your computer and use it in GitHub Desktop.
shaders.49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform float time; | |
uniform float progress; | |
uniform sampler2D texture1; | |
uniform sampler2D texture2; | |
uniform vec2 pixels; | |
uniform vec2 uvRate1; | |
uniform vec2 accel; | |
uniform vec2 mouse; | |
varying vec2 vUv; | |
varying vec2 vUv1; | |
varying vec4 vPosition; | |
vec2 mirrored(vec2 v) { | |
vec2 m = mod(v,2.); | |
return mix(m,2.0 - m, step(1.0 ,m)); | |
} | |
float tri(float p) { | |
return mix(p,1.0 - p, step(0.5 ,p))*2.; | |
} | |
void main() { | |
vec2 uv = gl_FragCoord.xy/pixels.xy; | |
// vec2 mouse = vec2(0.3,0.3); | |
float velocity = 1.; | |
float dist = distance(vec2(mouse.x,((1.-mouse.y) - 0.5)*uvRate1.y + 0.5), vUv1); | |
vec2 uv1 = vUv1; | |
uv1.y += sin(uv1.y * 5.005 + time * 0.8) * 0.0022; | |
uv1.x += sin(uv1.x * 10.005 + time * 0.6) * 0.0032; | |
uv1.x =(uv1.x - 0.5)*0.3 + 0.5; | |
if(dist < 0.1){ | |
// rgba1 = vec4(1.,0.,0.,1.); | |
float absDist = 0.1 - dist; | |
float time1 = time * 3.3; | |
float time2 = time * 1.8; | |
uv1.x += sin(gl_FragCoord.y * 0.04 + time2) * 0.005 * absDist * velocity; | |
uv1.x += sin(gl_FragCoord.y * 0.036 + (time1 * 1.5)) * 0.003 * absDist * velocity; | |
uv1.y += sin(gl_FragCoord.x * 0.06 + time1) * 0.006 * absDist * velocity; | |
uv1.y += sin(gl_FragCoord.x * 0.046 + (time1 * 2.)) * 0.004 * absDist * velocity; | |
} | |
gl_FragColor = vec4(vUv1.y,0.,0.,1.); | |
vec4 rgba1 = texture2D(texture1,mirrored(uv1)); | |
if(dist < 0.1){rgba1 *= 1.2;}; | |
gl_FragColor = vec4(1.- dist); | |
gl_FragColor = rgba1; | |
// gl_FragColor = vec4(tri(progress)); | |
// gl_FragColor = vec4(delayValue); | |
// gl_FragColor = vec4(delayValue); | |
// gl_FragColor = vec4(uv,1.,1.); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment