Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#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); = vec3(sqrt(x*x+y*y));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment