-
-
Save eiginn/884608fdda162fa6545fa97b998863ab to your computer and use it in GitHub Desktop.
KodeLife fragment shader sketch
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
#version 150 | |
uniform float time; | |
uniform vec2 resolution; | |
out vec4 fragColor; | |
const float PI = 3.14159265359; | |
float rand(float x, float y) | |
{ | |
return fract(sin(dot(vec2(x, y), vec2(12.9898, 78.233))) * 43758.5453); | |
} | |
void main(void) | |
{ | |
vec2 p = gl_FragCoord.xy / resolution * 2 - 1; | |
p.x *= resolution.x / resolution.y; | |
p = vec2(atan(p.y, p.x) / PI / 2 + 0.5, length(p)); | |
p.y = p.y * 4 - time * 2; | |
float r = floor(p.y); | |
p.x *= ceil(8 * rand(r, 0.1)); | |
p.x += time * mix(-2, 2, rand(r, 0.2)); | |
fragColor = vec4(step(0.5, fract(p.y)) * step(0.3, fract(p.x))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment