Advertisement
tonynogo

Demo 28 - Glass with skybox

Jul 6th, 2017
4,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/BasicGlass" {
  2.     Properties {
  3.         _MainTex ("Glass Main Texure", 2D) = "white" {}
  4.         _Transparency ("Transparency Main Texture", Range(0, 1)) = 1
  5.         _EmissionColor ("Emission color", Color) = (1, 1, 1, 1)
  6.         _CubeMap ("CubeMap", Cube) = "white" {}
  7.          
  8.     }
  9.     SubShader {
  10.         Tags { "Queue"="Transparent" "RenderType"="Transparent" }
  11.        
  12.         CGPROGRAM
  13.         #pragma surface surf BlinnPhong alpha
  14.  
  15.         struct Input {
  16.             float2 uv_MainTex;
  17.             float3 worldRefl;
  18.         };
  19.  
  20.         sampler2D _MainTex;
  21.         samplerCUBE _CubeMap;
  22.         fixed4 _EmissionColor;
  23.         fixed _Transparency;
  24.  
  25.  
  26.         void surf (Input IN, inout SurfaceOutput o) {
  27.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
  28.             fixed4 w = texCUBE(_CubeMap, IN.worldRefl);
  29.             o.Emission = _EmissionColor.rgb * w.rgb;
  30.  
  31.             o.Specular = 0;
  32.             o.Gloss = 1;
  33.             o.Albedo = 0;
  34.             o.Alpha = c.a * _EmissionColor.a * _Transparency;
  35.         }
  36.         ENDCG
  37.     }
  38.     FallBack "Transparent/VertexLit"
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement