Advertisement
dnnkeeper

Offset shader

Feb 1st, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. Shader "Custom/GunShader" {
  2.     Properties {
  3.         _Color ("Color", Color) = (1,1,1,1)
  4.         _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5.         _Glossiness ("Smoothness", Range(0,1)) = 0.5
  6.         _Metallic ("Metallic", Range(0,1)) = 0.0
  7.     }
  8.     SubShader {
  9.         Tags { "RenderType"="Transparent" "Queue"="Geometry+1" }
  10.         LOD 200
  11.  
  12.         Pass {
  13.             Cull Back
  14.             ZTest Always
  15.             ColorMask 0
  16.         }
  17.  
  18.         CGPROGRAM
  19.         // Physically based Standard lighting model, and enable shadows on all light types
  20.         #pragma surface surf Standard fullforwardshadows
  21.  
  22.         // Use shader model 3.0 target, to get nicer looking lighting
  23.         #pragma target 3.0
  24.  
  25.         sampler2D _MainTex;
  26.  
  27.         struct Input {
  28.             float2 uv_MainTex;
  29.         };
  30.  
  31.         half _Glossiness;
  32.         half _Metallic;
  33.         fixed4 _Color;
  34.  
  35.         void surf (Input IN, inout SurfaceOutputStandard o) {
  36.             // Albedo comes from a texture tinted by color
  37.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  38.             o.Albedo = c.rgb;
  39.             // Metallic and smoothness come from slider variables
  40.             o.Metallic = _Metallic;
  41.             o.Smoothness = _Glossiness;
  42.             o.Alpha = c.a;
  43.         }
  44.         ENDCG
  45.    
  46.     }
  47.  
  48.     Fallback "Mobile/VertexLit"
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement