threshold.fs 364 B

12345678910111213141516171819
  1. #version 150
  2. #define GLOW_WHITEPOINT 1.0
  3. #define GLOW_ROLLOFF 3.0
  4. uniform sampler2D source[];
  5. in Vertex {
  6. vec2 vTexCoord;
  7. };
  8. out vec4 FragColor;
  9. void main() {
  10. vec3 color = 1.15 * texture(source[0], vTexCoord).rgb;
  11. vec3 factor = clamp(color / GLOW_WHITEPOINT, 0.0, 1.0);
  12. FragColor = vec4(pow(factor, vec3(GLOW_ROLLOFF)), 1.0);
  13. }