Preview_NodeMasking.shader 972 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "Preview.cginc"
  14. #pragma vertex vert_img
  15. #pragma fragment frag
  16. sampler2D _MainTex;
  17. float4 _Ports;
  18. float4 frag( v2f_img i ) : SV_Target
  19. {
  20. float4 a = tex2D( _MainTex, i.uv );
  21. return a * _Ports;
  22. }
  23. ENDCG
  24. }
  25. Pass
  26. {
  27. CGPROGRAM
  28. #include "UnityCG.cginc"
  29. #include "Preview.cginc"
  30. #pragma vertex vert_img
  31. #pragma fragment frag
  32. sampler2D _MaskTex;
  33. float _Port;
  34. float4 frag( v2f_img i ) : SV_Target
  35. {
  36. float4 a = tex2D( _MaskTex, i.uv );
  37. float4 c = 0;
  38. if ( _Port == 1 )
  39. c = a.x;
  40. else if ( _Port == 2 )
  41. c = a.y;
  42. else if ( _Port == 3 )
  43. c = a.z;
  44. else if ( _Port == 4 )
  45. c = a.w;
  46. else if ( _Port == 5 )
  47. c = float4( a.xyz, 0 );
  48. return c;
  49. }
  50. ENDCG
  51. }
  52. }
  53. }