darkerbrighter.glsl 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. uniform sampler2D samp9;
  2. out vec4 ocol0;
  3. in vec2 uv0;
  4. uniform vec4 resolution;
  5. void main()
  6. {
  7. float4 c0 = texture(samp9, uv0);
  8. float4 c1 = texture(samp9, uv0 - float2(1, 0)*resolution.zw);
  9. float4 c2 = texture(samp9, uv0 - float2(0, 1)*resolution.zw);
  10. float4 c3 = texture(samp9, uv0 + float2(1, 0)*resolution.zw);
  11. float4 c4 = texture(samp9, uv0 + float2(0, 1)*resolution.zw);
  12. float red = c0.r;
  13. float blue = c0.b;
  14. float green = c0.g;
  15. float red2 = (c1.r + c2.r + c3.r + c4.r) / 4;
  16. float blue2 = (c1.b + c2.b + c3.b + c4.b) / 4;
  17. float green2 = (c1.g + c2.g + c3.g + c4.g) / 4;
  18. if(red2 > 0.3)
  19. red = c0.r + c0.r / 2 ;
  20. else
  21. red = c0.r - c0.r / 2 ;
  22. if(green2 > 0.3)
  23. green = c0.g+ c0.g / 2;
  24. else
  25. green = c0.g - c0.g / 2;
  26. if(blue2 > 0.3)
  27. blue = c0.b+ c0.b / 2 ;
  28. else
  29. blue = c0.b - c0.b / 2 ;
  30. ocol0 = float4(red, green, blue, c0.a);
  31. }