-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedgeDetect.glsl
More file actions
31 lines (29 loc) · 810 Bytes
/
edgeDetect.glsl
File metadata and controls
31 lines (29 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define PROCESSING_COLOR_SHADER
uniform float time
uniform vec2 resolution
uniform sampler2D v;
uniform float treshold;
void main() {
vec2 UV = gl_FragCoord.xy / resolution.xy;
vec4 c = (9.0)*(texture2D(v, UV));
float i = 1.0;
float j = 1.0;
float offsetX = (1.0)/(resolution.x);
float offsetY = (1.0)/(resolution.y);
while((i)<=(3.0)) {
while((j)<=(3.0)) {
c = (c)-(texture2D(v, vec2(((offsetX)*(i))+(UV.x), ((offsetY)*(j))+(UV.y))));
j = (j)+(1.0);
}
i = (i)+(1.0);
}
if(((((c.x)*(c.x))+((c.y)*(c.y)))+((c.z)*(c.z)))<(treshold)) {
glFragColor = vec4(1.0, 1.0, 1.0, 1.0)
} else {
glFragColor = vec4(0.0, 0.0, 0.0, 1.0)
}
}