Advertisement
tonynogo

Demo 11 - Fireball with ramp texture

Jul 6th, 2017
6,225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/Fireball" {
  2.     Properties {
  3.         _RampTex ("Ramp texture", 2D) = "white" {}
  4.         _NoiseTex ("Noise texture",2D) = "grey" {}
  5.         _RampVal ("Ramp offset", Range(-0.5, 0.5)) = 0
  6.         _Amplitude ("Amplitude factor", Range(0, 0.03)) = 0.01
  7.     }
  8.     SubShader {
  9.         Tags { "RenderType"="Opaque" }
  10.        
  11.         CGPROGRAM
  12.         #pragma surface surf Lambert vertex:vert
  13.  
  14.         sampler2D _NoiseTex;
  15.         sampler2D _RampTex;
  16.         fixed _RampVal;
  17.         fixed _Amplitude;
  18.  
  19.         struct Input {
  20.             float2 uv_NoiseTex;
  21.         };
  22.  
  23.         void vert(inout appdata_full v) {
  24.             half noiseVal = tex2Dlod(_NoiseTex, float4(v.texcoord.xy, 0, 0)).r;
  25.             v.vertex.xyz += v.normal * sin(_Time.w + noiseVal * 100)* _Amplitude;
  26.         }
  27.  
  28.         void surf (Input IN, inout SurfaceOutput o) {
  29.             half noiseVal = tex2D(_NoiseTex, IN.uv_NoiseTex).r + (sin(_Time.y)) / 15;
  30.             half4 color = tex2D(_RampTex, float2(saturate(_RampVal + noiseVal), 0.5));
  31.             o.Albedo = color.rgb;
  32.             o.Emission = color.rgb;
  33.         }
  34.         ENDCG
  35.     }
  36.     FallBack "Diffuse"
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement