resolve.fs 595 B

12345678910111213141516171819202122232425262728
  1. #version 150
  2. #define BLOOM_STRENGTH 0.25
  3. #define OUTPUT_GAMMA 2.2
  4. uniform sampler2D source[];
  5. in Vertex {
  6. vec2 vTexCoord;
  7. };
  8. out vec4 FragColor;
  9. // For debugging
  10. #define BLOOM_ONLY 0
  11. #define CRT_PASS source[3]
  12. void main() {
  13. #if BLOOM_ONLY
  14. vec3 source = BLOOM_STRENGTH * texture(source[0], vTexCoord).rgb;
  15. #else
  16. vec3 source_ = 1.15 * texture(CRT_PASS, vTexCoord).rgb;
  17. vec3 bloom = texture(source[0], vTexCoord).rgb;
  18. source_ += BLOOM_STRENGTH * bloom;
  19. #endif
  20. FragColor = vec4(pow(clamp(source_, 0.0, 1.0), vec3(1.0 / OUTPUT_GAMMA)), 1.0);
  21. }