Original GLSL
keijiro/ShaderSketches/Fragment/Circles2.glsl
Last active
March 10, 2018 16:31
-
-
Save yoshimax/8f3edadd359491b2ef342b9aea04a8cc to your computer and use it in GitHub Desktop.
Circles2.glsl
This file contains hidden or 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
#version 150 | |
uniform float time; | |
uniform vec2 resolution; | |
out vec4 fragColor; | |
float circle(vec2 coord, vec2 seed) | |
{ | |
float reso = 16.0; | |
float cw = resolution.x / reso; | |
vec2 p = mod(coord, cw); | |
float d = distance(p, vec2(cw / 2.0)); | |
float rnd = dot(floor(coord / cw), seed); | |
float t = time * 2.0 + fract(sin(rnd)) * 6.2; | |
float l = cw * (sin(t) * 0.25 + 0.25); | |
return clamp(l - d, 0.0, 1.0); | |
} | |
void main() | |
{ | |
vec2 p = gl_FragCoord.xy; | |
vec2 dp = vec2(7.9438, 0.3335) * time; | |
float c1 = circle(p - dp, vec2(323.443, 412.312)); | |
float c2 = circle(p + dp, vec2(878.465, 499.173)); | |
float c = max(0.0, c1 - c2); | |
fragColor = vec4(c, c, c, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment