Created
February 19, 2019 06:11
-
-
Save native-m/36f862bf4fd63b9391cd4ab6adf0764d to your computer and use it in GitHub Desktop.
another glitch
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
| float rand(vec2 c) | |
| { | |
| return fract(sin(dot(c.xy ,vec2(12.9898,78.233))) * 43758.5453); | |
| } | |
| void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
| { | |
| vec2 uv = fragCoord/iResolution.xy; | |
| float t = floor(iTime * 60.0) / 60.0; | |
| fragColor = vec4(rand(sin(uv) + t)); | |
| } |
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
| void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
| { | |
| // Normalized pixel coordinates (from 0 to 1) | |
| vec2 uv = fragCoord/iResolution.xy; | |
| vec2 uvNoise = uv; | |
| uvNoise.x *= 0.1; | |
| uvNoise.y *= 0.7; | |
| uvNoise *= 0.2; | |
| uv.x -= 0.05 * pow(sin(3. * uv.y + iTime * 0.5), 2000.); | |
| vec4 nsScale = texture(iChannel0, uvNoise); | |
| nsScale = smoothstep(0.4, 1.0, nsScale); | |
| nsScale.x *= 0.5; | |
| vec4 ns = texture(iChannel0, uvNoise + nsScale.xy); | |
| ns = smoothstep(0.99, 1.0, ns); | |
| // Time varying pixel color | |
| vec4 col = ns; | |
| col.r += texture(iChannel1, vec2(uv.x + 0.1 * ns.x, uv.y)).r; | |
| col.g += texture(iChannel1, vec2(uv.x + 0.1 * -ns.x + 0.004, uv.y)).g; | |
| col.b += texture(iChannel1, vec2(uv.x + 0.1 * ns.x - 0.004, uv.y)).b; | |
| // Output to screen | |
| fragColor = vec4(col); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment