Created
May 16, 2018 19:49
-
-
Save lhog/b19b37ed931a973d8fa4e79fc8bfdfdc to your computer and use it in GitHub Desktop.
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
//https://www.shadertoy.com/view/4scBDS | |
#define sum3(v) (v[0]+v[1]+v[2]) | |
#define sqr(n) (n*n) | |
#define L(x, y) sqrt(sum3(sqr(vec3(texture(iChannel0, (U+vec2(x,y))/iResolution.xy).rgb)*vec3(.299, .587, .114)))) | |
void mainImage( out vec4 O, in vec2 U ) { | |
vec3 a = vec3(-1, -2, -1), b = vec3(1, 2, 1); | |
float x = dot(vec3(L(-1,-1), L(-1,0), L(-1,1)), a) | |
+dot(vec3(L(1,-1), L(1,0), L(1,1)), b), | |
y = dot(vec3(L(-1,-1), L(0,-1), L(1,-1)), a) | |
+dot(vec3(L(-1,1), L(0,1), L(1,1)), b); | |
O.xyz = vec3(sqrt(x*x+y*y)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment