vec4 luma() { vec4 up2 = texture(tex, tex_coord + vec2(0.0, -oneTexel.y) * 2.0); vec4 dow2 = texture(tex, tex_coord + vec2(oneTexel.x, 0.0) * 2.0); vec4 lef2 = texture(tex, tex_coord + vec2(-oneTexel.x, 0.0) * 2.0); vec4 rig2 = texture(tex, tex_coord + vec2(0.0, oneTexel.y) * 2.0); vec4 ul = texture(tex, tex_coord + vec2(-oneTexel.x, -oneTexel.y)); vec4 ur = texture(tex, tex_coord + vec2(oneTexel.x, -oneTexel.y)); vec4 bl0 = texture(tex, tex_coord + vec2(-oneTexel.x, oneTexel.y)); vec4 br0 = texture(tex, tex_coord + vec2(oneTexel.x, oneTexel.y)); vec4 gray = vec4(0.3, 0.59, 0.11, 0.0); float uDiff = dot(abs(centre - up), gray); float dDiff = dot(abs(centre - dow), gray); float lDiff = dot(abs(centre - lef), gray); float rDiff = dot(abs(centre - rig), gray); float u2Diff = dot(abs(centre - up2), gray); float d2Diff = dot(abs(centre - dow2), gray); float l2Diff = dot(abs(centre - lef2), gray); float r2Diff = dot(abs(centre - rig2), gray); float ulDiff = dot(abs(centre - ul), gray); float urDiff = dot(abs(centre - ur), gray); float blDiff = dot(abs(centre - bl0), gray); float brDiff = dot(abs(centre - br0), gray); float sumL = uDiff + dDiff + lDiff + rDiff + u2Diff + d2Diff + l2Diff + r2Diff + ulDiff + urDiff + blDiff + brDiff; float sumLuma = clamp(sumL, 0.0, 1.0); return vec4(sumLuma, sumLuma, sumLuma, 1.0); }
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:
|