Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/Transparent"
- {
- Properties
- {
- _Color ("Color", Color) = (1,1,1,1)
- _MainTex ("Albedo (RGB)", 2D) = "white" {}
- _BumpMap ("Bumpmap", 2D) = "bump" {}
- _EmissionColor ("Emission", Color) = (0,0,0,0)
- _Glossiness ("Smoothness", Range(0,1)) = 0.5
- _Metallic ("Metallic", Range(0,1)) = 0.0
- }
- SubShader
- {
- Tags {"Queue" = "Transparent-1" "RenderType"="Transparent"}
- LOD 200
- // extra pass that renders to depth buffer only
- Pass {
- ZWrite On
- ColorMask 0
- }
- CGPROGRAM
- #pragma surface surf Standard fullforwardshadows alpha:fade
- #pragma target 3.0
- sampler2D _MainTex;
- sampler2D _BumpMap;
- float4 _EmissionColor;
- struct Input {
- float2 uv_MainTex;
- float2 uv_BumpMap;
- float3 worldPos : TEXCOORD1;
- };
- half _Glossiness;
- half _Metallic;
- fixed4 _Color;
- void surf (Input IN, inout SurfaceOutputStandard o)
- {
- fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
- o.Albedo = c.rgb;
- o.Metallic = _Metallic;
- o.Smoothness = _Glossiness;
- o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
- //blends between range of 90 and 100, outside of those the alpha is either 0 or 1
- o.Alpha = clamp((100-distance(IN.worldPos, _WorldSpaceCameraPos)) / 10,0,1);
- o.Emission = _EmissionColor;
- }
- ENDCG
- }
- FallBack "Standard"
- }
Advertisement
Add Comment
Please, Sign In to add comment