Guest User

Untitled

a guest
Jun 29th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Shader "Custom/Transparent"
  2. {
  3. Properties
  4. {
  5. _Color ("Color", Color) = (1,1,1,1)
  6. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  7. _BumpMap ("Bumpmap", 2D) = "bump" {}
  8. _EmissionColor ("Emission", Color) = (0,0,0,0)
  9. _Glossiness ("Smoothness", Range(0,1)) = 0.5
  10. _Metallic ("Metallic", Range(0,1)) = 0.0
  11. }
  12. SubShader
  13. {
  14. Tags {"Queue" = "Transparent-1" "RenderType"="Transparent"}
  15. LOD 200
  16. // extra pass that renders to depth buffer only
  17. Pass {
  18. ZWrite On
  19. ColorMask 0
  20. }
  21.  
  22. CGPROGRAM
  23.  
  24. #pragma surface surf Standard fullforwardshadows alpha:fade
  25. #pragma target 3.0
  26.  
  27. sampler2D _MainTex;
  28. sampler2D _BumpMap;
  29. float4 _EmissionColor;
  30.  
  31. struct Input {
  32. float2 uv_MainTex;
  33. float2 uv_BumpMap;
  34. float3 worldPos : TEXCOORD1;
  35. };
  36.  
  37. half _Glossiness;
  38. half _Metallic;
  39. fixed4 _Color;
  40.  
  41. void surf (Input IN, inout SurfaceOutputStandard o)
  42. {
  43. fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  44. o.Albedo = c.rgb;
  45. o.Metallic = _Metallic;
  46. o.Smoothness = _Glossiness;
  47. o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
  48. //blends between range of 90 and 100, outside of those the alpha is either 0 or 1
  49. o.Alpha = clamp((100-distance(IN.worldPos, _WorldSpaceCameraPos)) / 10,0,1);
  50. o.Emission = _EmissionColor;
  51. }
  52. ENDCG
  53. }
  54. FallBack "Standard"
  55. }
Advertisement
Add Comment
Please, Sign In to add comment