Sinuousity

VolumeSmoke.shader

Nov 15th, 2013
2,088
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Fresnel/Transparent With Wrap" {
  2.     Properties {
  3.         _MainColor ("Base Color", Color) = (0.5,0.5,0.5,1)
  4.         _MainTex ("Base (RGB)", 2D) = "white" {}
  5.         _Emission ("Emission", Range(0.0,1.0)) = 0.0
  6.         _FresnelP ("Fresnel Power", Range(0.1,4)) = 1
  7.         _FresnelO ("Fresnel Offset", Range(-0.9,-0.5)) = -0.7
  8.     }
  9.     SubShader {
  10.         Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  11.         LOD 200
  12.        
  13.         CGPROGRAM
  14.         // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
  15.         #pragma exclude_renderers gles
  16.         #pragma surface surf WrapLambert alpha
  17.         #pragma vertex vert
  18.        
  19.         half4 LightingWrapLambert (SurfaceOutput s, half3 lightDir, half atten)
  20.         {
  21.           half NdotL = dot (s.Normal, lightDir);
  22.           half diff = NdotL * 0.3 + 0.7;
  23.           half4 c;
  24.           c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
  25.           c.a = s.Alpha;
  26.           return c;
  27.         }
  28.        
  29.         fixed4 _MainColor;
  30.         sampler2D _MainTex;
  31.         half _FresnelP;
  32.         half _FresnelO;
  33.         half _Emission;
  34.  
  35.         struct Input
  36.         {
  37.             float2 uv_MainTex;
  38.             float3 viewDir;
  39.             float4 color : COLOR;
  40.         };
  41.        
  42.         void vert (inout appdata_full v, out Input o)
  43.         {
  44.             UNITY_INITIALIZE_OUTPUT(Input,o);
  45.             o.color = v.color;
  46.         }
  47.        
  48.         void surf (Input IN, inout SurfaceOutput o)
  49.         {
  50.             float f = pow((saturate(dot(normalize(IN.viewDir),o.Normal)+ _FresnelO)),_FresnelP);
  51.             half4 c = tex2D (_MainTex, IN.uv_MainTex) * _MainColor * IN.color;
  52.             o.Albedo = c.rgb;
  53.             o.Alpha = f * c.a;
  54.             o.Emission = c.rgb * _Emission;
  55.         }
  56.         ENDCG
  57.     }
  58.     FallBack "Diffuse"
  59. }
Advertisement
Add Comment
Please, Sign In to add comment