123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- // An extremely stripped down Universal Pipeline lit shader.
- // * Note * this shader should not be used in production, it is only for demonstration purposes for
- // use in the Unity Editor.
- //
- // The only significant difference between this shader and the standard UPR "lit.shader" is the
- // setting of "ZTest Always". This is required to facilitate correct rendering of overlapping base
- // map features, such as roads or parks.
- //
- // For production use, a less stripped down version of the standard "lit.shader" (or other URP
- // shader) should be used, with the addition of the "ZTest Always" setting as shown below.
- Shader "Universal Render Pipeline/GoogleURPBaseMap"
- {
- Properties
- {
- // Specular vs Metallic workflow
- [HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
- [MainColor] _BaseColor("Color", Color) = (1,1,1,1)
- [MainTexture] _BaseMap("Albedo", 2D) = "white" {}
- _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
- _Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
- _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
- _SmoothnessTextureChannel("Smoothness texture channel", Float) = 0
- [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
- _MetallicGlossMap("Metallic", 2D) = "white" {}
- _SpecColor("Specular", Color) = (0.2, 0.2, 0.2)
- _SpecGlossMap("Specular", 2D) = "white" {}
- _ZWrite2("ZWrite", Float) = 1.0
- [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
- [ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
- _BumpScale("Scale", Float) = 1.0
- _BumpMap("Normal Map", 2D) = "bump" {}
- _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
- _OcclusionMap("Occlusion", 2D) = "white" {}
- _EmissionColor("Color", Color) = (0,0,0)
- _EmissionMap("Emission", 2D) = "white" {}
- _ZWrite("__zw", Float) = 1.0
- // Blending state
- [HideInInspector] _Surface("__surface", Float) = 0.0
- [HideInInspector] _Blend("__blend", Float) = 0.0
- [HideInInspector] _AlphaClip("__clip", Float) = 0.0
- [HideInInspector] _SrcBlend("__src", Float) = 1.0
- [HideInInspector] _DstBlend("__dst", Float) = 0.0
- [HideInInspector] _Cull("__cull", Float) = 2.0
- _ReceiveShadows("Receive Shadows", Float) = 1.0
- // Editmode props
- [HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
- // ObsoleteProperties
- [HideInInspector] _MainTex("BaseMap", 2D) = "white" {}
- [HideInInspector] _Color("Base Color", Color) = (1, 1, 1, 1)
- [HideInInspector] _GlossMapScale("Smoothness", Float) = 0.0
- [HideInInspector] _Glossiness("Smoothness", Float) = 0.0
- [HideInInspector] _GlossyReflections("EnvironmentReflections", Float) = 0.0
- }
- SubShader
- {
- LOD 300
- // ------------------------------------------------------------------
- // Forward pass. Shades all light in a single pass. GI + emission + Fog
- Pass
- {
- // Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
- // no LightMode tag are also rendered by Universal Render Pipeline
- Name "ForwardLit"
- Tags{"LightMode" = "UniversalForward"}
- Blend[_SrcBlend][_DstBlend]
- ZWrite[_ZWrite]
- Cull[_Cull]
- // ****************************************************
- // ** Required setting for Google Maps Compatibility **
- // ****************************************************
- //
- // Materials for Google map ground plane features require ZTest Always to prevent
- // z-fighting between overlapping features.
- //
- ZTest Always
- HLSLPROGRAM
- // -------------------------------------
- // Material Keywords
- #pragma shader_feature _RECEIVE_SHADOWS_OFF
- // -------------------------------------
- // Universal Pipeline keywords
- #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
- #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
- #pragma vertex LitPassVertex
- #pragma fragment LitPassFragment
- #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl"
- ENDHLSL
- }
- }
- FallBack "Hidden/Universal Render Pipeline/FallbackError"
- CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShader"
- }
|