Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/UV_Texture_Flow"
- {
- Properties
- {
- _MainTex ("Texture", 2D) = "white"{}
- _FlowTex ("Flow Texture", 2D) = "white"{}
- _UvTex ("UV Texture", 2D) = "white"{}
- _ColorValue ("Color", Color) = (1,1,1,1)
- _FLowSpeed_Tile("Flow Speed / Tile", vector) = (0,0,1,1)
- }
- SubShader
- {
- Tags {
- "RenderType"="TransparentCutout"
- "Queue"="Transparent"
- }
- Blend SrcAlpha OneMinusSrcAlpha
- LOD 100
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "UnityCG.cginc"
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
- struct v2f
- {
- float4 uv : TEXCOORD0;
- float4 vertex : SV_POSITION;
- };
- sampler2D _MainTex;
- float4 _MainTex_ST;
- sampler2D _FlowTex;
- //float4 _FlowTex_ST;
- sampler2D _UvTex;
- //float4 _UvTex_ST;
- float4 _FLowSpeed_Tile;
- float4 _ColorValue;
- v2f vert (appdata v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
- o.uv.zw = v.uv;
- return o;
- }
- fixed4 frag (v2f i) : SV_Target
- {
- fixed4 uv = tex2D(_UvTex, i.uv.xy);
- uv.rg *= _FLowSpeed_Tile.zw;
- uv.rg += frac(_Time.y * _FLowSpeed_Tile.xy);
- fixed4 flow = tex2D(_FlowTex, uv.rg) * uv.a;
- fixed4 col = tex2D(_MainTex, i.uv.xy) * (1-uv.a * flow.a);//remove this to add * (1-uv.a * flow.a)
- return flow + col;
- }
- ENDCG
- }
- }
- // FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement