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.

55 lines
860 B

  1. Shader "Hidden/NodeMasking"
  2. {
  3. Properties {
  4. _Ports ("_Ports", Vector) = (0,0,0,0)
  5. _MainTex("_MainTex", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Pass
  10. {
  11. CGPROGRAM
  12. #include "UnityCG.cginc"
  13. #pragma vertex vert_img
  14. #pragma fragment frag
  15. sampler2D _MainTex;
  16. float4 _Ports;
  17. float4 frag( v2f_img i ) : SV_Target
  18. {
  19. float4 a = tex2D( _MainTex, i.uv );
  20. return a * _Ports;
  21. }
  22. ENDCG
  23. }
  24. Pass
  25. {
  26. CGPROGRAM
  27. #include "UnityCG.cginc"
  28. #pragma vertex vert_img
  29. #pragma fragment frag
  30. sampler2D _MaskTex;
  31. float _Port;
  32. float4 frag( v2f_img i ) : SV_Target
  33. {
  34. float4 a = tex2D( _MaskTex, i.uv );
  35. float4 c = 0;
  36. if ( _Port == 1 )
  37. c = a.x;
  38. else if ( _Port == 2 )
  39. c = a.y;
  40. else if ( _Port == 3 )
  41. c = a.z;
  42. else if ( _Port == 4 )
  43. c = a.w;
  44. return c;
  45. }
  46. ENDCG
  47. }
  48. }
  49. }