OSDN Git Service

Added Assets for main menu
[mindgames/Mindgames_main.git] / Mindgames / Library / PackageCache / com.unity.render-pipelines.high-definition@6.9.0-preview / Runtime / Material / Unlit / Unlit.shader
1 Shader "HDRP/Unlit"
2 {
3     Properties
4     {
5         // Versioning of material to help for upgrading
6         [HideInInspector] _HdrpVersion("_HdrpVersion", Float) = 2
7
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" {}
11
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
22
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
39
40         // Transparency
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
44
45         // Blending state
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
58
59         [ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 0.0
60         [ToggleUI] _DoubleSidedEnable("Double sided enable", Float) = 0.0
61
62         // Stencil state
63         [HideInInspector] _StencilRef("_StencilRef", Int) = 0 // StencilLightingUsage.NoLighting
64         [HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 3 // StencilMask.Lighting
65         // Depth prepass
66         [HideInInspector] _StencilRefDepth("_StencilRefDepth", Int) = 0 // Nothing
67         [HideInInspector] _StencilWriteMaskDepth("_StencilWriteMaskDepth", Int) = 32 // DoesntReceiveSSR
68         // Motion vector pass
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
74
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)
80
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
84
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
89     }
90
91     HLSLINCLUDE
92
93     #pragma target 4.5
94     #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
95
96     //-------------------------------------------------------------------------------------
97     // Variant
98     //-------------------------------------------------------------------------------------
99
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
102
103     #pragma shader_feature_local _EMISSIVE_COLOR_MAP
104
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
109
110     //enable GPU instancing support
111     #pragma multi_compile_instancing
112
113     //-------------------------------------------------------------------------------------
114     // Define
115     //-------------------------------------------------------------------------------------
116
117     //-------------------------------------------------------------------------------------
118     // Include
119     //-------------------------------------------------------------------------------------
120
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"
125
126     //-------------------------------------------------------------------------------------
127     // variable declaration
128     //-------------------------------------------------------------------------------------
129
130     #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitProperties.hlsl"
131
132     ENDHLSL
133
134     SubShader
135     {
136         // This tags allow to use the shader replacement features
137         Tags{ "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDUnlitShader" }
138
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.
140
141         Pass
142         {
143             Name "SceneSelectionPass"
144             Tags{ "LightMode" = "SceneSelectionPass" }
145
146             Cull[_CullMode]
147
148             ZWrite On
149
150             HLSLPROGRAM
151
152             // Note: Require _ObjectId and _PassValue variables
153
154             #define SHADERPASS SHADERPASS_DEPTH_ONLY
155             #define SCENESELECTIONPASS // This will drive the output of the scene selection shader
156
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"
162
163             #pragma vertex Vert
164             #pragma fragment Frag
165
166             #pragma editor_sync_compilation
167
168             ENDHLSL
169         }
170
171         Pass
172         {
173             Name "DepthForwardOnly"
174             Tags{ "LightMode" = "DepthForwardOnly" }
175
176             Stencil
177             {
178                 WriteMask [_StencilWriteMaskDepth]
179                 Ref  [_StencilRefDepth]
180                 Comp Always
181                 Pass Replace
182             }
183
184             Cull[_CullMode]
185
186             ZWrite On
187
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
191             ColorMask 0 0
192
193             HLSLPROGRAM
194             #pragma multi_compile _ WRITE_MSAA_DEPTH
195             // Note we don't need to define WRITE_NORMAL_BUFFER
196
197             #define SHADERPASS SHADERPASS_DEPTH_ONLY
198
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"
204
205             #pragma vertex Vert
206             #pragma fragment Frag
207
208             ENDHLSL
209         }
210
211
212         Pass
213         {
214             Name "MotionVectors"
215             Tags{ "LightMode" = "MotionVectors" } // Caution, this need to be call like this to setup the correct parameters by C++ (legacy Unity)
216
217             // If velocity pass (motion vectors) is enabled we tag the stencil so it don't perform CameraMotionVelocity
218             Stencil
219             {
220                 WriteMask [_StencilWriteMaskMV]
221                 Ref [_StencilRefMV]
222                 Comp Always
223                 Pass Replace
224             }
225
226             Cull[_CullMode]
227
228             ZWrite On
229
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
233             ColorMask 0 1
234
235             HLSLPROGRAM
236             #pragma multi_compile _ WRITE_MSAA_DEPTH
237             // Note we don't need to define WRITE_NORMAL_BUFFER
238
239             #define SHADERPASS SHADERPASS_MOTION_VECTORS
240
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"
247
248             #pragma vertex Vert
249             #pragma fragment Frag
250
251             ENDHLSL
252         }
253
254         // Unlit shader always render in forward
255         Pass
256         {
257             Name "ForwardOnly"
258             Tags { "LightMode" = "ForwardOnly" }
259
260             Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
261             ZWrite [_ZWrite]
262             ZTest [_ZTestDepthEqualForOpaque]
263
264             Stencil
265             {
266                 WriteMask[_StencilWriteMask]
267                 Ref[_StencilRef]
268                 Comp Always
269                 Pass Replace
270             }
271
272             Cull [_CullMode]
273
274             HLSLPROGRAM
275
276             #pragma multi_compile _ DEBUG_DISPLAY
277
278             #ifdef DEBUG_DISPLAY
279             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
280             #endif
281
282             #define SHADERPASS SHADERPASS_FORWARD_UNLIT
283
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"
289
290             #pragma vertex Vert
291             #pragma fragment Frag
292
293             ENDHLSL
294         }
295
296         // Extracts information for lightmapping, GI (emission, albedo, ...)
297         // This pass it not used during regular rendering.
298         Pass
299         {
300             Name "META"
301             Tags{ "LightMode" = "META" }
302
303             Cull Off
304
305             HLSLPROGRAM
306
307             // Lightmap memo
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.
310
311             #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
312
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"
318
319             #pragma vertex Vert
320             #pragma fragment Frag
321
322             ENDHLSL
323         }
324
325         Pass
326         {
327             Name "ShadowCaster"
328             Tags{ "LightMode" = "ShadowCaster" }
329
330             Cull[_CullMode]
331
332             ZClip [_ZClip]
333             ZWrite On
334             ZTest LEqual
335
336             ColorMask 0
337
338             HLSLPROGRAM
339
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"
346
347             #pragma vertex Vert
348             #pragma fragment Frag
349
350             ENDHLSL
351         }
352
353         Pass
354         {
355             Name "DistortionVectors"
356             Tags { "LightMode" = "DistortionVectors" } // This will be only for transparent object based on the RenderQueue index
357
358             Stencil
359             {
360                 WriteMask [_StencilRefDistortionVec]
361                 Ref [_StencilRefDistortionVec]
362                 Comp Always
363                 Pass Replace
364             }
365
366             Blend [_DistortionSrcBlend] [_DistortionDstBlend], [_DistortionBlurSrcBlend] [_DistortionBlurDstBlend]
367             BlendOp Add, [_DistortionBlurBlendOp]
368             ZTest [_ZTestModeDistortion]
369             ZWrite off
370             Cull [_CullMode]
371
372             HLSLPROGRAM
373
374             #define SHADERPASS SHADERPASS_DISTORTION
375
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"
381
382             #pragma vertex Vert
383             #pragma fragment Frag
384
385             ENDHLSL
386         }
387     }
388
389     SubShader
390     {
391         Pass
392         {
393             Name "IndirectDXR"
394             Tags{ "LightMode" = "IndirectDXR" }
395
396             HLSLPROGRAM
397
398             #pragma raytracing test
399
400             #define SHADERPASS SHADERPASS_RAYTRACING_INDIRECT
401
402             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
403
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"
406
407             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
408
409             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
410
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"
413
414             ENDHLSL
415         }
416
417         Pass
418         {
419             Name "ForwardDXR"
420             Tags{ "LightMode" = "ForwardDXR" }
421
422             HLSLPROGRAM
423             
424             #pragma raytracing test
425
426             #define SHADERPASS SHADERPASS_RAYTRACING_FORWARD
427
428             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
429
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"
432
433             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
434
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"
438
439             ENDHLSL
440         }
441
442         Pass
443         {
444             Name "VisibilityDXR"
445             Tags{ "LightMode" = "VisibilityDXR" }
446
447             HLSLPROGRAM
448
449             #pragma raytracing test
450
451             #define SHADOW_LOW
452
453             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
454
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"
457
458             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
459
460             #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.hlsl"
461
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"
464
465             ENDHLSL
466         }
467     }
468
469     CustomEditor "Experimental.Rendering.HDPipeline.UnlitGUI"
470 }