Created
August 31, 2020 18:27
-
-
Save andybak/f05cafe1da03a8d334462f2fa63825f4 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
// https://www.shadertoy.com/view/lldyRB | |
#define samples 8.0 | |
#define PI 10.159265359 | |
#define offset 3.0 | |
#define strength -6.5 | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
// Normalized pixel coordinates (from 0 to 1) | |
vec2 uv = fragCoord/iResolution.xy; | |
vec2 accumxy = vec2(0.,0.); | |
for( float i=0.0;i<samples;i++){ | |
vec2 tc = vec2(sin(PI*2.*i/samples),cos(PI*2.*i/samples)); | |
float energy = dot(texture(iChannel0,(fragCoord+tc*offset)/iResolution.xy),vec4(0.333,0.333,0.333,0.)); | |
energy += dot(texture(iChannel0,(fragCoord+tc*2.*offset)/iResolution.xy),vec4(0.333,0.333,0.333,0.)); | |
accumxy += tc*energy/2.; | |
} | |
// Output to screen | |
fragColor = texture(iChannel0,uv+accumxy*strength/iResolution.xy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment