Advertisement
tonynogo

Demo 21 - Electric arc

Jul 6th, 2017
5,237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/ElectricArc" {
  2.     Properties {
  3.         _MainTex ("Main Texture", 2D) = "white" {}
  4.         _NoiseTex ("Noise Texture", 2D) = "grey" {}
  5.         _Speed ("Speed", Range(0, 50)) = 1
  6.     }
  7.     SubShader {
  8.         Tags { "Queue"="Transparent" "RenderType"="Transparent" }
  9.        
  10.         CGPROGRAM
  11.         #pragma surface surf Lambert alpha
  12.  
  13.         sampler2D _MainTex;
  14.         sampler2D _NoiseTex;
  15.         float _Speed;
  16.  
  17.         struct Input {
  18.             float2 uv_MainTex;
  19.             float2 uv_NoiseTex;
  20.         };
  21.  
  22.         void surf (Input IN, inout SurfaceOutput o) {
  23.             float time1 = frac(ceil(_Time.y * _Speed) * 0.01);
  24.             float time2 = frac(ceil(_Time.x * _Speed) * 0.01);
  25.             float noise = tex2D(_NoiseTex, float2(time1, time2)).r;
  26.             float2 uv = IN.uv_MainTex;
  27.             uv.y = frac(uv.y + noise);
  28.             half4 color = tex2D (_MainTex, uv);
  29.             o.Albedo = color.rgb;
  30.             o.Alpha = color.a;
  31.         }
  32.         ENDCG
  33.     }
  34.     FallBack "Diffuse"
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement