Advertisement
Draco18s

MakeVisible Shader

Nov 18th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/MakeVisible" {
  2.     Properties {
  3.         _Color ("Color", Color) = (1,1,1,1)
  4.         _TransparencyMult ("Transparency Mulitplier", Range(0,1)) = 1
  5.         _MainTex ("Albedo (RGB)", 2D) = "white" {}
  6.         _Glossiness ("Smoothness", Range(0,1)) = 0.5
  7.         _Metallic ("Metallic", Range(0,1)) = 0.0
  8.     }
  9.     SubShader {
  10.         Tags{
  11.             "RenderType" = "Transparent"
  12.             "Queue" = "Transparent"
  13.         }
  14.         LOD 200
  15.  
  16.         CGPROGRAM
  17.         #pragma surface surf Standard fullforwardshadows alpha
  18.         #pragma target 3.0
  19.  
  20.         sampler2D _MainTex;
  21.  
  22.         struct Input {
  23.             float2 uv_MainTex;
  24.         };
  25.  
  26.         half _Glossiness;
  27.         half _Metallic;
  28.         fixed4 _Color;
  29.         half _TransparencyMult;
  30.  
  31.         UNITY_INSTANCING_CBUFFER_START(Props)
  32.         UNITY_INSTANCING_CBUFFER_END
  33.  
  34.         void surf (Input IN, inout SurfaceOutputStandard o) {
  35.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  36.             o.Albedo = c.rgb;
  37.             o.Metallic = _Metallic;
  38.             o.Smoothness = _Glossiness;
  39.  
  40.             //Multiply alpha by value between 0 and 1
  41.             o.Alpha = c.a * _TransparencyMult;
  42.         }
  43.         ENDCG
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement