ChromaScreen.shader 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Shader "ShaderControl/ChromaScreen"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. // No culling or depth
  10. Cull Off ZWrite Off ZTest Always
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. #pragma multi_compile __ ENABLE_RED_CHANNEL
  17. #pragma multi_compile __ ENABLE_GREEN_CHANNEL
  18. #pragma multi_compile __ ENABLE_BLUE_CHANNEL
  19. #include "UnityCG.cginc"
  20. struct appdata
  21. {
  22. float4 vertex : POSITION;
  23. float2 uv : TEXCOORD0;
  24. };
  25. struct v2f
  26. {
  27. float2 uv : TEXCOORD0;
  28. float4 vertex : SV_POSITION;
  29. };
  30. v2f vert (appdata v)
  31. {
  32. v2f o;
  33. o.vertex = UnityObjectToClipPos(v.vertex);
  34. o.uv = v.uv;
  35. return o;
  36. }
  37. sampler2D _MainTex;
  38. fixed4 frag (v2f i) : SV_Target
  39. {
  40. fixed4 col = tex2D(_MainTex, i.uv);
  41. #if !ENABLE_RED_CHANNEL
  42. col.r = 0;
  43. #endif
  44. #if !ENABLE_GREEN_CHANNEL
  45. col.g = 0;
  46. #endif
  47. #if !ENABLE_BLUE_CHANNEL
  48. col.b = 0;
  49. #endif
  50. return col;
  51. }
  52. ENDCG
  53. }
  54. }
  55. }