duck

Untitled

Jul 7th, 2010
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. Shader "Heat Haze"
  2. {
  3.     Properties
  4.     {
  5.         _MainTex ("Base (RGB)", RECT) = "white" {}
  6.         _DisortTex ("Disortion Normal (RGB)", 2D) = "white" {}
  7.         _DisortStrength ("Disortion Strength", Float) = 0.1
  8.         _DisortSpeed ("Disortion Strength", Vector) = (0.0, 1.0, 0.0, 0.0)
  9.     }
  10.  
  11.     SubShader
  12.     {
  13.         Pass
  14.         {
  15.             ZTest Always
  16.             Cull Off
  17.             ZWrite Off
  18.             Fog { Mode off }
  19.            
  20.             CGPROGRAM
  21.                 #pragma vertex vert_img
  22.                 #pragma fragment frag
  23.                 #pragma fragmentoption ARB_precision_hint_fastest
  24.                 #include "UnityCG.cginc"
  25.  
  26.                 uniform samplerRECT _MainTex;
  27.                 uniform sampler2D _DisortTex;
  28.                 uniform float _DisortStrength;
  29.                 uniform float4 _DisortSpeed;
  30.  
  31.                 float4 frag (v2f_img i) : COLOR
  32.                 {  
  33.                     float4 disortion = tex2D(_DisortTex, i.uv)*2.0-1.0;
  34.                     disortion = normalize(disortion);
  35.                
  36.                     float4 original = texRECT(_MainTex, i.uv+disortion.rg*_DisortStrength+_DisortSpeed*_Time.x);
  37.                    
  38.                     return original;
  39.                 }
  40.             ENDCG
  41.         }
  42.     }
  43.  
  44.     Fallback off
  45. }
Add Comment
Please, Sign In to add comment