16bit.glsl 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. uniform sampler2D samp9;
  2. out vec4 ocol0;
  3. in vec2 uv0;
  4. uniform vec4 resolution;
  5. void main()
  6. {
  7. //Change this number to increase the pixel size.
  8. float pixelSize = 3;
  9. float red = 0.0;
  10. float green = 0.0;
  11. float blue = 0.0;
  12. vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
  13. vec4 c0 = texture(samp9, pos);
  14. if (c0.r < 0.1)
  15. red = 0.1;
  16. else if (c0.r < 0.20)
  17. red = 0.20;
  18. else if (c0.r < 0.40)
  19. red = 0.40;
  20. else if (c0.r < 0.60)
  21. red = 0.60;
  22. else if (c0.r < 0.80)
  23. red = 0.80;
  24. else
  25. red = 1.0;
  26. if (c0.b < 0.1)
  27. blue = 0.1;
  28. else if (c0.b < 0.20)
  29. blue = 0.20;
  30. else if (c0.b < 0.40)
  31. blue = 0.40;
  32. else if (c0.b < 0.60)
  33. blue = 0.60;
  34. else if (c0.b < 0.80)
  35. blue = 0.80;
  36. else
  37. blue = 1.0;
  38. if (c0.g < 0.1)
  39. green = 0.1;
  40. else if (c0.g < 0.20)
  41. green = 0.20;
  42. else if (c0.g < 0.40)
  43. green = 0.40;
  44. else if (c0.g < 0.60)
  45. green = 0.60;
  46. else if (c0.g < 0.80)
  47. green = 0.80;
  48. else
  49. green = 1.0;
  50. ocol0 = vec4(red, green, blue, c0.a);
  51. }