GoogleURPBaseMap.shader.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // An extremely stripped down Universal Pipeline lit shader.
  2. // * Note * this shader should not be used in production, it is only for demonstration purposes for
  3. // use in the Unity Editor.
  4. //
  5. // The only significant difference between this shader and the standard UPR "lit.shader" is the
  6. // setting of "ZTest Always". This is required to facilitate correct rendering of overlapping base
  7. // map features, such as roads or parks.
  8. //
  9. // For production use, a less stripped down version of the standard "lit.shader" (or other URP
  10. // shader) should be used, with the addition of the "ZTest Always" setting as shown below.
  11. Shader "Universal Render Pipeline/GoogleURPBaseMap"
  12. {
  13. Properties
  14. {
  15. // Specular vs Metallic workflow
  16. [HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
  17. [MainColor] _BaseColor("Color", Color) = (1,1,1,1)
  18. [MainTexture] _BaseMap("Albedo", 2D) = "white" {}
  19. _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
  20. _Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
  21. _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
  22. _SmoothnessTextureChannel("Smoothness texture channel", Float) = 0
  23. [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
  24. _MetallicGlossMap("Metallic", 2D) = "white" {}
  25. _SpecColor("Specular", Color) = (0.2, 0.2, 0.2)
  26. _SpecGlossMap("Specular", 2D) = "white" {}
  27. _ZWrite2("ZWrite", Float) = 1.0
  28. [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
  29. [ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
  30. _BumpScale("Scale", Float) = 1.0
  31. _BumpMap("Normal Map", 2D) = "bump" {}
  32. _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
  33. _OcclusionMap("Occlusion", 2D) = "white" {}
  34. _EmissionColor("Color", Color) = (0,0,0)
  35. _EmissionMap("Emission", 2D) = "white" {}
  36. _ZWrite("__zw", Float) = 1.0
  37. // Blending state
  38. [HideInInspector] _Surface("__surface", Float) = 0.0
  39. [HideInInspector] _Blend("__blend", Float) = 0.0
  40. [HideInInspector] _AlphaClip("__clip", Float) = 0.0
  41. [HideInInspector] _SrcBlend("__src", Float) = 1.0
  42. [HideInInspector] _DstBlend("__dst", Float) = 0.0
  43. [HideInInspector] _Cull("__cull", Float) = 2.0
  44. _ReceiveShadows("Receive Shadows", Float) = 1.0
  45. // Editmode props
  46. [HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
  47. // ObsoleteProperties
  48. [HideInInspector] _MainTex("BaseMap", 2D) = "white" {}
  49. [HideInInspector] _Color("Base Color", Color) = (1, 1, 1, 1)
  50. [HideInInspector] _GlossMapScale("Smoothness", Float) = 0.0
  51. [HideInInspector] _Glossiness("Smoothness", Float) = 0.0
  52. [HideInInspector] _GlossyReflections("EnvironmentReflections", Float) = 0.0
  53. }
  54. SubShader
  55. {
  56. LOD 300
  57. // ------------------------------------------------------------------
  58. // Forward pass. Shades all light in a single pass. GI + emission + Fog
  59. Pass
  60. {
  61. // Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
  62. // no LightMode tag are also rendered by Universal Render Pipeline
  63. Name "ForwardLit"
  64. Tags{"LightMode" = "UniversalForward"}
  65. Blend[_SrcBlend][_DstBlend]
  66. ZWrite[_ZWrite]
  67. Cull[_Cull]
  68. // ****************************************************
  69. // ** Required setting for Google Maps Compatibility **
  70. // ****************************************************
  71. //
  72. // Materials for Google map ground plane features require ZTest Always to prevent
  73. // z-fighting between overlapping features.
  74. //
  75. ZTest Always
  76. HLSLPROGRAM
  77. // -------------------------------------
  78. // Material Keywords
  79. #pragma shader_feature _RECEIVE_SHADOWS_OFF
  80. // -------------------------------------
  81. // Universal Pipeline keywords
  82. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
  83. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
  84. #pragma vertex LitPassVertex
  85. #pragma fragment LitPassFragment
  86. #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
  87. #include "Packages/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl"
  88. ENDHLSL
  89. }
  90. }
  91. FallBack "Hidden/Universal Render Pipeline/FallbackError"
  92. CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShader"
  93. }