210 lines
8.6 KiB
Plaintext
210 lines
8.6 KiB
Plaintext
Shader "Simulation/URP/Lit"
|
|
{
|
|
Properties
|
|
{
|
|
// Simulation/Legacy/Room X-Ray properties
|
|
_Color ("Color", Color) = (1,1,1,1) // _BaseColor
|
|
_MainTex ("Albedo (RGB)", 2D) = "white" {} // _BaseMap
|
|
_BumpMap ("Normal Map", 2D) = "bump" {}
|
|
_Glossiness ("Smoothness", Range(0,1)) = 0.5 // _Smoothness
|
|
_Metallic ("Metallic", Range(0,1)) = 0.0
|
|
|
|
// 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
|
|
_SmoothnessTextureChannel("Smoothness texture channel", Float) = 0
|
|
|
|
_MetallicGlossMap("Metallic", 2D) = "white" {}
|
|
|
|
_SpecColor("Specular", Color) = (0.2, 0.2, 0.2)
|
|
_SpecGlossMap("Specular", 2D) = "white" {}
|
|
|
|
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
|
|
[ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
|
|
|
|
_BumpScale("Scale", Float) = 1.0
|
|
|
|
_OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
|
|
_OcclusionMap("Occlusion", 2D) = "white" {}
|
|
|
|
_EmissionColor("Color", Color) = (0,0,0)
|
|
_EmissionMap("Emission", 2D) = "white" {}
|
|
|
|
// 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] _ZWrite("__zw", Float) = 1.0
|
|
[HideInInspector] _Cull("__cull", Float) = 2.0
|
|
|
|
_ReceiveShadows("Receive Shadows", Float) = 1.0
|
|
// Editmode props
|
|
[HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
|
|
|
|
// ObsoleteProperties
|
|
[HideInInspector] _GlossMapScale("Smoothness", Float) = 0.0
|
|
[HideInInspector] _GlossyReflections("EnvironmentReflections", Float) = 0.0
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
PackageRequirements
|
|
{
|
|
"com.unity.render-pipelines.universal": "12.0"
|
|
}
|
|
|
|
// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
|
|
// this Subshader will fail. One can add a subshader below or fallback to Standard built-in to make this
|
|
// material work with both Universal Render Pipeline and Builtin Unity Pipeline
|
|
Tags{"RenderType" = "Opaque" "Queue"="Geometry-10" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True"}
|
|
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"}
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard SRP library
|
|
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma target 2.0
|
|
|
|
// -------------------------------------
|
|
// Material Keywords
|
|
#pragma shader_feature _NORMALMAP
|
|
#pragma shader_feature _ALPHATEST_ON
|
|
#pragma shader_feature _ALPHAPREMULTIPLY_ON
|
|
#pragma shader_feature _EMISSION
|
|
#pragma shader_feature _METALLICSPECGLOSSMAP
|
|
#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
|
#pragma shader_feature _OCCLUSIONMAP
|
|
|
|
#pragma shader_feature _SPECULARHIGHLIGHTS_OFF
|
|
#pragma shader_feature _ENVIRONMENTREFLECTIONS_OFF
|
|
#pragma shader_feature _SPECULAR_SETUP
|
|
#pragma shader_feature _RECEIVE_SHADOWS_OFF
|
|
|
|
// -------------------------------------
|
|
// Universal Pipeline keywords
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
|
|
#pragma multi_compile _ _SHADOWS_SOFT
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
|
|
// -------------------------------------
|
|
// Unity defined keywords
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile_fog
|
|
|
|
//--------------------------------------
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
//--------------------------------------
|
|
// Unity Simulation keywords
|
|
#pragma multi_compile _ XRAY_ENABLED
|
|
#pragma multi_compile _ XRAY_FLIP_DEPTH
|
|
#define INCLUDE_RENDER_PIPELINES_UNIVERSAL
|
|
|
|
#pragma vertex LitPassVertex
|
|
#pragma fragment XRayLitPassFragment
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
|
|
#include "XRayURPForwardPass.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
// ------------------------------------------------------------------
|
|
// Forward pass. No Lights X-Ray faded edge
|
|
Pass
|
|
{
|
|
// Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
|
|
// no LightMode tag are also rendered by Universal Render Pipeline
|
|
Name "ForwardUnlit"
|
|
|
|
blend srcalpha oneminussrcalpha
|
|
ZWrite On
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard SRP library
|
|
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma target 2.0
|
|
|
|
// -------------------------------------
|
|
// Material Keywords
|
|
#pragma shader_feature _NORMALMAP
|
|
#pragma shader_feature _ALPHATEST_ON
|
|
#pragma shader_feature _ALPHAPREMULTIPLY_ON
|
|
#pragma shader_feature _EMISSION
|
|
#pragma shader_feature _METALLICSPECGLOSSMAP
|
|
#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
|
#pragma shader_feature _OCCLUSIONMAP
|
|
|
|
#pragma shader_feature _SPECULARHIGHLIGHTS_OFF
|
|
#pragma shader_feature _ENVIRONMENTREFLECTIONS_OFF
|
|
#pragma shader_feature _SPECULAR_SETUP
|
|
#pragma shader_feature _RECEIVE_SHADOWS_OFF
|
|
|
|
// -------------------------------------
|
|
// Universal Pipeline keywords
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
|
|
#pragma multi_compile _ _SHADOWS_SOFT
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
|
|
// -------------------------------------
|
|
// Unity defined keywords
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile_fog
|
|
|
|
//--------------------------------------
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
//--------------------------------------
|
|
// Unity Simulation keywords
|
|
#pragma multi_compile _ XRAY_ENABLED
|
|
#pragma multi_compile _ XRAY_FLIP_DEPTH
|
|
#define INCLUDE_RENDER_PIPELINES_UNIVERSAL
|
|
|
|
#pragma vertex LitPassVertex
|
|
#pragma fragment XRayUnLitPassFragment
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
|
|
#include "XRayURPForwardPass.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
|
UsePass "Universal Render Pipeline/Lit/DepthOnly"
|
|
// This pass it not used during regular rendering, only for lightmap baking.
|
|
UsePass "Universal Render Pipeline/Lit/Meta"
|
|
UsePass "Universal Render Pipeline/Lit/Universal2D"
|
|
}
|
|
|
|
Fallback "Simulation/Legacy/Standard"
|
|
CustomEditor "UnityEditor.XR.Simulation.Rendering.MaterialInspector"
|
|
}
|