Lux URP Versatile Blend.shader 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. Shader "Lux URP/Versatile Blend"
  2. {
  3. Properties
  4. {
  5. [HeaderHelpLuxURP_URL(bmrgpp8nhuvj)]
  6. [Header(Surface Blending)]
  7. [Space(8)]
  8. _Shift ("Depth Shift", Range(0.0, 0.03)) = 0.01
  9. _AlphaShift ("Alpha Shift", Range(0.0, 1)) = 0.1
  10. _AlphaWidth ("Alpha Contraction", Range(0.0, 20)) = 4
  11. [Space(5)]
  12. _ShadowShiftThreshold ("Shadow Shift Threshold", Range(0, 0.1)) = 0.05
  13. _ShadowShift ("Shadow Shift", Range(0, 1)) = 1
  14. _ShadowShiftView ("Shadow Shift View", Range(0, 1)) = 0
  15. [Header(Surface Options)]
  16. [Space(8)]
  17. [Enum(UnityEngine.Rendering.CullMode)]
  18. _Cull ("Culling", Float) = 2
  19. [Enum(Off,0,On,1)]
  20. _ZWrite ("ZWrite", Int) = 1
  21. // [Toggle(_ALPHATEST_ON)]
  22. // _AlphaClip ("Alpha Clipping", Float) = 0.0
  23. // _Cutoff (" Threshold", Range(0.0, 1.0)) = 0.5
  24. [ToggleOff(_RECEIVE_SHADOWS_OFF)]
  25. _ReceiveShadows ("Receive Shadows", Float) = 1.0
  26. [Header(Surface Inputs)]
  27. [Space(8)]
  28. [MainColor]
  29. _BaseColor ("Color", Color) = (1,1,1,1)
  30. [MainTexture]
  31. _BaseMap ("Albedo (RGB) Smoothness (A)", 2D) = "white" {}
  32. [Space(5)]
  33. _Smoothness ("Smoothness", Range(0.0, 1.0)) = 0.5
  34. _SpecColor ("Specular", Color) = (0.2, 0.2, 0.2)
  35. [Space(5)]
  36. [Toggle(_NORMALMAP)]
  37. _ApplyNormal ("Enable Normal Map", Float) = 0.0
  38. [NoScaleOffset]
  39. _BumpMap (" Normal Map", 2D) = "bump" {}
  40. _BumpScale (" Normal Scale", Float) = 1.0
  41. [Header(Advanced)]
  42. [Space(8)]
  43. [ToggleOff]
  44. _SpecularHighlights ("Enable Specular Highlights", Float) = 1.0
  45. [ToggleOff]
  46. _EnvironmentReflections ("Environment Reflections", Float) = 1.0
  47. [Space(5)]
  48. [Toggle(_RECEIVE_SHADOWS_OFF)]
  49. _Shadows ("Disable Receive Shadows", Float) = 0.0
  50. // Needed by the inspector
  51. [HideInInspector] _Culling ("Culling", Float) = 0.0
  52. // Lightmapper and outline selection shader need _MainTex, _Color and _Cutoff
  53. [HideInInspector] _MainTex ("Albedo", 2D) = "white" {}
  54. [HideInInspector] _Color ("Color", Color) = (1,1,1,1)
  55. }
  56. SubShader
  57. {
  58. Tags
  59. {
  60. "RenderPipeline" = "LightweightPipeline"
  61. "RenderType" = "Opaque"
  62. "Queue" = "Transparent"
  63. }
  64. LOD 100
  65. Pass
  66. {
  67. Name "ForwardLit"
  68. Tags{"LightMode" = "UniversalForward"}
  69. Blend SrcAlpha OneMinusSrcAlpha
  70. ZWrite [_ZWrite]
  71. Cull [_Cull]
  72. ZTest LEqual
  73. HLSLPROGRAM
  74. // Required to compile gles 2.0 with standard SRP library
  75. #pragma prefer_hlslcc gles
  76. #pragma exclude_renderers d3d11_9x
  77. #pragma target 2.0
  78. // -------------------------------------
  79. // Material Keywords
  80. #define _SPECULAR_SETUP 1
  81. #pragma shader_feature_local _NORMALMAP
  82. // #pragma shader_feature _ALPHATEST_ON
  83. #if !defined(_ENABLEBASEMAP)
  84. #if defined(_ALPHATEST_ON)
  85. #undef _ALPHATEST_ON
  86. #endif
  87. #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)
  88. #undef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  89. #endif
  90. #endif
  91. #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)
  92. #if defined(_ALPHATEST_ON)
  93. #undef _ALPHATEST_ON
  94. #endif
  95. #endif
  96. // We have to sample SH per pixel
  97. #if defined (EVALUATE_SH_VERTEX)
  98. #undef EVALUATE_SH_VERTEX
  99. #endif
  100. #if defined(EVALUATE_SH_MIXED)
  101. #undef EVALUATE_SH_MIXED
  102. #endif
  103. #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
  104. #pragma shader_feature _ENVIRONMENTREFLECTIONS_OFF
  105. #pragma shader_feature _RECEIVE_SHADOWS_OFF
  106. // -------------------------------------
  107. // Universal Pipeline keywords
  108. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
  109. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
  110. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  111. #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
  112. #pragma multi_compile_fragment _ _SHADOWS_SOFT
  113. #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
  114. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  115. #pragma multi_compile _ SHADOWS_SHADOWMASK
  116. // -------------------------------------
  117. // Unity defined keywords
  118. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  119. #pragma multi_compile _ LIGHTMAP_ON
  120. #pragma multi_compile_fog
  121. //--------------------------------------
  122. // GPU Instancing
  123. #pragma multi_compile_instancing
  124. // #pragma multi_compile _ DOTS_INSTANCING_ON // needs shader target 4.5
  125. // Include base inputs and all other needed "base" includes
  126. #include "Includes/Lux URP Versatile Blend Inputs.hlsl"
  127. #pragma vertex LitPassVertex
  128. #pragma fragment LitPassFragment
  129. //--------------------------------------
  130. // Vertex shader
  131. VertexOutput LitPassVertex(VertexInput input)
  132. {
  133. VertexOutput output = (VertexOutput)0;
  134. UNITY_SETUP_INSTANCE_ID(input);
  135. UNITY_TRANSFER_INSTANCE_ID(input, output);
  136. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  137. VertexPositionInputs vertexInput;
  138. vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
  139. VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS, input.tangentOS);
  140. float3 viewDirWS = GetCameraPositionWS() - vertexInput.positionWS;
  141. half3 vertexLight = VertexLighting(vertexInput.positionWS, normalInput.normalWS);
  142. half fogFactor = ComputeFogFactor(vertexInput.positionCS.z);
  143. // ///////////////////
  144. // Pull positionCS.z towards camera
  145. float fac = _ProjectionParams.y * 10;
  146. // fine but clipping issues if we come very close. NANs?
  147. #if UNITY_REVERSED_Z
  148. vertexInput.positionCS.z += _Shift / max(_ProjectionParams.y, vertexInput.positionCS.w) * fac;
  149. #else
  150. vertexInput.positionCS.z -= _Shift / max(_ProjectionParams.y, vertexInput.positionCS.w) * fac;
  151. #endif
  152. // ///////////////////
  153. output.uv.xy = TRANSFORM_TEX(input.texcoord, _BaseMap);
  154. // already normalized from normal transform to WS.
  155. output.normalWS = normalInput.normalWS;
  156. output.viewDirWS = viewDirWS;
  157. #if defined(_NORMALMAP)
  158. float sign = input.tangentOS.w * GetOddNegativeScale();
  159. output.tangentWS = float4(normalInput.tangentWS, sign);
  160. #endif
  161. OUTPUT_LIGHTMAP_UV(input.lightmapUV, unity_LightmapST, output.lightmapUV);
  162. OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
  163. output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
  164. //#if defined(REQUIRES_WORLD_SPACE_POS_INTERPOLATOR)
  165. output.positionWS = vertexInput.positionWS;
  166. //#endif
  167. output.positionCS = vertexInput.positionCS;
  168. output.screenUV = ComputeScreenPos(output.positionCS).xy;
  169. return output;
  170. }
  171. //--------------------------------------
  172. // Fragment shader and functions
  173. inline void InitializeSurfaceData(
  174. float2 uv,
  175. out SurfaceDescription outSurfaceData)
  176. {
  177. half4 albedoAlpha = SampleAlbedoAlpha(uv.xy, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
  178. outSurfaceData.alpha = Alpha(albedoAlpha.a, 1, _Cutoff);
  179. outSurfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb;
  180. outSurfaceData.metallic = 0;
  181. outSurfaceData.specular = _SpecColor.rgb;
  182. outSurfaceData.smoothness = _Smoothness;
  183. outSurfaceData.smoothness *= albedoAlpha.a;
  184. outSurfaceData.occlusion = 1;
  185. // Normal Map
  186. #if defined (_NORMALMAP)
  187. outSurfaceData.normalTS = SampleNormal(uv.xy, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
  188. #else
  189. outSurfaceData.normalTS = half3(0,0,1);
  190. #endif
  191. outSurfaceData.emission = 0;
  192. }
  193. void InitializeInputData(VertexOutput input, half3 normalTS, half occlusion, out InputData inputData)
  194. {
  195. inputData = (InputData)0;
  196. inputData.positionWS = input.positionWS;
  197. half3 viewDirWS = SafeNormalize(input.viewDirWS);
  198. #if defined(_NORMALMAP)
  199. float sgn = input.tangentWS.w; // should be either +1 or -1
  200. float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
  201. inputData.normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, bitangent, input.normalWS.xyz));
  202. #else
  203. inputData.normalWS = input.normalWS;
  204. #endif
  205. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  206. inputData.viewDirectionWS = viewDirWS;
  207. inputData.fogCoord = input.fogFactorAndVertexLight.x;
  208. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  209. inputData.bakedGI = SAMPLE_GI(input.lightmapUV, input.vertexSH * occlusion, inputData.normalWS);
  210. // this shader is transparent so it will never write to depth normal...
  211. inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  212. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUV);
  213. }
  214. half4 LitPassFragment(VertexOutput input) : SV_Target
  215. {
  216. UNITY_SETUP_INSTANCE_ID(input);
  217. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  218. // Get the surface description
  219. SurfaceDescription surfaceData;
  220. InitializeSurfaceData(input.uv, surfaceData);
  221. // Get scene depth
  222. float2 screenUV = input.screenUV.xy / input.positionCS.w;
  223. // Fix screenUV for Single Pass Stereo Rendering
  224. #if defined(UNITY_SINGLE_PASS_STEREO)
  225. screenUV.xy = UnityStereoTransformScreenSpaceTex(screenUV.xy);
  226. #endif
  227. #if defined(SHADER_API_GLES)
  228. float sceneDepth = SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, screenUV, 0);
  229. #else
  230. float sceneDepth = LOAD_TEXTURE2D_X(_CameraDepthTexture, _CameraDepthTexture_TexelSize.zw * screenUV ).x;
  231. #endif
  232. float perspectiveSceneDepth = LinearEyeDepth(sceneDepth, _ZBufferParams);
  233. // Depth based blending
  234. float depthDist = perspectiveSceneDepth - input.positionCS.w + _AlphaShift;
  235. surfaceData.alpha = saturate(depthDist * _AlphaWidth);
  236. //surfaceData.alpha = 1;
  237. // Prepare surface data (like bring normal into world space and get missing inputs like gi)
  238. InputData inputData;
  239. InitializeInputData(input, surfaceData.normalTS, surfaceData.occlusion, inputData);
  240. float3 viewDirWS = inputData.viewDirectionWS;
  241. // Handle Shadows
  242. // Convert linear eye depth to distance in world space
  243. float3 camForward = UNITY_MATRIX_V[2].xyz;
  244. // Mind the sign of viewDirWS!
  245. float sceneDistance = perspectiveSceneDepth / dot(viewDirWS, camForward);
  246. float3 scenePositionWS = _WorldSpaceCameraPos - viewDirWS * sceneDistance;
  247. //
  248. float shadowShift = -min(0, input.positionWS.y - _ShadowShiftThreshold - scenePositionWS.y);
  249. float3 viewShift = shadowShift * _ShadowShiftView * inputData.viewDirectionWS;
  250. shadowShift *= _ShadowShift;
  251. float3 finalShift = float3(0, shadowShift, 0) + viewShift;
  252. // Limit shift: Depth buffer sample might be some where in space or even sky!
  253. finalShift *= saturate(1.0 - depthDist);
  254. // Calculate shadowCoord. We have to do it per pixel :(
  255. #if defined(_MAIN_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
  256. #if defined(_MAIN_LIGHT_SHADOWS_CASCADE)
  257. half cascadeIndex = ComputeCascadeIndex(input.positionWS + finalShift);
  258. #else
  259. half cascadeIndex = 0;
  260. #endif
  261. // As we do not want shadows on the blended parts from the geometry they intersect with we have to "somehow" shift the shadowCoords.
  262. // Shifting along view dir: Good...
  263. // inputData.shadowCoord = mul(_MainLightWorldToShadow[cascadeIndex], float4(input.positionWS + (1 - surfaceData.alpha) * viewDirWS * _AlphaShift, 1.0));
  264. // Shifting along WS Y axis: Gives us false shadows when viewing along the direction of the light: Shadows slip under the blended geometry.
  265. // inputData.shadowCoord = mul(_MainLightWorldToShadow[cascadeIndex], float4(input.positionWS + float3(0, _AlphaShift, 0), 1.0));
  266. // Shifting upwards according to distance below surfaces on screen and view
  267. inputData.shadowCoord = mul(_MainLightWorldToShadow[cascadeIndex], float4(input.positionWS + finalShift, 1.0));
  268. #endif
  269. // Apply lighting
  270. //half4 color = UniversalFragmentPBR(inputData, surfaceData.albedo, surfaceData.metallic, surfaceData.specular, surfaceData.smoothness, surfaceData.occlusion, surfaceData.emission, surfaceData.alpha);
  271. half4 color = LuxFragmentBlendPBR(inputData, surfaceData.albedo, surfaceData.metallic, surfaceData.specular, surfaceData.smoothness, surfaceData.occlusion, surfaceData.emission, surfaceData.alpha,
  272. finalShift
  273. );
  274. // Add fog
  275. color.rgb = MixFog(color.rgb, inputData.fogCoord);
  276. return color;
  277. }
  278. ENDHLSL
  279. }
  280. // Shadows -----------------------------------------------------
  281. Pass
  282. {
  283. Name "ShadowCaster"
  284. Tags{"LightMode" = "ShadowCaster"}
  285. ZWrite On
  286. ZTest LEqual
  287. ColorMask 0
  288. Cull [_Cull]
  289. HLSLPROGRAM
  290. // Required to compile gles 2.0 with standard srp library
  291. #pragma prefer_hlslcc gles
  292. #pragma exclude_renderers d3d11_9x
  293. #pragma target 2.0
  294. // -------------------------------------
  295. // Material Keywords
  296. //#pragma shader_feature _ALPHATEST_ON
  297. //--------------------------------------
  298. // GPU Instancing
  299. #pragma multi_compile_instancing
  300. // #pragma multi_compile _ DOTS_INSTANCING_ON // needs shader target 4.5
  301. #pragma vertex ShadowPassVertex
  302. #pragma fragment ShadowPassFragment
  303. // Include base inputs and all other needed "base" includes
  304. #include "Includes/Lux URP Versatile Blend Inputs.hlsl"
  305. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  306. // Shadow caster specific input
  307. float3 _LightDirection;
  308. VertexOutput ShadowPassVertex(VertexInput input)
  309. {
  310. VertexOutput output = (VertexOutput)0;
  311. UNITY_SETUP_INSTANCE_ID(input);
  312. UNITY_TRANSFER_INSTANCE_ID(input, output);
  313. #if defined(_ALPHATEST_ON)
  314. output.uv.xy = TRANSFORM_TEX(input.texcoord, _BaseMap);
  315. #endif
  316. float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
  317. float3 normalWS = TransformObjectToWorldDir(input.normalOS);
  318. output.positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
  319. #if UNITY_REVERSED_Z
  320. output.positionCS.z = min(output.positionCS.z, output.positionCS.w * UNITY_NEAR_CLIP_VALUE);
  321. #else
  322. output.positionCS.z = max(output.positionCS.z, output.positionCS.w * UNITY_NEAR_CLIP_VALUE);
  323. #endif
  324. return output;
  325. }
  326. half4 ShadowPassFragment(VertexOutput input) : SV_TARGET
  327. {
  328. UNITY_SETUP_INSTANCE_ID(input);
  329. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  330. #if defined(_ALPHATEST_ON)
  331. half mask = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).a;
  332. clip (mask - _Cutoff);
  333. #endif
  334. return 0;
  335. }
  336. ENDHLSL
  337. }
  338. // Depth -----------------------------------------------------
  339. Pass
  340. {
  341. Tags{"LightMode" = "DepthOnly"}
  342. ZWrite On
  343. ColorMask 0
  344. Cull [_Cull]
  345. HLSLPROGRAM
  346. // Required to compile gles 2.0 with standard srp library
  347. #pragma prefer_hlslcc gles
  348. #pragma exclude_renderers d3d11_9x
  349. #pragma target 2.0
  350. #pragma vertex DepthOnlyVertex
  351. #pragma fragment DepthOnlyFragment
  352. // -------------------------------------
  353. // Material Keywords
  354. // #pragma shader_feature _ALPHATEST_ON
  355. //--------------------------------------
  356. // GPU Instancing
  357. #pragma multi_compile_instancing
  358. // #pragma multi_compile _ DOTS_INSTANCING_ON // needs shader target 4.5
  359. #define DEPTHONLYPASS
  360. #include "Includes/Lux URP Versatile Blend Inputs.hlsl"
  361. VertexOutput DepthOnlyVertex(VertexInput input)
  362. {
  363. VertexOutput output = (VertexOutput)0;
  364. UNITY_SETUP_INSTANCE_ID(input);
  365. UNITY_TRANSFER_INSTANCE_ID(input, output);
  366. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  367. #if defined(_ALPHATEST_ON)
  368. output.uv.xy = TRANSFORM_TEX(input.texcoord, _BaseMap);
  369. #endif
  370. output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
  371. return output;
  372. }
  373. half4 DepthOnlyFragment(VertexOutput input) : SV_TARGET
  374. {
  375. UNITY_SETUP_INSTANCE_ID(input);
  376. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  377. #if defined(_ALPHATEST_ON)
  378. half mask = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv.xy).a;
  379. clip (mask - _Cutoff);
  380. #endif
  381. return 0;
  382. }
  383. ENDHLSL
  384. }
  385. // Depth Normal -----------------------------------------------------
  386. // this shader is transparent so it will never write to depth normal...
  387. // Pass
  388. // {
  389. // Name "DepthNormals"
  390. // Tags{"LightMode" = "DepthNormals"}
  391. // ZWrite On
  392. // Cull[_Cull]
  393. // HLSLPROGRAM
  394. // // Required to compile gles 2.0 with standard srp library
  395. // #pragma prefer_hlslcc gles
  396. // #pragma exclude_renderers d3d11_9x
  397. // #pragma target 2.0
  398. // #pragma vertex DepthNormalsVertex
  399. // #pragma fragment DepthNormalsFragment
  400. // // -------------------------------------
  401. // // Material Keywords
  402. // #pragma shader_feature_local _NORMALMAP
  403. // #pragma shader_feature_local_fragment _ALPHATEST_ON
  404. // #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  405. // //--------------------------------------
  406. // // GPU Instancing
  407. // #pragma multi_compile_instancing
  408. // // #pragma multi_compile _ DOTS_INSTANCING_ON // needs shader target 4.5
  409. // #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
  410. // #include "Packages/com.unity.render-pipelines.universal/Shaders/DepthNormalsPass.hlsl"
  411. // ENDHLSL
  412. // }
  413. // Meta -----------------------------------------------------
  414. Pass
  415. {
  416. Tags{"LightMode" = "Meta"}
  417. Cull Off
  418. HLSLPROGRAM
  419. // Required to compile gles 2.0 with standard srp library
  420. #pragma prefer_hlslcc gles
  421. #pragma vertex UniversalVertexMeta
  422. #pragma fragment UniversalFragmentMeta
  423. #define _SPECULAR_SETUP
  424. // First include all our custom stuff
  425. #include "Includes/Lux URP Versatile Blend Inputs.hlsl"
  426. //--------------------------------------
  427. // Fragment shader and functions
  428. inline void InitializeStandardLitSurfaceData(float2 uv, out SurfaceData outSurfaceData)
  429. {
  430. half4 albedoAlpha = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
  431. outSurfaceData.alpha = 1;
  432. outSurfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb;
  433. outSurfaceData.metallic = 0;
  434. outSurfaceData.specular = _SpecColor.rgb;
  435. outSurfaceData.smoothness = _Smoothness;
  436. outSurfaceData.normalTS = half3(0,0,1);
  437. outSurfaceData.occlusion = 1;
  438. outSurfaceData.emission = 0;
  439. outSurfaceData.clearCoatMask = 0;
  440. outSurfaceData.clearCoatSmoothness = 0;
  441. }
  442. // Finally include the meta pass related stuff
  443. #include "Packages/com.unity.render-pipelines.universal/Shaders/LitMetaPass.hlsl"
  444. ENDHLSL
  445. }
  446. // End Passes -----------------------------------------------------
  447. }
  448. FallBack "Hidden/InternalErrorShader"
  449. }