Advertisement
Dieton

UV_Texture_Flow.shader

Jun 6th, 2025
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/UV_Texture_Flow"
  2. {
  3.     Properties
  4.     {
  5.         _MainTex ("Texture", 2D) = "white"{}
  6.         _FlowTex ("Flow Texture", 2D) = "white"{}
  7.         _UvTex ("UV Texture", 2D) = "white"{}
  8.         _ColorValue ("Color", Color) = (1,1,1,1)
  9.         _FLowSpeed_Tile("Flow Speed / Tile", vector) = (0,0,1,1)
  10.     }
  11.     SubShader
  12.     {
  13.         Tags {
  14.             "RenderType"="TransparentCutout"
  15.             "Queue"="Transparent"
  16.         }
  17.         Blend SrcAlpha OneMinusSrcAlpha
  18.         LOD 100
  19.  
  20.         Pass
  21.         {
  22.             CGPROGRAM
  23.             #pragma vertex vert
  24.             #pragma fragment frag
  25.  
  26.             #include "UnityCG.cginc"
  27.  
  28.             struct appdata
  29.             {
  30.                 float4 vertex : POSITION;
  31.                 float2 uv : TEXCOORD0;
  32.             };
  33.  
  34.             struct v2f
  35.             {
  36.                 float4 uv : TEXCOORD0;
  37.                 float4 vertex : SV_POSITION;
  38.             };
  39.  
  40.             sampler2D _MainTex;
  41.             float4 _MainTex_ST;
  42.  
  43.             sampler2D _FlowTex;
  44.             //float4 _FlowTex_ST;
  45.  
  46.             sampler2D _UvTex;
  47.             //float4 _UvTex_ST;
  48.  
  49.             float4 _FLowSpeed_Tile;
  50.  
  51.             float4 _ColorValue;
  52.  
  53.             v2f vert (appdata v)
  54.             {
  55.                 v2f o;
  56.                 o.vertex = UnityObjectToClipPos(v.vertex);
  57.                 o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
  58.                 o.uv.zw = v.uv;
  59.                 return o;
  60.             }
  61.  
  62.             fixed4 frag (v2f i) : SV_Target
  63.             {
  64.                 fixed4 uv = tex2D(_UvTex, i.uv.xy);
  65.                 uv.rg *= _FLowSpeed_Tile.zw;
  66.                 uv.rg += frac(_Time.y * _FLowSpeed_Tile.xy);
  67.                 fixed4 flow = tex2D(_FlowTex, uv.rg) * uv.a;
  68.                 fixed4 col = tex2D(_MainTex, i.uv.xy) * (1-uv.a * flow.a);//remove this to add * (1-uv.a * flow.a)
  69.                 return flow + col;
  70.             }
  71.             ENDCG
  72.         }
  73.     }
  74.     // FallBack "Diffuse"
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement