bad_bloom.glsl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. void main()
  2. {
  3. float4 c_center = Sample();
  4. float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0);
  5. float2 pos = GetCoordinates() + float2(0.3, 0.3) * GetInvResolution();
  6. float2 radius1 = 1.3 * GetInvResolution();
  7. bloom_sum += SampleLocation(pos + float2(-1.5, -1.5) * radius1);
  8. bloom_sum += SampleLocation(pos + float2(-2.5, 0.0) * radius1);
  9. bloom_sum += SampleLocation(pos + float2(-1.5, 1.5) * radius1);
  10. bloom_sum += SampleLocation(pos + float2(0.0, 2.5) * radius1);
  11. bloom_sum += SampleLocation(pos + float2(1.5, 1.5) * radius1);
  12. bloom_sum += SampleLocation(pos + float2(2.5, 0.0) * radius1);
  13. bloom_sum += SampleLocation(pos + float2(1.5, -1.5) * radius1);
  14. bloom_sum += SampleLocation(pos + float2(0.0, -2.5) * radius1);
  15. float2 radius2 = 4.6 * GetInvResolution();
  16. bloom_sum += SampleLocation(pos + float2(-1.5, -1.5) * radius2);
  17. bloom_sum += SampleLocation(pos + float2(-2.5, 0.0) * radius2);
  18. bloom_sum += SampleLocation(pos + float2(-1.5, 1.5) * radius2);
  19. bloom_sum += SampleLocation(pos + float2(0.0, 2.5) * radius2);
  20. bloom_sum += SampleLocation(pos + float2(1.5, 1.5) * radius2);
  21. bloom_sum += SampleLocation(pos + float2(2.5, 0.0) * radius2);
  22. bloom_sum += SampleLocation(pos + float2(1.5, -1.5) * radius2);
  23. bloom_sum += SampleLocation(pos + float2(0.0, -2.5) * radius2);
  24. bloom_sum *= 0.07;
  25. bloom_sum -= float4(0.3, 0.3, 0.3, 0.3);
  26. bloom_sum = max(bloom_sum, float4(0.0, 0.0, 0.0, 0.0));
  27. float2 vpos = (GetCoordinates() - float2(0.5, 0.5)) * 2.0;
  28. float dist = (dot(vpos, vpos));
  29. dist = 1.0 - 0.4*dist;
  30. SetOutput((c_center * 0.7 + bloom_sum) * dist);
  31. }