vec4 AA() { float twoThirds = 0.6667; float threeQuarters = 0.75; vec4 xc = texture(tex, tex_coord); vec4 u1 = texture(tex, tex_coord + vec2(0.0, -oneTexel.y)); vec4 u2 = texture(tex, tex_coord + vec2(0.0, -oneTexel.y * 2.0)); vec4 d1 = texture(tex, tex_coord + vec2(0.0, oneTexel.y)); vec4 d2 = texture(tex, tex_coord + vec2(0.0, oneTexel.y * 2.0)); vec4 l1 = texture(tex, tex_coord + vec2(-oneTexel.x, 0.0)); vec4 l2 = texture(tex, tex_coord + vec2(-oneTexel.x * 2.0, 0.0)); vec4 r1 = texture(tex, tex_coord + vec2(oneTexel.x, 0.0)); vec4 r2 = texture(tex, tex_coord + vec2(oneTexel.x * 2.0, 0.0)); vec4 v1 = mix(xc, mix(l1, l2, twoThirds), threeQuarters); vec4 v2 = mix(xc, mix(r1, r2, twoThirds), threeQuarters); vec4 v3 = mix(xc, mix(u1, u2, twoThirds), threeQuarters); vec4 v4 = mix(xc, mix(d1, d2, twoThirds), threeQuarters); vec4 v5 = mix(v1, v2, 0.5); vec4 v6 = mix(v3, v4, 0.5); return mix(v5, v6, 0.5); }
0 Comments
//Sets all the black squares to one colour, all the white squares to the original / previous colour //There are as many squares on this board as there are pixels. vec4 chess(vec4 interlaceColour) { vec4 returnCol = texture(tex, vec2(1.0 - tex_coord.x, tex_coord.y)); if (logicalXOR(positionX % 2 == 0, positionY % 2 == 0)) returnCol = interlaceColour; return returnCol; } // Couldn't think of a good name for it at the time vec4 jeNeSaisPas() { return texture(tex, vec2(tex_coord.y, tex_coord.x)); } //controls get really difficult to use when it's on // Simple left to right mirror - like in real life - not true! They turn you inside out! www.bbc.co.uk/archive/feynman/10703.shtml vec4 mirror() { return texture(tex, vec2(1.0 - tex_coord.x, tex_coord.y)); } // This was inspired by a screenshot of someone's game of Uncharted 4. // Splits the colours into groups based on luminosity then outputs a set colour based on that vec4 shades(vec4 input_colour) { vec4 returnCol = vec4(0.0); float sumCol = input_colour.r + input_colour.g + input_colour.b; if (sumCol < 1.0) { returnCol = vec4(0.2, 0.3, 0.3, 1.0); } else if (sumCol < 2.0) { returnCol = vec4(0.4, 0.5, 0.5, 1.0); } else { returnCol = vec4(0.7, 0.8, 0.8, 1.0); } return returnCol; } // Uses most dominant primary colour for that pixel. IDK, you could use this if you were looking for a retro effect like Ceefax. vec4 tri(vec4 input_colour) { vec4 returnCol = vec4(0.0); if (input_colour.r > input_colour.g && input_colour.r > input_colour.b) returnCol = vec4(1.0, 0.0, 0.0, 1.0); if (input_colour.g > input_colour.r && input_colour.g > input_colour.b) returnCol = vec4(0.0, 1.0, 0.0, 1.0); if (input_colour.b > input_colour.r && input_colour.b > input_colour.g) returnCol = vec4(0.0, 0.0, 1.0, 1.0); return returnCol; } |
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:
|