5 // Versioning of material to help for upgrading
6 [HideInInspector] _HdrpVersion("_HdrpVersion", Float) = 2
8 // Be careful, do not change the name here to _Color. It will conflict with the "fake" parameters (see end of properties) required for GI.
9 _UnlitColor("Color", Color) = (1,1,1,1)
10 _UnlitColorMap("ColorMap", 2D) = "white" {}
12 [HDR] _EmissiveColor("EmissiveColor", Color) = (0, 0, 0)
13 _EmissiveColorMap("EmissiveColorMap", 2D) = "white" {}
14 // Used only to serialize the LDR and HDR emissive color in the material UI,
15 // in the shader only the _EmissiveColor should be used
16 [HideInInspector] _EmissiveColorLDR("EmissiveColor LDR", Color) = (0, 0, 0)
17 [ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0
18 [HideInInspector] _EmissiveIntensityUnit("Emissive Mode", Int) = 0
19 [ToggleUI] _UseEmissiveIntensity("Use Emissive Intensity", Int) = 0
20 _EmissiveIntensity("Emissive Intensity", Float) = 1
21 _EmissiveExposureWeight("Emissive Pre Exposure", Range(0.0, 1.0)) = 1.0
23 _DistortionVectorMap("DistortionVectorMap", 2D) = "black" {}
24 [ToggleUI] _DistortionEnable("Enable Distortion", Float) = 0.0
25 [ToggleUI] _DistortionOnly("Distortion Only", Float) = 0.0
26 [ToggleUI] _DistortionDepthTest("Distortion Depth Test Enable", Float) = 1.0
27 [Enum(Add, 0, Multiply, 1, Replace, 2)] _DistortionBlendMode("Distortion Blend Mode", Int) = 0
28 [HideInInspector] _DistortionSrcBlend("Distortion Blend Src", Int) = 0
29 [HideInInspector] _DistortionDstBlend("Distortion Blend Dst", Int) = 0
30 [HideInInspector] _DistortionBlurSrcBlend("Distortion Blur Blend Src", Int) = 0
31 [HideInInspector] _DistortionBlurDstBlend("Distortion Blur Blend Dst", Int) = 0
32 [HideInInspector] _DistortionBlurBlendMode("Distortion Blur Blend Mode", Int) = 0
33 _DistortionScale("Distortion Scale", Float) = 1
34 _DistortionVectorScale("Distortion Vector Scale", Float) = 2
35 _DistortionVectorBias("Distortion Vector Bias", Float) = -1
36 _DistortionBlurScale("Distortion Blur Scale", Float) = 1
37 _DistortionBlurRemapMin("DistortionBlurRemapMin", Float) = 0.0
38 _DistortionBlurRemapMax("DistortionBlurRemapMax", Float) = 1.0
41 [ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
42 _AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
43 _TransparentSortPriority("_TransparentSortPriority", Float) = 0
46 [HideInInspector] _SurfaceType("__surfacetype", Float) = 0.0
47 [HideInInspector] _BlendMode("__blendmode", Float) = 0.0
48 [HideInInspector] _SrcBlend("__src", Float) = 1.0
49 [HideInInspector] _DstBlend("__dst", Float) = 0.0
50 [HideInInspector] _AlphaSrcBlend("__alphaSrc", Float) = 1.0
51 [HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0
52 [HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0
53 [HideInInspector] _CullMode("__cullmode", Float) = 2.0
54 [Enum(UnityEditor.Experimental.Rendering.HDPipeline.TransparentCullMode)] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default
55 [HideInInspector] _ZTestModeDistortion("_ZTestModeDistortion", Int) = 8
56 [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Transparent ZTest", Int) = 4 // Less equal
57 [HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
59 [ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 0.0
60 [ToggleUI] _DoubleSidedEnable("Double sided enable", Float) = 0.0
63 [HideInInspector] _StencilRef("_StencilRef", Int) = 0 // StencilLightingUsage.NoLighting
64 [HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 3 // StencilMask.Lighting
66 [HideInInspector] _StencilRefDepth("_StencilRefDepth", Int) = 0 // Nothing
67 [HideInInspector] _StencilWriteMaskDepth("_StencilWriteMaskDepth", Int) = 32 // DoesntReceiveSSR
69 [HideInInspector] _StencilRefMV("_StencilRefMV", Int) = 128 // StencilBitMask.ObjectMotionVectors
70 [HideInInspector] _StencilWriteMaskMV("_StencilWriteMaskMV", Int) = 128 // StencilBitMask.ObjectMotionVectors
71 // Distortion vector pass
72 [HideInInspector] _StencilRefDistortionVec("_StencilRefDistortionVec", Int) = 64 // StencilBitMask.DistortionVectors
73 [HideInInspector] _StencilWriteMaskDistortionVec("_StencilWriteMaskDistortionVec", Int) = 64 // StencilBitMask.DistortionVectors
75 // Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
76 // value that exist to identify if the GI emission need to be enabled.
77 // In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.
78 // TODO: Fix the code in legacy unity so we can customize the beahvior for GI
79 _EmissionColor("Color", Color) = (1, 1, 1)
81 // For raytracing indirect illumination effects, we need to be able to define if the emissive part of the material should contribute or not (mainly for area light sources in order to avoid double contribution)
82 // By default, the emissive is contributing
83 [HideInInspector] _IncludeIndirectLighting("_IncludeIndirectLighting", Float) = 1.0
85 // HACK: GI Baking system relies on some properties existing in the shader ("_MainTex", "_Cutoff" and "_Color") for opacity handling, so we need to store our version of those parameters in the hard-coded name the GI baking system recognizes.
86 _MainTex("Albedo", 2D) = "white" {}
87 _Color("Color", Color) = (1,1,1,1)
88 _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
94 #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
96 //-------------------------------------------------------------------------------------
98 //-------------------------------------------------------------------------------------
100 #pragma shader_feature_local _ALPHATEST_ON
101 // #pragma shader_feature_local _DOUBLESIDED_ON - We have no lighting, so no need to have this combination for shader, the option will just disable backface culling
103 #pragma shader_feature_local _EMISSIVE_COLOR_MAP
105 // Keyword for transparent
106 #pragma shader_feature _SURFACE_TYPE_TRANSPARENT
107 #pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
108 #pragma shader_feature_local _ENABLE_FOG_ON_TRANSPARENT
110 //enable GPU instancing support
111 #pragma multi_compile_instancing
113 //-------------------------------------------------------------------------------------
115 //-------------------------------------------------------------------------------------
117 //-------------------------------------------------------------------------------------
119 //-------------------------------------------------------------------------------------
121 #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
122 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
123 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
124 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
126 //-------------------------------------------------------------------------------------
127 // variable declaration
128 //-------------------------------------------------------------------------------------
130 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitProperties.hlsl"
136 // This tags allow to use the shader replacement features
137 Tags{ "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDUnlitShader" }
139 // Caution: The outline selection in the editor use the vertex shader/hull/domain shader of the first pass declare. So it should not be the meta pass.
143 Name "SceneSelectionPass"
144 Tags{ "LightMode" = "SceneSelectionPass" }
152 // Note: Require _ObjectId and _PassValue variables
154 #define SHADERPASS SHADERPASS_DEPTH_ONLY
155 #define SCENESELECTIONPASS // This will drive the output of the scene selection shader
157 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
158 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
159 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitDepthPass.hlsl"
160 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
161 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl"
164 #pragma fragment Frag
166 #pragma editor_sync_compilation
173 Name "DepthForwardOnly"
174 Tags{ "LightMode" = "DepthForwardOnly" }
178 WriteMask [_StencilWriteMaskDepth]
179 Ref [_StencilRefDepth]
188 // Caution: When using MSAA we have normal and depth buffer bind.
189 // Mean unlit object need to not write in it (or write 0) - Disable color mask for this RT
190 // This is not a problem in no MSAA mode as there is no buffer bind
194 #pragma multi_compile _ WRITE_MSAA_DEPTH
195 // Note we don't need to define WRITE_NORMAL_BUFFER
197 #define SHADERPASS SHADERPASS_DEPTH_ONLY
199 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
200 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
201 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitDepthPass.hlsl"
202 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
203 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl"
206 #pragma fragment Frag
215 Tags{ "LightMode" = "MotionVectors" } // Caution, this need to be call like this to setup the correct parameters by C++ (legacy Unity)
217 // If velocity pass (motion vectors) is enabled we tag the stencil so it don't perform CameraMotionVelocity
220 WriteMask [_StencilWriteMaskMV]
230 // Caution: When using MSAA we have motion vector, normal and depth buffer bind.
231 // Mean unlit object need to not write in it (or write 0) - Disable color mask for this RT
232 // This is not a problem in no MSAA mode as there is no buffer bind
236 #pragma multi_compile _ WRITE_MSAA_DEPTH
237 // Note we don't need to define WRITE_NORMAL_BUFFER
239 #define SHADERPASS SHADERPASS_MOTION_VECTORS
241 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
242 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
243 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
244 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitSharePass.hlsl"
245 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
246 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassMotionVectors.hlsl"
249 #pragma fragment Frag
254 // Unlit shader always render in forward
258 Tags { "LightMode" = "ForwardOnly" }
260 Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
262 ZTest [_ZTestDepthEqualForOpaque]
266 WriteMask[_StencilWriteMask]
276 #pragma multi_compile _ DEBUG_DISPLAY
279 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
282 #define SHADERPASS SHADERPASS_FORWARD_UNLIT
284 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
285 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
286 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitSharePass.hlsl"
287 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
288 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassForwardUnlit.hlsl"
291 #pragma fragment Frag
296 // Extracts information for lightmapping, GI (emission, albedo, ...)
297 // This pass it not used during regular rendering.
301 Tags{ "LightMode" = "META" }
308 // DYNAMICLIGHTMAP_ON is used when we have an "enlighten lightmap" ie a lightmap updated at runtime by enlighten.This lightmap contain indirect lighting from realtime lights and realtime emissive material.Offline baked lighting(from baked material / light,
309 // both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON.
311 #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
313 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
314 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
315 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitSharePass.hlsl"
316 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
317 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassLightTransport.hlsl"
320 #pragma fragment Frag
328 Tags{ "LightMode" = "ShadowCaster" }
340 #define SHADERPASS SHADERPASS_SHADOWS
341 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
342 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
343 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitDepthPass.hlsl"
344 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
345 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl"
348 #pragma fragment Frag
355 Name "DistortionVectors"
356 Tags { "LightMode" = "DistortionVectors" } // This will be only for transparent object based on the RenderQueue index
360 WriteMask [_StencilRefDistortionVec]
361 Ref [_StencilRefDistortionVec]
366 Blend [_DistortionSrcBlend] [_DistortionDstBlend], [_DistortionBlurSrcBlend] [_DistortionBlurDstBlend]
367 BlendOp Add, [_DistortionBlurBlendOp]
368 ZTest [_ZTestModeDistortion]
374 #define SHADERPASS SHADERPASS_DISTORTION
376 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
377 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
378 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/ShaderPass/UnlitDistortionPass.hlsl"
379 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl"
380 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDistortion.hlsl"
383 #pragma fragment Frag
394 Tags{ "LightMode" = "IndirectDXR" }
398 #pragma raytracing test
400 #define SHADERPASS SHADERPASS_RAYTRACING_INDIRECT
402 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
404 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
405 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
407 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
409 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
411 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitRaytracingData.hlsl"
412 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl"
420 Tags{ "LightMode" = "ForwardDXR" }
424 #pragma raytracing test
426 #define SHADERPASS SHADERPASS_RAYTRACING_FORWARD
428 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
430 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
431 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
433 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
435 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
436 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitRaytracingData.hlsl"
437 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderpassRaytracingForward.hlsl"
445 Tags{ "LightMode" = "VisibilityDXR" }
449 #pragma raytracing test
453 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
455 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
456 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
458 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
460 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
462 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitRaytracingData.hlsl"
463 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderpassRaytracingVisibility.hlsl"
469 CustomEditor "Experimental.Rendering.HDPipeline.UnlitGUI"