diff options
Diffstat (limited to 'src/fragment.glsl')
-rw-r--r-- | src/fragment.glsl | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/fragment.glsl b/src/fragment.glsl index edeccab..e233466 100644 --- a/src/fragment.glsl +++ b/src/fragment.glsl @@ -2,23 +2,26 @@ out vec4 FragColor; in vec2 texCoord; +in float randOffset; uniform sampler2D texture0; uniform sampler2D texture1; +/* thank you internet i guess + * note: this has terrible distribution, not sure if i care */ +float +rand(vec2 co){ + return fract(sin(dot(co.xy ,vec2(12.9898,78.233))+randOffset) * 43758.5453); +} + void main() { vec4 col = mix(texture(texture0, texCoord), texture(texture1, texCoord), 0.2); - col.r = (col.r < 0.5) ? 0.0 : 1.0; - col.g = (col.g < 0.5) ? 0.0 : 1.0; - col.b = (col.b < 0.5) ? 0.0 : 1.0; - if (col.r == 1.0 && col.g == 1.0) - col.rgb = vec3(1.0, 1.0, 0.0); - else if (col.r == 1.0) - col.rgb = vec3(0.0, 1.0, 1.0); + float gray = 0.2989 * col.r + 0.5870 * col.g + 0.1140 * col.b; + if (gray + rand(texCoord) - 0.5 < 0.5) + FragColor = vec4(vec3(0.0), 1.0); else - col.rgb = vec3(1.0, 0.0, 1.0); - FragColor = col; + FragColor = vec4(1.0); } |