InTerra_TerrainLit_2022_2.shader 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. //NOTE! This file is based on Unity file "TerrainLit.shader" which was used as a template for adding all the InTerra features.
  2. Shader "InTerra/HDRP/Terrain (Lit with Features) 2022.2"
  3. {
  4. Properties
  5. {
  6. [HideInInspector] [ToggleUI] _EnableHeightBlend("EnableHeightBlend", Float) = 0.0
  7. _HeightTransition("Height Transition", Range(0, 60)) = 0.0
  8. [HideInInspector] [Enum(Off, 0, From Ambient Occlusion, 1)] _SpecularOcclusionMode("Specular Occlusion Mode", Int) = 1
  9. [HideInInspector][PerRendererData] _NumLayersCount("Total Layer Count", Float) = 1.0
  10. // Following are builtin properties
  11. // Stencil state
  12. // Forward
  13. [HideInInspector] _StencilRef("_StencilRef", Int) = 0 // StencilUsage.Clear
  14. [HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 3 // StencilUsage.RequiresDeferredLighting | StencilUsage.SubsurfaceScattering
  15. // GBuffer
  16. [HideInInspector] _StencilRefGBuffer("_StencilRefGBuffer", Int) = 2 // StencilUsage.RequiresDeferredLighting
  17. [HideInInspector] _StencilWriteMaskGBuffer("_StencilWriteMaskGBuffer", Int) = 3 // StencilUsage.RequiresDeferredLighting | StencilUsage.SubsurfaceScattering
  18. // Depth prepass
  19. [HideInInspector] _StencilRefDepth("_StencilRefDepth", Int) = 0 // Nothing
  20. [HideInInspector] _StencilWriteMaskDepth("_StencilWriteMaskDepth", Int) = 8 // StencilUsage.TraceReflectionRay
  21. // Blending state
  22. [HideInInspector] _ZWrite ("__zw", Float) = 1.0
  23. [HideInInspector][ToggleUI] _TransparentZWrite("_TransparentZWrite", Float) = 0.0
  24. [HideInInspector] _CullMode("__cullmode", Float) = 2.0
  25. [HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
  26. [HideInInspector] _ZTestGBuffer("_ZTestGBuffer", Int) = 4
  27. [ToggleUI] _EnableInstancedPerPixelNormal("Instanced per pixel normal", Float) = 1.0
  28. [HideInInspector] _TerrainHolesTexture("Holes Map (RGB)", 2D) = "white" {}
  29. // Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
  30. // value that exist to identify if the GI emission need to be enabled.
  31. // 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.
  32. // TODO: Fix the code in legacy unity so we can customize the behavior for GI
  33. [HideInInspector] _EmissionColor("Color", Color) = (1, 1, 1)
  34. // 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.
  35. [HideInInspector] _MainTex("Albedo", 2D) = "white" {}
  36. [HideInInspector] _Color("Color", Color) = (1,1,1,1)
  37. [HideInInspector] [ToggleUI] _SupportDecals("Support Decals", Float) = 1.0
  38. [HideInInspector] [ToggleUI] _ReceivesSSR("Receives SSR", Float) = 1.0
  39. [HideInInspector] [ToggleUI] _AddPrecomputedVelocity("AddPrecomputedVelocity", Float) = 0.0
  40. //inTerra
  41. _HT_distance("Distance", vector) = (3,10,0,25)
  42. _HT_distance_scale("Scale", Range(0,0.5)) = 0.25
  43. _HT_cover("Cover strenght", Range(0,1)) = 0.6
  44. _Distance_HeightTransition("Distance Height blending Sharpness ", Range(0,60)) = 10
  45. _TriplanarSharpness("Triplanar Sharpness", Range(4,10)) = 9
  46. _ParallaxAffineStepsTerrain("", Float) = 3
  47. _MipMapFade("Parallax MipMap fade", vector) = (4,15,0,30)
  48. _MipMapLevel("Parallax MipMap level", Float) = 0
  49. _TriplanarOneToAllSteep("", Float) = 0
  50. _TerrainColorTintTexture("Color Tint Texture", 2D) = "white" {}
  51. _TerrainColorTintStrenght("Color Tint Strenght", Range(1, 0)) = 0
  52. _TerrainNormalTintTexture("Additional Normal Texture", 2D) = "bump" {}
  53. _TerrainNormalTintStrenght("Additional Normal Strenght", Range(0, 1)) = 0.0
  54. _TerrainNormalTintDistance("Additional Normal Distance", vector) = (3,10,0,25)
  55. [HideInInspector] _TerrainSizeXZPosY("", Vector) = (0,0,0)
  56. _TrackAO("", Range(0,1)) = 0.8
  57. _TrackTessallation("", Range(0,1)) = 0
  58. _TrackEdgeNormals("Track Edge Normals", Float) = 2
  59. _TrackDetailTexture("Track Color Detail Texture", 2D) = "white" {}
  60. [Normal] _TrackDetailNormalTexture("Track Normal Detail Texture", 2D) = "bump" {}
  61. _TrackDetailNormalStrenght("Track Detail Normal Strenght", Float) = 1
  62. _TrackNormalStrenght("Track Normal Strenght", Float) = 1
  63. _TrackEdgeSharpness("Track Edge Normals", Range(0.001,4)) = 1
  64. _TrackHeightOffset("Track Heightmap Offset", Range(-1,1)) = 0
  65. _TrackMultiplyStrenght("Track Multiply strenght", Float) = 3
  66. _TrackHeightTransition("Track Normal Strenght", Range(0, 60)) = 20
  67. _ParallaxTrackAffineSteps("", Float) = 3
  68. _ParallaxTrackSteps("", Float) = 5
  69. _Gamma("", Float) = 0
  70. _WorldMapping("", Float) = 0
  71. _HeightmapBlending("", Float) = 1
  72. _Terrain_Parallax("", Float) = 0
  73. _Tracks("", Float) = 0
  74. [KeywordEnum(Two, Four, Eight, Sixteen)] _Layers("Layers",int) = 2
  75. }
  76. HLSLINCLUDE
  77. #pragma target 4.5
  78. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  79. // Terrain builtin keywords
  80. #pragma shader_feature_local _TERRAIN_8_LAYERS
  81. #define _NORMALMAP
  82. #define _MASKMAP
  83. #pragma shader_feature_local _SPECULAR_OCCLUSION_NONE
  84. // Sample normal in pixel shader when doing instancing
  85. #pragma shader_feature_local _TERRAIN_INSTANCED_PERPIXEL_NORMAL
  86. #pragma shader_feature_local _DISABLE_DECALS
  87. #pragma shader_feature_local _ADD_PRECOMPUTED_VELOCITY
  88. #pragma multi_compile _ _ALPHATEST_ON
  89. // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass
  90. #define _DEFERRED_CAPABLE_MATERIAL
  91. // InTerra Keywords
  92. #pragma shader_feature_local __ _TERRAIN_TRIPLANAR_ONE _TERRAIN_TRIPLANAR
  93. #pragma shader_feature_local_fragment _TERRAIN_DISTANCEBLEND
  94. #pragma shader_feature_local __ _LAYERS_TWO _LAYERS_EIGHT _LAYERS_SIXTEEN
  95. #define INTERRA_TERRAIN
  96. #define UNITY_2022_2_OR_NEWER
  97. #include "InTerra_TerrainLit_Splatmap_Includes.hlsl"
  98. ENDHLSL
  99. SubShader
  100. {
  101. PackageRequirements { "com.unity.render-pipelines.high-definition":"[14.0.0,14.99.99]" }
  102. // This tags allow to use the shader replacement features
  103. Tags
  104. {
  105. "RenderPipeline" = "HDRenderPipeline"
  106. "RenderType" = "Opaque"
  107. "SplatCount" = "16"
  108. "MaskMapR" = "Metallic"
  109. "MaskMapG" = "AO"
  110. "MaskMapB" = "Height"
  111. "MaskMapA" = "Smoothness"
  112. "DiffuseA" = "Smoothness (becomes Density when Mask map is assigned)" // when MaskMap is disabled
  113. "DiffuseA_MaskMapUsed" = "Density" // when MaskMap is enabled
  114. "TerrainCompatible" = "True"
  115. }
  116. // Caution: The outline selection in the editor use the vertex shader/hull/domain shader of the first pass declare. So it should not bethe meta pass.
  117. Pass
  118. {
  119. Name "GBuffer"
  120. Tags { "LightMode" = "GBuffer" } // This will be only for opaque object based on the RenderQueue index
  121. Cull [_CullMode]
  122. ZTest [_ZTestGBuffer]
  123. Stencil
  124. {
  125. WriteMask [_StencilWriteMaskGBuffer]
  126. Ref [_StencilRefGBuffer]
  127. Comp Always
  128. Pass Replace
  129. }
  130. HLSLPROGRAM
  131. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  132. // All our shaders use same name for entry point
  133. #pragma vertex Vert
  134. #pragma fragment Frag
  135. //enable GPU instancing support
  136. #pragma multi_compile_instancing
  137. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  138. #pragma multi_compile _ DEBUG_DISPLAY
  139. #pragma multi_compile _ LIGHTMAP_ON
  140. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  141. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  142. #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK
  143. #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  144. // Setup DECALS_OFF so the shader stripper can remove variants
  145. #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT
  146. #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT
  147. #pragma multi_compile_fragment _ LIGHT_LAYERS
  148. #define SHADERPASS SHADERPASS_GBUFFER
  149. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  150. #include "InTerra_TerrainLitTemplate.hlsl"
  151. #include "InTerra_TerrainLit_Splatmap.hlsl"
  152. ENDHLSL
  153. }
  154. // Extracts information for lightmapping, GI (emission, albedo, ...)
  155. // This pass it not used during regular rendering.
  156. Pass
  157. {
  158. Name "META"
  159. Tags{ "LightMode" = "META" }
  160. Cull Off
  161. HLSLPROGRAM
  162. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  163. // All our shaders use same name for entry point
  164. #pragma vertex Vert
  165. #pragma fragment Frag
  166. //enable GPU instancing support
  167. #pragma multi_compile_instancing
  168. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  169. // Lightmap memo
  170. // 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,
  171. // both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON.
  172. #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
  173. #pragma shader_feature EDITOR_VISUALIZATION
  174. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  175. #include "InTerra_TerrainLitTemplate.hlsl"
  176. #include "InTerra_TerrainLit_Splatmap.hlsl"
  177. ENDHLSL
  178. }
  179. Pass
  180. {
  181. Name "ShadowCaster"
  182. Tags{ "LightMode" = "ShadowCaster" }
  183. Cull[_CullMode]
  184. ZClip [_ZClip]
  185. ZWrite On
  186. ZTest LEqual
  187. ColorMask 0
  188. HLSLPROGRAM
  189. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  190. // All our shaders use same name for entry point
  191. #pragma vertex Vert
  192. #pragma fragment Frag
  193. //enable GPU instancing support
  194. #pragma multi_compile_instancing
  195. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  196. #define SHADERPASS SHADERPASS_SHADOWS
  197. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  198. #include "InTerra_TerrainLitTemplate.hlsl"
  199. #include "InTerra_TerrainLit_Splatmap.hlsl"
  200. ENDHLSL
  201. }
  202. Pass
  203. {
  204. Name "DepthOnly"
  205. Tags{ "LightMode" = "DepthOnly" }
  206. Cull[_CullMode]
  207. // To be able to tag stencil with disableSSR information for forward
  208. Stencil
  209. {
  210. WriteMask [_StencilWriteMaskDepth]
  211. Ref [_StencilRefDepth]
  212. Comp Always
  213. Pass Replace
  214. }
  215. ZWrite On
  216. HLSLPROGRAM
  217. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  218. // All our shaders use same name for entry point
  219. #pragma vertex Vert
  220. #pragma fragment Frag
  221. //enable GPU instancing support
  222. #pragma multi_compile_instancing
  223. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  224. // In deferred, depth only pass don't output anything.
  225. // In forward it output the normal buffer
  226. #pragma multi_compile _ WRITE_NORMAL_BUFFER
  227. #pragma multi_compile_fragment _ WRITE_DECAL_BUFFER
  228. #pragma multi_compile _ WRITE_MSAA_DEPTH
  229. #define SHADERPASS SHADERPASS_DEPTH_ONLY
  230. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  231. #include "InTerra_TerrainLitTemplate.hlsl"
  232. #ifdef WRITE_NORMAL_BUFFER
  233. #if defined(_NORMALMAP)
  234. #define OVERRIDE_SPLAT_SAMPLER_NAME sampler_Normal0
  235. #elif defined(_MASKMAP)
  236. #define OVERRIDE_SPLAT_SAMPLER_NAME sampler_Mask0
  237. #endif
  238. #endif
  239. #include "InTerra_TerrainLit_Splatmap.hlsl"
  240. ENDHLSL
  241. }
  242. Pass
  243. {
  244. Name "Forward"
  245. Tags { "LightMode" = "Forward" } // This will be only for transparent object based on the RenderQueue index
  246. Stencil
  247. {
  248. WriteMask [_StencilWriteMask]
  249. Ref [_StencilRef]
  250. Comp Always
  251. Pass Replace
  252. }
  253. // In case of forward we want to have depth equal for opaque mesh
  254. ZTest [_ZTestDepthEqualForOpaque]
  255. ZWrite [_ZWrite]
  256. Cull [_CullMode]
  257. HLSLPROGRAM
  258. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  259. // All our shaders use same name for entry point
  260. #pragma vertex Vert
  261. #pragma fragment Frag
  262. //enable GPU instancing support
  263. #pragma multi_compile_instancing
  264. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  265. #pragma multi_compile _ DEBUG_DISPLAY
  266. #pragma multi_compile _ LIGHTMAP_ON
  267. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  268. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  269. #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK
  270. #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  271. #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON
  272. // Setup DECALS_OFF so the shader stripper can remove variants
  273. #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT
  274. #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT
  275. // Supported shadow modes per light type
  276. #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH
  277. #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH
  278. #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
  279. #define SHADERPASS SHADERPASS_FORWARD
  280. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  281. #include "InTerra_TerrainLitTemplate.hlsl"
  282. #include "InTerra_TerrainLit_Splatmap.hlsl"
  283. ENDHLSL
  284. }
  285. Pass
  286. {
  287. Name "SceneSelectionPass"
  288. Tags { "LightMode" = "SceneSelectionPass" }
  289. Cull Off
  290. HLSLPROGRAM
  291. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  292. // All our shaders use same name for entry point
  293. #pragma vertex Vert
  294. #pragma fragment Frag
  295. //enable GPU instancing support
  296. #pragma multi_compile_instancing
  297. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  298. #pragma editor_sync_compilation
  299. #define SHADERPASS SHADERPASS_DEPTH_ONLY
  300. #define SCENESELECTIONPASS
  301. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  302. #include "InTerra_TerrainLitTemplate.hlsl"
  303. #include "InTerra_TerrainLit_Splatmap.hlsl"
  304. ENDHLSL
  305. }
  306. UsePass "Hidden/Nature/Terrain/Utilities/PICKING"
  307. }
  308. SubShader
  309. {
  310. PackageRequirements { "com.unity.render-pipelines.high-definition":"[14.0.0,16.0.0]" }
  311. // This tags allow to use the shader replacement features
  312. Tags
  313. {
  314. "RenderPipeline" = "HDRenderPipeline"
  315. "RenderType" = "Opaque"
  316. "SplatCount" = "8"
  317. "MaskMapR" = "Metallic"
  318. "MaskMapG" = "AO"
  319. "MaskMapB" = "Height"
  320. "MaskMapA" = "Smoothness"
  321. "DiffuseA" = "Smoothness (becomes Density when Mask map is assigned)" // when MaskMap is disabled
  322. "DiffuseA_MaskMapUsed" = "Density" // when MaskMap is enabled
  323. "TerrainCompatible" = "True"
  324. }
  325. Pass
  326. {
  327. Name "IndirectDXR"
  328. Tags{ "LightMode" = "IndirectDXR" }
  329. HLSLPROGRAM
  330. #pragma only_renderers d3d11 xboxseries ps5
  331. #pragma raytracing surface_shader
  332. #pragma multi_compile _ DEBUG_DISPLAY
  333. #pragma multi_compile _ LIGHTMAP_ON
  334. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  335. #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  336. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  337. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  338. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  339. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  340. #define SHADERPASS SHADERPASS_RAYTRACING_INDIRECT
  341. // multi compile that allows us to strip the recursive code
  342. #pragma multi_compile _ MULTI_BOUNCE_INDIRECT
  343. #define SHADOW_LOW
  344. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  345. #undef _TERRAIN_PARALLAX
  346. #undef PARALLAX
  347. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  348. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl"
  349. ENDHLSL
  350. }
  351. Pass
  352. {
  353. Name "ForwardDXR"
  354. Tags{ "LightMode" = "ForwardDXR" }
  355. HLSLPROGRAM
  356. #pragma only_renderers d3d11 xboxseries ps5
  357. #pragma raytracing surface_shader
  358. #pragma multi_compile _ DEBUG_DISPLAY
  359. #pragma multi_compile _ LIGHTMAP_ON
  360. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  361. #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  362. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  363. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  364. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  365. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  366. #define SHADERPASS SHADERPASS_RAYTRACING_FORWARD
  367. // multi compile that allows us to strip the recursive code
  368. #define SHADOW_LOW
  369. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  370. #undef _TERRAIN_PARALLAX
  371. #undef PARALLAX
  372. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  373. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl"
  374. ENDHLSL
  375. }
  376. Pass
  377. {
  378. Name "GBufferDXR"
  379. Tags{ "LightMode" = "GBufferDXR" }
  380. HLSLPROGRAM
  381. #pragma only_renderers d3d11 xboxseries ps5
  382. #pragma raytracing surface_shader
  383. #pragma multi_compile _ DEBUG_DISPLAY
  384. #pragma multi_compile _ LIGHTMAP_ON
  385. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  386. #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  387. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  388. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  389. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  390. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  391. #define SHADERPASS SHADERPASS_RAYTRACING_GBUFFER
  392. #pragma multi_compile _ MINIMAL_GBUFFER
  393. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  394. #undef _TERRAIN_PARALLAX
  395. #undef PARALLAX
  396. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  397. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl"
  398. ENDHLSL
  399. }
  400. Pass
  401. {
  402. Name "VisibilityDXR"
  403. Tags{ "LightMode" = "VisibilityDXR" }
  404. HLSLPROGRAM
  405. #pragma only_renderers d3d11 xboxseries ps5
  406. #pragma raytracing surface_shader
  407. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  408. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  409. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  410. #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY
  411. #pragma multi_compile _ TRANSPARENT_COLOR_SHADOW
  412. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  413. #undef _TERRAIN_PARALLAX
  414. #undef PARALLAX
  415. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  416. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl"
  417. ENDHLSL
  418. }
  419. Pass
  420. {
  421. Name "DebugDXR"
  422. Tags{ "LightMode" = "DebugDXR" }
  423. HLSLPROGRAM
  424. #pragma only_renderers d3d11 xboxseries ps5
  425. #pragma raytracing surface_shader
  426. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  427. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  428. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  429. #define SHADERPASS SHADERPASS_RAYTRACING_DEBUG
  430. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
  431. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl"
  432. #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"
  434. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl"
  435. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingDebug.hlsl"
  436. ENDHLSL
  437. }
  438. Pass
  439. {
  440. Name "PathTracingDXR"
  441. Tags{ "LightMode" = "PathTracingDXR" }
  442. HLSLPROGRAM
  443. #pragma only_renderers d3d11 xboxseries ps5
  444. #pragma raytracing surface_shader
  445. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  446. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  447. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  448. #define SHADERPASS SHADERPASS_PATH_TRACING
  449. #pragma multi_compile _ DEBUG_DISPLAY
  450. #pragma multi_compile _ SENSORSDK_OVERRIDE_REFLECTANCE
  451. #ifdef SENSORSDK_OVERRIDE_REFLECTANCE
  452. #define SENSORSDK_ENABLE_LIDAR
  453. #endif
  454. // This is just because it needs to be defined, shadow maps are not used.
  455. #define SHADOW_LOW
  456. // For all single-sided, refractive materials, we want to force a thin refraction model.
  457. #if !defined(_DOUBLESIDED_ON) && (defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE))
  458. #undef _REFRACTION_PLANE
  459. #undef _REFRACTION_SPHERE
  460. #define _REFRACTION_THIN
  461. #endif
  462. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  463. #undef _TERRAIN_PARALLAX
  464. #undef PARALLAX
  465. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  466. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl"
  467. ENDHLSL
  468. }
  469. }
  470. Dependency "BaseMapShader" = "Hidden/InTerra/HDRP/TerrainLit_Basemap_2022_2"
  471. Dependency "BaseMapGenShader" = "Hidden/InTerra/HDRP/TerrainLit_BasemapGen"
  472. CustomEditor "InTerra.InTerra_TerrainShaderGUI"
  473. }