SparrowRenderer/shaders/luminance.frag.glsl

11 lines
317 B
GLSL

uniform sampler2DRect colorSampler;
uniform float threshold;
layout(location = 0)out vec3 filter;
void main(void) {
vec3 color = texelFetch(colorSampler, ivec2(gl_FragCoord.xy)).xyz;
float luminance = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;
filter = luminance > threshold ? color : vec3(0);
}