1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- Shader "Hidden/NodeMasking"
- {
- Properties {
- _Ports ("_Ports", Vector) = (0,0,0,0)
- _MainTex("_MainTex", 2D) = "white" {}
- }
- SubShader
- {
- Pass
- {
- CGPROGRAM
- #include "UnityCG.cginc"
- #include "Preview.cginc"
- #pragma vertex vert_img
- #pragma fragment frag
- sampler2D _MainTex;
- float4 _Ports;
- float4 frag( v2f_img i ) : SV_Target
- {
- float4 a = tex2D( _MainTex, i.uv );
- return a * _Ports;
- }
- ENDCG
- }
- Pass
- {
- CGPROGRAM
- #include "UnityCG.cginc"
- #include "Preview.cginc"
- #pragma vertex vert_img
- #pragma fragment frag
- sampler2D _MaskTex;
- float _Port;
- float4 frag( v2f_img i ) : SV_Target
- {
- float4 a = tex2D( _MaskTex, i.uv );
- float4 c = 0;
- if ( _Port == 1 )
- c = a.x;
- else if ( _Port == 2 )
- c = a.y;
- else if ( _Port == 3 )
- c = a.z;
- else if ( _Port == 4 )
- c = a.w;
- else if ( _Port == 5 )
- c = float4( a.xyz, 0 );
- return c;
- }
- ENDCG
- }
- }
- }
|