CurveBackground.shader 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Shader "Hidden/Universal Render Pipeline/Editor/CurveBackground"
  2. {
  3. CGINCLUDE
  4. #pragma target 3.0
  5. #include "UnityCG.cginc"
  6. float _DisabledState;
  7. float3 HsvToRgb(float3 c)
  8. {
  9. float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
  10. float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
  11. return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
  12. }
  13. float4 FragHue(v2f_img i) : SV_Target
  14. {
  15. float3 hsv = HsvToRgb(float3(i.uv.x, 1.0, 0.2));
  16. float4 color = float4((0.0).xxx, 1.0);
  17. color.rgb = lerp(color.rgb, hsv, smoothstep(0.5, 1.1, 1.0 - i.uv.y)) + lerp(color.rgb, hsv, smoothstep(0.5, 1.1, i.uv.y));
  18. color.rgb += GammaToLinearSpace(0.15).xxx;
  19. return float4(color.rgb, color.a * _DisabledState);
  20. }
  21. float4 FragSat(v2f_img i) : SV_Target
  22. {
  23. float4 color = float4((0.0).xxx, 1.0);
  24. float sat = i.uv.x / 2;
  25. color.rgb += lerp(color.rgb, (sat).xxx, smoothstep(0.5, 1.2, 1.0 - i.uv.y)) + lerp(color.rgb, (sat).xxx, smoothstep(0.5, 1.2, i.uv.y));
  26. color.rgb += GammaToLinearSpace(0.15).xxx;
  27. return float4(color.rgb, color.a * _DisabledState);
  28. }
  29. ENDCG
  30. SubShader
  31. {
  32. Cull Off ZWrite Off ZTest Always
  33. // (0) Hue
  34. Pass
  35. {
  36. CGPROGRAM
  37. #pragma vertex vert_img
  38. #pragma fragment FragHue
  39. ENDCG
  40. }
  41. // (1) Sat/lum
  42. Pass
  43. {
  44. CGPROGRAM
  45. #pragma vertex vert_img
  46. #pragma fragment FragSat
  47. ENDCG
  48. }
  49. }
  50. }