You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.1 KiB

  1. Shader "Hidden/Post FX/Monitors/Parade Render"
  2. {
  3. SubShader
  4. {
  5. ZTest Always Cull Off ZWrite Off
  6. Fog { Mode off }
  7. CGINCLUDE
  8. #pragma fragmentoption ARB_precision_hint_fastest
  9. #pragma target 5.0
  10. #include "UnityCG.cginc"
  11. StructuredBuffer<uint4> _Waveform;
  12. float4 _Size;
  13. float _Exposure;
  14. float3 Tonemap(float3 x, float exposure)
  15. {
  16. const float a = 6.2;
  17. const float b = 0.5;
  18. const float c = 1.7;
  19. const float d = 0.06;
  20. x *= exposure;
  21. x = max((0.0).xxx, x - (0.004).xxx);
  22. x = (x * (a * x + b)) / (x * (a * x + c) + d);
  23. return x * x;
  24. }
  25. float4 FragParade(v2f_img i) : SV_Target
  26. {
  27. const float3 red = float3(1.8, 0.03, 0.02);
  28. const float3 green = float3(0.02, 1.3, 0.05);
  29. const float3 blue = float3(0.0, 0.45, 1.75);
  30. float3 color = float3(0.0, 0.0, 0.0);
  31. const uint limitR = _Size.x / 3;
  32. const uint limitG = limitR * 2;
  33. if (i.pos.x < (float)limitR)
  34. {
  35. uint2 uvI = i.pos.xy;
  36. color = _Waveform[uvI.y + uvI.x * _Size.y].r * red;
  37. }
  38. else if (i.pos.x < (float)limitG)
  39. {
  40. uint2 uvI = uint2(i.pos.x - limitR, i.pos.y);
  41. color = _Waveform[uvI.y + uvI.x * _Size.y].g * green;
  42. }
  43. else
  44. {
  45. uint2 uvI = uint2(i.pos.x - limitG, i.pos.y);
  46. color = _Waveform[uvI.y + uvI.x * _Size.y].b * blue;
  47. }
  48. color = Tonemap(color, _Exposure);
  49. color += (0.1).xxx;
  50. return float4(saturate(color), 1.0);
  51. }
  52. ENDCG
  53. // (0)
  54. Pass
  55. {
  56. CGPROGRAM
  57. #pragma vertex vert_img
  58. #pragma fragment FragParade
  59. ENDCG
  60. }
  61. }
  62. FallBack off
  63. }