InTerra_TerrainLit_2023_1.shader 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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) 2023.1 or Heigher"
  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. _HeightmapBlending("", Float) = 1
  57. _TrackAO("", Range(0,1)) = 0.8
  58. _TrackTessallation("", Range(0,1)) = 0
  59. _TrackEdgeNormals("Track Edge Normals", Float) = 2
  60. _TrackDetailTexture("Track Color Detail Texture", 2D) = "white" {}
  61. [Normal] _TrackDetailNormalTexture("Track Normal Detail Texture", 2D) = "bump" {}
  62. _TrackDetailNormalStrenght("Track Detail Normal Strenght", Float) = 1
  63. _TrackNormalStrenght("Track Normal Strenght", Float) = 1
  64. _TrackEdgeSharpness("Track Edge Normals", Range(0.001,4)) = 1
  65. _TrackHeightOffset("Track Heightmap Offset", Range(-1,1)) = 0
  66. _TrackMultiplyStrenght("Track Multiply strenght", Float) = 3
  67. _TrackHeightTransition("Track Normal Strenght", Range(0, 60)) = 20
  68. _ParallaxTrackAffineSteps("", Float) = 3
  69. _ParallaxTrackSteps("", Float) = 5
  70. _Gamma("", Float) = 0
  71. _WorldMapping("", Float) = 0
  72. _HeightmapBlending("", Float) = 1
  73. _Terrain_Parallax("", Float) = 0
  74. _Tracks("", Float) = 0
  75. [KeywordEnum(Two, Four, Eight, Sixteen)] _Layers("Layers",int) = 2
  76. }
  77. HLSLINCLUDE
  78. #pragma target 4.5
  79. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  80. // Terrain builtin keywords
  81. #pragma shader_feature_local _TERRAIN_8_LAYERS
  82. #define _NORMALMAP
  83. #define _MASKMAP
  84. #pragma shader_feature_local _SPECULAR_OCCLUSION_NONE
  85. // #pragma shader_feature_local _TERRAIN_BLEND_HEIGHT
  86. // Sample normal in pixel shader when doing instancing
  87. #pragma shader_feature_local _TERRAIN_INSTANCED_PERPIXEL_NORMAL
  88. #pragma shader_feature_local _DISABLE_DECALS
  89. #pragma shader_feature_local _ADD_PRECOMPUTED_VELOCITY
  90. #pragma multi_compile _ _ALPHATEST_ON
  91. // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass
  92. #define _DEFERRED_CAPABLE_MATERIAL
  93. // InTerra Keywords
  94. #pragma shader_feature_local __ _TERRAIN_TRIPLANAR_ONE _TERRAIN_TRIPLANAR
  95. #pragma shader_feature_local_fragment _TERRAIN_DISTANCEBLEND
  96. #pragma shader_feature_local __ _LAYERS_TWO _LAYERS_EIGHT _LAYERS_SIXTEEN
  97. #define INTERRA_TERRAIN
  98. #define UNITY_2022_2_OR_NEWER
  99. #include "InTerra_TerrainLit_Splatmap_Includes.hlsl"
  100. ENDHLSL
  101. SubShader
  102. {
  103. PackageRequirements { "com.unity.render-pipelines.high-definition":"[15.0.0,19.0.0]" }
  104. // This tags allow to use the shader replacement features
  105. Tags
  106. {
  107. "RenderPipeline" = "HDRenderPipeline"
  108. "RenderType" = "Opaque"
  109. "SplatCount" = "16"
  110. "MaskMapR" = "Metallic"
  111. "MaskMapG" = "AO"
  112. "MaskMapB" = "Height"
  113. "MaskMapA" = "Smoothness"
  114. "DiffuseA" = "Smoothness (becomes Density when Mask map is assigned)" // when MaskMap is disabled
  115. "DiffuseA_MaskMapUsed" = "Density" // when MaskMap is enabled
  116. "TerrainCompatible" = "True"
  117. }
  118. // 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.
  119. Pass
  120. {
  121. Name "GBuffer"
  122. Tags { "LightMode" = "GBuffer" } // This will be only for opaque object based on the RenderQueue index
  123. Cull [_CullMode]
  124. ZTest [_ZTestGBuffer]
  125. Stencil
  126. {
  127. WriteMask [_StencilWriteMaskGBuffer]
  128. Ref [_StencilRefGBuffer]
  129. Comp Always
  130. Pass Replace
  131. }
  132. HLSLPROGRAM
  133. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  134. // All our shaders use same name for entry point
  135. #pragma vertex Vert
  136. #pragma fragment Frag
  137. //enable GPU instancing support
  138. #pragma multi_compile_instancing
  139. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  140. #pragma multi_compile _ LIGHTMAP_ON
  141. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  142. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  143. #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK
  144. #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  145. // Setup DECALS_OFF so the shader stripper can remove variants
  146. #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT
  147. #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT
  148. #pragma multi_compile_fragment _ RENDERING_LAYERS
  149. #define SHADERPASS SHADERPASS_GBUFFER
  150. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  151. #include "InTerra_TerrainLitTemplate.hlsl"
  152. #include "InTerra_TerrainLit_Splatmap.hlsl"
  153. ENDHLSL
  154. }
  155. // Extracts information for lightmapping, GI (emission, albedo, ...)
  156. // This pass it not used during regular rendering.
  157. Pass
  158. {
  159. Name "META"
  160. Tags{ "LightMode" = "META" }
  161. Cull Off
  162. HLSLPROGRAM
  163. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  164. // All our shaders use same name for entry point
  165. #pragma vertex Vert
  166. #pragma fragment Frag
  167. //enable GPU instancing support
  168. #pragma multi_compile_instancing
  169. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  170. // Lightmap memo
  171. // 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,
  172. // both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON.
  173. #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT
  174. #pragma shader_feature EDITOR_VISUALIZATION
  175. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  176. #include "InTerra_TerrainLitTemplate.hlsl"
  177. #include "InTerra_TerrainLit_Splatmap.hlsl"
  178. ENDHLSL
  179. }
  180. Pass
  181. {
  182. Name "ShadowCaster"
  183. Tags{ "LightMode" = "ShadowCaster" }
  184. Cull[_CullMode]
  185. ZClip [_ZClip]
  186. ZWrite On
  187. ZTest LEqual
  188. ColorMask 0
  189. HLSLPROGRAM
  190. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  191. // All our shaders use same name for entry point
  192. #pragma vertex Vert
  193. #pragma fragment Frag
  194. //enable GPU instancing support
  195. #pragma multi_compile_instancing
  196. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  197. #define SHADERPASS SHADERPASS_SHADOWS
  198. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  199. #include "InTerra_TerrainLitTemplate.hlsl"
  200. #include "InTerra_TerrainLit_Splatmap.hlsl"
  201. ENDHLSL
  202. }
  203. Pass
  204. {
  205. Name "DepthOnly"
  206. Tags{ "LightMode" = "DepthOnly" }
  207. Cull[_CullMode]
  208. // To be able to tag stencil with disableSSR information for forward
  209. Stencil
  210. {
  211. WriteMask [_StencilWriteMaskDepth]
  212. Ref [_StencilRefDepth]
  213. Comp Always
  214. Pass Replace
  215. }
  216. ZWrite On
  217. HLSLPROGRAM
  218. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  219. // All our shaders use same name for entry point
  220. #pragma vertex Vert
  221. #pragma fragment Frag
  222. //enable GPU instancing support
  223. #pragma multi_compile_instancing
  224. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  225. // In deferred, depth only pass don't output anything.
  226. // In forward it output the normal buffer
  227. #pragma multi_compile _ WRITE_NORMAL_BUFFER
  228. #pragma multi_compile _ WRITE_DECAL_BUFFER WRITE_RENDERING_LAYER
  229. #pragma multi_compile _ WRITE_MSAA_DEPTH
  230. #define SHADERPASS SHADERPASS_DEPTH_ONLY
  231. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  232. #include "InTerra_TerrainLitTemplate.hlsl"
  233. #ifdef WRITE_NORMAL_BUFFER
  234. #if defined(_NORMALMAP)
  235. #define OVERRIDE_SPLAT_SAMPLER_NAME sampler_Normal0
  236. #elif defined(_MASKMAP)
  237. #define OVERRIDE_SPLAT_SAMPLER_NAME sampler_Mask0
  238. #endif
  239. #endif
  240. #include "InTerra_TerrainLit_Splatmap.hlsl"
  241. ENDHLSL
  242. }
  243. Pass
  244. {
  245. Name "Forward"
  246. Tags { "LightMode" = "Forward" } // This will be only for transparent object based on the RenderQueue index
  247. Stencil
  248. {
  249. WriteMask [_StencilWriteMask]
  250. Ref [_StencilRef]
  251. Comp Always
  252. Pass Replace
  253. }
  254. // In case of forward we want to have depth equal for opaque mesh
  255. ZTest [_ZTestDepthEqualForOpaque]
  256. ZWrite [_ZWrite]
  257. Cull [_CullMode]
  258. HLSLPROGRAM
  259. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  260. // All our shaders use same name for entry point
  261. #pragma vertex Vert
  262. #pragma fragment Frag
  263. //enable GPU instancing support
  264. #pragma multi_compile_instancing
  265. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  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 PUNCTUAL_SHADOW_LOW PUNCTUAL_SHADOW_MEDIUM PUNCTUAL_SHADOW_HIGH
  277. #pragma multi_compile_fragment DIRECTIONAL_SHADOW_LOW DIRECTIONAL_SHADOW_MEDIUM DIRECTIONAL_SHADOW_HIGH
  278. #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH
  279. #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
  280. #define SHADERPASS SHADERPASS_FORWARD
  281. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  282. #include "InTerra_TerrainLitTemplate.hlsl"
  283. #include "InTerra_TerrainLit_Splatmap.hlsl"
  284. ENDHLSL
  285. }
  286. Pass
  287. {
  288. Name "SceneSelectionPass"
  289. Tags { "LightMode" = "SceneSelectionPass" }
  290. Cull Off
  291. HLSLPROGRAM
  292. #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
  293. // All our shaders use same name for entry point
  294. #pragma vertex Vert
  295. #pragma fragment Frag
  296. //enable GPU instancing support
  297. #pragma multi_compile_instancing
  298. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
  299. #pragma editor_sync_compilation
  300. #define SHADERPASS SHADERPASS_DEPTH_ONLY
  301. #define SCENESELECTIONPASS
  302. #include "InTerra_HDRP_DefinedGlobalKeywords.hlsl"
  303. #include "InTerra_TerrainLitTemplate.hlsl"
  304. #include "InTerra_TerrainLit_Splatmap.hlsl"
  305. ENDHLSL
  306. }
  307. UsePass "Hidden/Nature/Terrain/Utilities/PICKING"
  308. }
  309. SubShader
  310. {
  311. PackageRequirements { "com.unity.render-pipelines.high-definition":"[15.0.0,19.0.0]" }
  312. // This tags allow to use the shader replacement features
  313. Tags
  314. {
  315. "RenderPipeline" = "HDRenderPipeline"
  316. "RenderType" = "Opaque"
  317. "SplatCount" = "8"
  318. "MaskMapR" = "Metallic"
  319. "MaskMapG" = "AO"
  320. "MaskMapB" = "Height"
  321. "MaskMapA" = "Smoothness"
  322. "DiffuseA" = "Smoothness (becomes Density when Mask map is assigned)" // when MaskMap is disabled
  323. "DiffuseA_MaskMapUsed" = "Density" // when MaskMap is enabled
  324. "TerrainCompatible" = "True"
  325. }
  326. Pass
  327. {
  328. Name "IndirectDXR"
  329. Tags{ "LightMode" = "IndirectDXR" }
  330. HLSLPROGRAM
  331. #pragma only_renderers d3d11 xboxseries ps5
  332. #pragma raytracing surface_shader
  333. #pragma multi_compile _ LIGHTMAP_ON
  334. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  335. #pragma multi_compile _ 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_TerrainLitTemplateRayTracing.hlsl"
  345. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl"
  346. ENDHLSL
  347. }
  348. Pass
  349. {
  350. Name "ForwardDXR"
  351. Tags{ "LightMode" = "ForwardDXR" }
  352. HLSLPROGRAM
  353. #pragma only_renderers d3d11 xboxseries ps5
  354. #pragma raytracing surface_shader
  355. #pragma multi_compile _ LIGHTMAP_ON
  356. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  357. #pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  358. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  359. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  360. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  361. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  362. #define SHADERPASS SHADERPASS_RAYTRACING_FORWARD
  363. // multi compile that allows us to strip the recursive code
  364. #define SHADOW_LOW
  365. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  366. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl"
  367. ENDHLSL
  368. }
  369. Pass
  370. {
  371. Name "GBufferDXR"
  372. Tags{ "LightMode" = "GBufferDXR" }
  373. HLSLPROGRAM
  374. #pragma only_renderers d3d11 xboxseries ps5
  375. #pragma raytracing surface_shader
  376. #pragma multi_compile _ LIGHTMAP_ON
  377. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  378. #pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
  379. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  380. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  381. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  382. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  383. #define SHADERPASS SHADERPASS_RAYTRACING_GBUFFER
  384. #pragma multi_compile _ MINIMAL_GBUFFER
  385. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  386. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl"
  387. ENDHLSL
  388. }
  389. Pass
  390. {
  391. Name "VisibilityDXR"
  392. Tags{ "LightMode" = "VisibilityDXR" }
  393. HLSLPROGRAM
  394. #pragma only_renderers d3d11 xboxseries ps5
  395. #pragma raytracing surface_shader
  396. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  397. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  398. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  399. #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY
  400. #pragma multi_compile _ TRANSPARENT_COLOR_SHADOW
  401. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  402. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl"
  403. ENDHLSL
  404. }
  405. Pass
  406. {
  407. Name "DebugDXR"
  408. Tags{ "LightMode" = "DebugDXR" }
  409. HLSLPROGRAM
  410. #pragma only_renderers d3d11 xboxseries ps5
  411. #pragma raytracing surface_shader
  412. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  413. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  414. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  415. #define SHADERPASS SHADERPASS_RAYTRACING_DEBUG
  416. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl"
  417. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl"
  418. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
  419. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl"
  420. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl"
  421. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingDebug.hlsl"
  422. ENDHLSL
  423. }
  424. Pass
  425. {
  426. Name "PathTracingDXR"
  427. Tags{ "LightMode" = "PathTracingDXR" }
  428. HLSLPROGRAM
  429. #pragma only_renderers d3d11 xboxseries ps5
  430. #pragma raytracing surface_shader
  431. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  432. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl"
  433. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl"
  434. #define SHADERPASS SHADERPASS_PATH_TRACING
  435. #pragma multi_compile _ SENSORSDK_OVERRIDE_REFLECTANCE
  436. #ifdef SENSORSDK_OVERRIDE_REFLECTANCE
  437. #define SENSORSDK_ENABLE_LIDAR
  438. #endif
  439. // This is just because it needs to be defined, shadow maps are not used.
  440. #define SHADOW_LOW
  441. // For all single-sided, refractive materials, we want to force a thin refraction model.
  442. #if !defined(_DOUBLESIDED_ON) && (defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE))
  443. #undef _REFRACTION_PLANE
  444. #undef _REFRACTION_SPHERE
  445. #define _REFRACTION_THIN
  446. #endif
  447. #include "InTerra_TerrainLitTemplateRayTracing.hlsl"
  448. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl"
  449. ENDHLSL
  450. }
  451. }
  452. Dependency "BaseMapShader" = "Hidden/InTerra/HDRP/TerrainLit_Basemap_2023_1"
  453. Dependency "BaseMapGenShader" = "Hidden/InTerra/HDRP/TerrainLit_BasemapGen"
  454. CustomEditor "InTerra.InTerra_TerrainShaderGUI"
  455. }