Created
March 14, 2013 16:49
-
-
Save joelpryde/5162955 to your computer and use it in GitHub Desktop.
GLSL ambient wash
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
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform float time; | |
uniform vec2 mouse; | |
uniform vec2 resolution; | |
#define N 12 | |
void main( void ) { | |
vec2 v = (gl_FragCoord.xy - resolution/2.0) / min(resolution.y,resolution.x) * 20.0; | |
float x = v.x; | |
float y = v.y; | |
float t = time * 0.4; | |
float r; | |
for ( int i = 0; i < N; i++ ){ | |
float d = 3.14159265 / float(N) * float(i) * 5.0; | |
r = length(vec2(x,y)) + 0.01; | |
float xx = x; | |
x = x + cos(y +cos(r) + d) + cos(t); | |
y = y - sin(xx+cos(r) + d) + sin(t); | |
} | |
gl_FragColor = vec4( cos(r*mouse.x), cos(r*mouse.y), cos(r*mouse.x/mouse.y), 1.0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment