Created
June 12, 2023 18:51
-
-
Save antoinefortin/0edc429bb65dcdcde0589284b3f1d0e0 to your computer and use it in GitHub Desktop.
From my Medium article
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
#define size 25. | |
vec2 Hash12(float t) | |
{ | |
float x = fract(sin(t * 674.3) * 453.2); | |
float y = fract(sin(t * 2674.3) * 453.2); | |
return vec2(x,y); | |
} | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = (fragCoord-.5 * iResolution.xy)/iResolution.y; | |
vec3 col = vec3(0.0); | |
vec3 debug = vec3(Hash12(uv.y).x); | |
for(float i = 0.; i < size; i++) | |
{ | |
vec2 dir= Hash12(i * Hash12(uv.x).x + sin(Hash12(uv.y).x)) - .5; | |
float t = fract(iTime * .05); | |
float d = length(uv-dir * (t + uv.x * t * uv.y)); | |
float brightness = 0.002; | |
col += vec3(brightness / d); | |
} | |
fragColor = vec4(vec3(1.0, 1.0, 1.0)- col,1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment