Created
October 17, 2021 02:25
-
-
Save patrixr/cccc83d4cc85ac1d93b520875669228e to your computer and use it in GitHub Desktop.
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 ) | |
{ | |
// Time varying pixel color | |
vec3 lightColor = vec3( | |
clamp(mod(float(iFrame + 50), 100.0) / 100.0, 0.0, 1.0), | |
clamp(mod(float(iFrame + 100), 100.0) / 100.0, 0.0, 1.0), | |
clamp(mod(float(iFrame), 100.0) / 100.0, 0.0, 1.0) | |
); | |
vec3 pixelColor = vec3(0.0, 1.0, 1.0); | |
vec2 toLight = vec2(iMouse.x - fragCoord.x, iMouse.y - fragCoord.y); | |
float lightradius = 150.0; | |
float brightness = 1.0; | |
// Apply distance to brightness | |
brightness *= clamp(1.0 - (length(toLight) / lightradius), 0.0, 1.0); | |
vec3 finalcolor = pixelColor.rgb * lightColor * brightness; | |
// Output to screen | |
fragColor = vec4(finalcolor, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment