Created
October 17, 2021 02:25
Revisions
-
patrixr created this gist
Oct 17, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ 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); }