threshold.glsl 362 B

12345678910
  1. extern number threshold;
  2. vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
  3. vec4 result = Texel(texture, texture_coords);
  4. float luminance = dot(result.rgb, vec3(.2125, .7154, .0721));
  5. float val = clamp(luminance - threshold, 0, 1) / (1 - threshold);
  6. result = vec4(val);
  7. return vec4(result.rgb * color.rgb, result.a);
  8. }