// At least... this is my interpretation of it. vec4 sobel() { vec4 top = texture(tex, vec2(tex_coord.x, tex_coord.y + inv_height)); vec4 bottom = texture(tex, vec2(tex_coord.x, tex_coord.y - inv_height)); vec4 left = texture(tex, vec2(tex_coord.x - inv_width, tex_coord.y)); vec4 right = texture(tex, vec2(tex_coord.x + inv_width, tex_coord.y)); vec4 tl = texture(tex, vec2(tex_coord.x - inv_width, tex_coord.y + inv_height)); vec4 tr = texture(tex, vec2(tex_coord.x + inv_width, tex_coord.y + inv_height)); vec4 bl = texture(tex, vec2(tex_coord.x - inv_width, tex_coord.y - inv_height)); vec4 br = texture(tex, vec2(tex_coord.x + inv_width, tex_coord.y - inv_height)); vec4 sx = -tl - 2 * left - bl + tr + 2 * right + br; vec4 sy = -tl - 2 * top - tr + bl + 2 * bottom + br; vec4 returnCol = sqrt(sx * sx + sy * sy); returnCol.w = 1.0; return returnCol; }
0 Comments
Leave a Reply. |
AuthorHi there, the name's Matthew Jenkinson and I'm currently working at Firesprite. In my spare time I work on programming projects like you see here. Archives
March 2021
CategoriesLinks to each effect in order:
|