2Textures.shader 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "MTE/URP/2 Textures"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
  8. [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
  9. _Splat0("Layer 1", 2D) = "white" {}
  10. _Splat1("Layer 2", 2D) = "white" {}
  11. _Normal0("Normalmap 1", 2D) = "bump" {}
  12. _Normal1("Normalmap 2", 2D) = "bump" {}
  13. _Smoothness0("Smoothness 1", Range( 0 , 1)) = 0.5
  14. _Smoothness1("Smoothness 2", Range( 0 , 1)) = 0.5
  15. _Control("Control", 2D) = "white" {}
  16. [Toggle(ENABLE_NORMAL_INTENSITY)] ENABLE_NORMAL_INTENSITY("Normal Intensity", Float) = 1
  17. [Toggle(SMOOTHNESS_TEXTURE)] SMOOTHNESS_TEXTURE("Smoothness Texture", Float) = 0
  18. _NormalIntensity0("Normal Intensity 1", Range( 0.01 , 10)) = 1
  19. _NormalIntensity1("Normal Intensity 2", Range( 0.01 , 10)) = 1
  20. [ASEEnd]_SpecularColor("SpecularColor", Color) = (0,0,0,0)
  21. //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5
  22. //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1
  23. //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5
  24. //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2
  25. //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9
  26. //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1
  27. //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5
  28. //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
  29. //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
  30. //_TessMin( "Tess Min Distance", Float ) = 10
  31. //_TessMax( "Tess Max Distance", Float ) = 25
  32. //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
  33. //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
  34. }
  35. SubShader
  36. {
  37. LOD 0
  38. Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" }
  39. Cull Back
  40. AlphaToMask Off
  41. HLSLINCLUDE
  42. #pragma target 3.0
  43. #pragma prefer_hlslcc gles
  44. #pragma exclude_renderers d3d11_9x
  45. #ifndef ASE_TESS_FUNCS
  46. #define ASE_TESS_FUNCS
  47. float4 FixedTess( float tessValue )
  48. {
  49. return tessValue;
  50. }
  51. float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
  52. {
  53. float3 wpos = mul(o2w,vertex).xyz;
  54. float dist = distance (wpos, cameraPos);
  55. float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
  56. return f;
  57. }
  58. float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
  59. {
  60. float4 tess;
  61. tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
  62. tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
  63. tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
  64. tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
  65. return tess;
  66. }
  67. float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
  68. {
  69. float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
  70. float len = distance(wpos0, wpos1);
  71. float f = max(len * scParams.y / (edgeLen * dist), 1.0);
  72. return f;
  73. }
  74. float DistanceFromPlane (float3 pos, float4 plane)
  75. {
  76. float d = dot (float4(pos,1.0f), plane);
  77. return d;
  78. }
  79. bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
  80. {
  81. float4 planeTest;
  82. planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  83. (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  84. (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
  85. planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  86. (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  87. (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
  88. planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  89. (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  90. (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
  91. planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  92. (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  93. (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
  94. return !all (planeTest);
  95. }
  96. float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
  97. {
  98. float3 f;
  99. f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
  100. f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
  101. f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
  102. return CalcTriEdgeTessFactors (f);
  103. }
  104. float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
  105. {
  106. float3 pos0 = mul(o2w,v0).xyz;
  107. float3 pos1 = mul(o2w,v1).xyz;
  108. float3 pos2 = mul(o2w,v2).xyz;
  109. float4 tess;
  110. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  111. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  112. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  113. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  114. return tess;
  115. }
  116. float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
  117. {
  118. float3 pos0 = mul(o2w,v0).xyz;
  119. float3 pos1 = mul(o2w,v1).xyz;
  120. float3 pos2 = mul(o2w,v2).xyz;
  121. float4 tess;
  122. if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
  123. {
  124. tess = 0.0f;
  125. }
  126. else
  127. {
  128. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  129. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  130. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  131. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  132. }
  133. return tess;
  134. }
  135. #endif //ASE_TESS_FUNCS
  136. ENDHLSL
  137. Pass
  138. {
  139. Name "Forward"
  140. Tags { "LightMode"="UniversalForward" }
  141. Blend One Zero, One Zero
  142. ZWrite On
  143. ZTest LEqual
  144. Offset 0 , 0
  145. ColorMask RGBA
  146. HLSLPROGRAM
  147. #define _SPECULAR_SETUP 1
  148. #define _NORMAL_DROPOFF_TS 1
  149. #pragma multi_compile_instancing
  150. #pragma multi_compile _ LOD_FADE_CROSSFADE
  151. #pragma multi_compile_fog
  152. #define ASE_FOG 1
  153. #define _NORMALMAP 1
  154. #define ASE_SRP_VERSION 100500
  155. #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION
  156. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
  157. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
  158. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF
  159. #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
  160. #pragma multi_compile _ _SHADOWS_SOFT
  161. #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
  162. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  163. #pragma multi_compile _ SHADOWS_SHADOWMASK
  164. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  165. #pragma multi_compile _ LIGHTMAP_ON
  166. #pragma vertex vert
  167. #pragma fragment frag
  168. #define SHADERPASS_FORWARD
  169. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  170. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  171. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  172. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
  173. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  174. #if ASE_SRP_VERSION <= 70108
  175. #define REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR
  176. #endif
  177. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  178. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  179. #endif
  180. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  181. #pragma shader_feature_local ENABLE_NORMAL_INTENSITY
  182. struct VertexInput
  183. {
  184. float4 vertex : POSITION;
  185. float3 ase_normal : NORMAL;
  186. float4 ase_tangent : TANGENT;
  187. float4 texcoord1 : TEXCOORD1;
  188. float4 texcoord : TEXCOORD0;
  189. UNITY_VERTEX_INPUT_INSTANCE_ID
  190. };
  191. struct VertexOutput
  192. {
  193. float4 clipPos : SV_POSITION;
  194. float4 lightmapUVOrVertexSH : TEXCOORD0;
  195. half4 fogFactorAndVertexLight : TEXCOORD1;
  196. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  197. float4 shadowCoord : TEXCOORD2;
  198. #endif
  199. float4 tSpace0 : TEXCOORD3;
  200. float4 tSpace1 : TEXCOORD4;
  201. float4 tSpace2 : TEXCOORD5;
  202. #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
  203. float4 screenPos : TEXCOORD6;
  204. #endif
  205. float4 ase_texcoord7 : TEXCOORD7;
  206. UNITY_VERTEX_INPUT_INSTANCE_ID
  207. UNITY_VERTEX_OUTPUT_STEREO
  208. };
  209. CBUFFER_START(UnityPerMaterial)
  210. float4 _Control_ST;
  211. float4 _Splat0_ST;
  212. float4 _Splat1_ST;
  213. float4 _SpecularColor;
  214. float _Smoothness0;
  215. float _Smoothness1;
  216. float _NormalIntensity0;
  217. float _NormalIntensity1;
  218. #ifdef _TRANSMISSION_ASE
  219. float _TransmissionShadow;
  220. #endif
  221. #ifdef _TRANSLUCENCY_ASE
  222. float _TransStrength;
  223. float _TransNormal;
  224. float _TransScattering;
  225. float _TransDirect;
  226. float _TransAmbient;
  227. float _TransShadow;
  228. #endif
  229. #ifdef TESSELLATION_ON
  230. float _TessPhongStrength;
  231. float _TessValue;
  232. float _TessMin;
  233. float _TessMax;
  234. float _TessEdgeLength;
  235. float _TessMaxDisp;
  236. #endif
  237. CBUFFER_END
  238. sampler2D _Control;
  239. sampler2D _Splat0;
  240. sampler2D _Splat1;
  241. sampler2D _Normal0;
  242. sampler2D _Normal1;
  243. float4 WeightedBlend2144( half4 Weight, float4 Layer1, float4 Layer2 )
  244. {
  245. return Layer1 * Weight.r + Layer2 * Weight.g;
  246. }
  247. inline float3 MTE_NormalIntensity_fixed147( float3 Normal, float Strength )
  248. {
  249. return lerp(Normal, float3(0,0,1), - Strength + 1.0);
  250. }
  251. inline float3 MTE_NormalIntensity_fixed150( float3 Normal, float Strength )
  252. {
  253. return lerp(Normal, float3(0,0,1), - Strength + 1.0);
  254. }
  255. float4 WeightedBlend2145( half4 Weight, float4 Layer1, float4 Layer2 )
  256. {
  257. return Layer1 * Weight.r + Layer2 * Weight.g;
  258. }
  259. VertexOutput VertexFunction( VertexInput v )
  260. {
  261. VertexOutput o = (VertexOutput)0;
  262. UNITY_SETUP_INSTANCE_ID(v);
  263. UNITY_TRANSFER_INSTANCE_ID(v, o);
  264. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  265. o.ase_texcoord7.xy = v.texcoord.xy;
  266. //setting value to unused interpolator channels and avoid initialization warnings
  267. o.ase_texcoord7.zw = 0;
  268. #ifdef ASE_ABSOLUTE_VERTEX_POS
  269. float3 defaultVertexValue = v.vertex.xyz;
  270. #else
  271. float3 defaultVertexValue = float3(0, 0, 0);
  272. #endif
  273. float3 vertexValue = defaultVertexValue;
  274. #ifdef ASE_ABSOLUTE_VERTEX_POS
  275. v.vertex.xyz = vertexValue;
  276. #else
  277. v.vertex.xyz += vertexValue;
  278. #endif
  279. v.ase_normal = v.ase_normal;
  280. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  281. float3 positionVS = TransformWorldToView( positionWS );
  282. float4 positionCS = TransformWorldToHClip( positionWS );
  283. VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent );
  284. o.tSpace0 = float4( normalInput.normalWS, positionWS.x);
  285. o.tSpace1 = float4( normalInput.tangentWS, positionWS.y);
  286. o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z);
  287. OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy );
  288. OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz );
  289. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  290. o.lightmapUVOrVertexSH.zw = v.texcoord;
  291. o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw;
  292. #endif
  293. half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS );
  294. #ifdef ASE_FOG
  295. half fogFactor = ComputeFogFactor( positionCS.z );
  296. #else
  297. half fogFactor = 0;
  298. #endif
  299. o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
  300. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  301. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  302. vertexInput.positionWS = positionWS;
  303. vertexInput.positionCS = positionCS;
  304. o.shadowCoord = GetShadowCoord( vertexInput );
  305. #endif
  306. o.clipPos = positionCS;
  307. #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
  308. o.screenPos = ComputeScreenPos(positionCS);
  309. #endif
  310. return o;
  311. }
  312. #if defined(TESSELLATION_ON)
  313. struct VertexControl
  314. {
  315. float4 vertex : INTERNALTESSPOS;
  316. float3 ase_normal : NORMAL;
  317. float4 ase_tangent : TANGENT;
  318. float4 texcoord : TEXCOORD0;
  319. float4 texcoord1 : TEXCOORD1;
  320. UNITY_VERTEX_INPUT_INSTANCE_ID
  321. };
  322. struct TessellationFactors
  323. {
  324. float edge[3] : SV_TessFactor;
  325. float inside : SV_InsideTessFactor;
  326. };
  327. VertexControl vert ( VertexInput v )
  328. {
  329. VertexControl o;
  330. UNITY_SETUP_INSTANCE_ID(v);
  331. UNITY_TRANSFER_INSTANCE_ID(v, o);
  332. o.vertex = v.vertex;
  333. o.ase_normal = v.ase_normal;
  334. o.ase_tangent = v.ase_tangent;
  335. o.texcoord = v.texcoord;
  336. o.texcoord1 = v.texcoord1;
  337. return o;
  338. }
  339. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  340. {
  341. TessellationFactors o;
  342. float4 tf = 1;
  343. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  344. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  345. #if defined(ASE_FIXED_TESSELLATION)
  346. tf = FixedTess( tessValue );
  347. #elif defined(ASE_DISTANCE_TESSELLATION)
  348. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  349. #elif defined(ASE_LENGTH_TESSELLATION)
  350. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  351. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  352. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  353. #endif
  354. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  355. return o;
  356. }
  357. [domain("tri")]
  358. [partitioning("fractional_odd")]
  359. [outputtopology("triangle_cw")]
  360. [patchconstantfunc("TessellationFunction")]
  361. [outputcontrolpoints(3)]
  362. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  363. {
  364. return patch[id];
  365. }
  366. [domain("tri")]
  367. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  368. {
  369. VertexInput o = (VertexInput) 0;
  370. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  371. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  372. o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  373. o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  374. o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  375. #if defined(ASE_PHONG_TESSELLATION)
  376. float3 pp[3];
  377. for (int i = 0; i < 3; ++i)
  378. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  379. float phongStrength = _TessPhongStrength;
  380. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  381. #endif
  382. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  383. return VertexFunction(o);
  384. }
  385. #else
  386. VertexOutput vert ( VertexInput v )
  387. {
  388. return VertexFunction( v );
  389. }
  390. #endif
  391. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
  392. #define ASE_SV_DEPTH SV_DepthLessEqual
  393. #else
  394. #define ASE_SV_DEPTH SV_Depth
  395. #endif
  396. half4 frag ( VertexOutput IN
  397. #ifdef ASE_DEPTH_WRITE_ON
  398. ,out float outputDepth : ASE_SV_DEPTH
  399. #endif
  400. ) : SV_Target
  401. {
  402. UNITY_SETUP_INSTANCE_ID(IN);
  403. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
  404. #ifdef LOD_FADE_CROSSFADE
  405. LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
  406. #endif
  407. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  408. float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  409. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  410. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  411. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  412. #else
  413. float3 WorldNormal = normalize( IN.tSpace0.xyz );
  414. float3 WorldTangent = IN.tSpace1.xyz;
  415. float3 WorldBiTangent = IN.tSpace2.xyz;
  416. #endif
  417. float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w);
  418. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  419. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  420. #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
  421. float4 ScreenPos = IN.screenPos;
  422. #endif
  423. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  424. ShadowCoords = IN.shadowCoord;
  425. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  426. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  427. #endif
  428. WorldViewDirection = SafeNormalize( WorldViewDirection );
  429. float4 localBreakRGBA115 = ( float4( 0,0,0,0 ) );
  430. float2 uv_Control = IN.ase_texcoord7.xy * _Control_ST.xy + _Control_ST.zw;
  431. float4 tex2DNode6 = tex2D( _Control, uv_Control );
  432. float4 Weight144 = tex2DNode6;
  433. float2 uv_Splat0 = IN.ase_texcoord7.xy * _Splat0_ST.xy + _Splat0_ST.zw;
  434. float4 appendResult123 = (float4(1.0 , 1.0 , 1.0 , _Smoothness0));
  435. float4 Layer1144 = ( tex2D( _Splat0, uv_Splat0 ) * appendResult123 );
  436. float2 uv_Splat1 = IN.ase_texcoord7.xy * _Splat1_ST.xy + _Splat1_ST.zw;
  437. float4 appendResult126 = (float4(1.0 , 1.0 , 1.0 , _Smoothness1));
  438. float4 Layer2144 = ( tex2D( _Splat1, uv_Splat1 ) * appendResult126 );
  439. float4 localWeightedBlend2144 = WeightedBlend2144( Weight144 , Layer1144 , Layer2144 );
  440. float4 RGBA115 = localWeightedBlend2144;
  441. float3 RGB115 = float3( 0,0,0 );
  442. float A115 = 0;
  443. {
  444. RGB115 = RGBA115.rgb;
  445. A115 = RGBA115.a;
  446. }
  447. float4 Weight145 = tex2DNode6;
  448. float3 tex2DNode16 = UnpackNormalScale( tex2D( _Normal0, uv_Splat0 ), 1.0f );
  449. float3 Normal147 = tex2DNode16;
  450. float Strength147 = _NormalIntensity0;
  451. float3 localMTE_NormalIntensity_fixed147 = MTE_NormalIntensity_fixed147( Normal147 , Strength147 );
  452. #ifdef ENABLE_NORMAL_INTENSITY
  453. float3 staticSwitch148 = localMTE_NormalIntensity_fixed147;
  454. #else
  455. float3 staticSwitch148 = tex2DNode16;
  456. #endif
  457. float4 Layer1145 = float4( staticSwitch148 , 0.0 );
  458. float3 tex2DNode39 = UnpackNormalScale( tex2D( _Normal1, uv_Splat1 ), 1.0f );
  459. float3 Normal150 = tex2DNode39;
  460. float Strength150 = _NormalIntensity1;
  461. float3 localMTE_NormalIntensity_fixed150 = MTE_NormalIntensity_fixed150( Normal150 , Strength150 );
  462. #ifdef ENABLE_NORMAL_INTENSITY
  463. float3 staticSwitch151 = localMTE_NormalIntensity_fixed150;
  464. #else
  465. float3 staticSwitch151 = tex2DNode39;
  466. #endif
  467. float4 Layer2145 = float4( staticSwitch151 , 0.0 );
  468. float4 localWeightedBlend2145 = WeightedBlend2145( Weight145 , Layer1145 , Layer2145 );
  469. float3 Albedo = RGB115;
  470. float3 Normal = localWeightedBlend2145.xyz;
  471. float3 Emission = 0;
  472. float3 Specular = _SpecularColor.rgb;
  473. float Metallic = 0;
  474. float Smoothness = A115;
  475. float Occlusion = 1;
  476. float Alpha = 1;
  477. float AlphaClipThreshold = 0.5;
  478. float AlphaClipThresholdShadow = 0.5;
  479. float3 BakedGI = 0;
  480. float3 RefractionColor = 1;
  481. float RefractionIndex = 1;
  482. float3 Transmission = 1;
  483. float3 Translucency = 1;
  484. #ifdef ASE_DEPTH_WRITE_ON
  485. float DepthValue = 0;
  486. #endif
  487. #ifdef _ALPHATEST_ON
  488. clip(Alpha - AlphaClipThreshold);
  489. #endif
  490. InputData inputData;
  491. inputData.positionWS = WorldPosition;
  492. inputData.viewDirectionWS = WorldViewDirection;
  493. inputData.shadowCoord = ShadowCoords;
  494. #ifdef _NORMALMAP
  495. #if _NORMAL_DROPOFF_TS
  496. inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal ));
  497. #elif _NORMAL_DROPOFF_OS
  498. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  499. #elif _NORMAL_DROPOFF_WS
  500. inputData.normalWS = Normal;
  501. #endif
  502. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  503. #else
  504. inputData.normalWS = WorldNormal;
  505. #endif
  506. #ifdef ASE_FOG
  507. inputData.fogCoord = IN.fogFactorAndVertexLight.x;
  508. #endif
  509. inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw;
  510. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  511. float3 SH = SampleSH(inputData.normalWS.xyz);
  512. #else
  513. float3 SH = IN.lightmapUVOrVertexSH.xyz;
  514. #endif
  515. inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS );
  516. #ifdef _ASE_BAKEDGI
  517. inputData.bakedGI = BakedGI;
  518. #endif
  519. inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.clipPos);
  520. inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUVOrVertexSH.xy);
  521. half4 color = UniversalFragmentPBR(
  522. inputData,
  523. Albedo,
  524. Metallic,
  525. Specular,
  526. Smoothness,
  527. Occlusion,
  528. Emission,
  529. Alpha);
  530. #ifdef _TRANSMISSION_ASE
  531. {
  532. float shadow = _TransmissionShadow;
  533. Light mainLight = GetMainLight( inputData.shadowCoord );
  534. float3 mainAtten = mainLight.color * mainLight.distanceAttenuation;
  535. mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow );
  536. half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission;
  537. color.rgb += Albedo * mainTransmission;
  538. #ifdef _ADDITIONAL_LIGHTS
  539. int transPixelLightCount = GetAdditionalLightsCount();
  540. for (int i = 0; i < transPixelLightCount; ++i)
  541. {
  542. Light light = GetAdditionalLight(i, inputData.positionWS);
  543. float3 atten = light.color * light.distanceAttenuation;
  544. atten = lerp( atten, atten * light.shadowAttenuation, shadow );
  545. half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission;
  546. color.rgb += Albedo * transmission;
  547. }
  548. #endif
  549. }
  550. #endif
  551. #ifdef _TRANSLUCENCY_ASE
  552. {
  553. float shadow = _TransShadow;
  554. float normal = _TransNormal;
  555. float scattering = _TransScattering;
  556. float direct = _TransDirect;
  557. float ambient = _TransAmbient;
  558. float strength = _TransStrength;
  559. Light mainLight = GetMainLight( inputData.shadowCoord );
  560. float3 mainAtten = mainLight.color * mainLight.distanceAttenuation;
  561. mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow );
  562. half3 mainLightDir = mainLight.direction + inputData.normalWS * normal;
  563. half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering );
  564. half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency;
  565. color.rgb += Albedo * mainTranslucency * strength;
  566. #ifdef _ADDITIONAL_LIGHTS
  567. int transPixelLightCount = GetAdditionalLightsCount();
  568. for (int i = 0; i < transPixelLightCount; ++i)
  569. {
  570. Light light = GetAdditionalLight(i, inputData.positionWS);
  571. float3 atten = light.color * light.distanceAttenuation;
  572. atten = lerp( atten, atten * light.shadowAttenuation, shadow );
  573. half3 lightDir = light.direction + inputData.normalWS * normal;
  574. half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );
  575. half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;
  576. color.rgb += Albedo * translucency * strength;
  577. }
  578. #endif
  579. }
  580. #endif
  581. #ifdef _REFRACTION_ASE
  582. float4 projScreenPos = ScreenPos / ScreenPos.w;
  583. float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) );
  584. projScreenPos.xy += refractionOffset.xy;
  585. float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor;
  586. color.rgb = lerp( refraction, color.rgb, color.a );
  587. color.a = 1;
  588. #endif
  589. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  590. color.rgb *= color.a;
  591. #endif
  592. #ifdef ASE_FOG
  593. #ifdef TERRAIN_SPLAT_ADDPASS
  594. color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x );
  595. #else
  596. color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x);
  597. #endif
  598. #endif
  599. #ifdef ASE_DEPTH_WRITE_ON
  600. outputDepth = DepthValue;
  601. #endif
  602. return color;
  603. }
  604. ENDHLSL
  605. }
  606. Pass
  607. {
  608. Name "ShadowCaster"
  609. Tags { "LightMode"="ShadowCaster" }
  610. ZWrite On
  611. ZTest LEqual
  612. AlphaToMask Off
  613. ColorMask 0
  614. HLSLPROGRAM
  615. #define _SPECULAR_SETUP 1
  616. #define _NORMAL_DROPOFF_TS 1
  617. #pragma multi_compile_instancing
  618. #pragma multi_compile _ LOD_FADE_CROSSFADE
  619. #pragma multi_compile_fog
  620. #define ASE_FOG 1
  621. #define _NORMALMAP 1
  622. #define ASE_SRP_VERSION 100500
  623. #pragma vertex vert
  624. #pragma fragment frag
  625. #if ASE_SRP_VERSION >= 110000
  626. #pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW
  627. #endif
  628. #define SHADERPASS_SHADOWCASTER
  629. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  630. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  631. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  632. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  633. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  634. struct VertexInput
  635. {
  636. float4 vertex : POSITION;
  637. float3 ase_normal : NORMAL;
  638. UNITY_VERTEX_INPUT_INSTANCE_ID
  639. };
  640. struct VertexOutput
  641. {
  642. float4 clipPos : SV_POSITION;
  643. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  644. float3 worldPos : TEXCOORD0;
  645. #endif
  646. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  647. float4 shadowCoord : TEXCOORD1;
  648. #endif
  649. UNITY_VERTEX_INPUT_INSTANCE_ID
  650. UNITY_VERTEX_OUTPUT_STEREO
  651. };
  652. CBUFFER_START(UnityPerMaterial)
  653. float4 _Control_ST;
  654. float4 _Splat0_ST;
  655. float4 _Splat1_ST;
  656. float4 _SpecularColor;
  657. float _Smoothness0;
  658. float _Smoothness1;
  659. float _NormalIntensity0;
  660. float _NormalIntensity1;
  661. #ifdef _TRANSMISSION_ASE
  662. float _TransmissionShadow;
  663. #endif
  664. #ifdef _TRANSLUCENCY_ASE
  665. float _TransStrength;
  666. float _TransNormal;
  667. float _TransScattering;
  668. float _TransDirect;
  669. float _TransAmbient;
  670. float _TransShadow;
  671. #endif
  672. #ifdef TESSELLATION_ON
  673. float _TessPhongStrength;
  674. float _TessValue;
  675. float _TessMin;
  676. float _TessMax;
  677. float _TessEdgeLength;
  678. float _TessMaxDisp;
  679. #endif
  680. CBUFFER_END
  681. float3 _LightDirection;
  682. #if ASE_SRP_VERSION >= 110000
  683. float3 _LightPosition;
  684. #endif
  685. VertexOutput VertexFunction( VertexInput v )
  686. {
  687. VertexOutput o;
  688. UNITY_SETUP_INSTANCE_ID(v);
  689. UNITY_TRANSFER_INSTANCE_ID(v, o);
  690. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
  691. #ifdef ASE_ABSOLUTE_VERTEX_POS
  692. float3 defaultVertexValue = v.vertex.xyz;
  693. #else
  694. float3 defaultVertexValue = float3(0, 0, 0);
  695. #endif
  696. float3 vertexValue = defaultVertexValue;
  697. #ifdef ASE_ABSOLUTE_VERTEX_POS
  698. v.vertex.xyz = vertexValue;
  699. #else
  700. v.vertex.xyz += vertexValue;
  701. #endif
  702. v.ase_normal = v.ase_normal;
  703. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  704. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  705. o.worldPos = positionWS;
  706. #endif
  707. float3 normalWS = TransformObjectToWorldDir(v.ase_normal);
  708. #if ASE_SRP_VERSION >= 110000
  709. #if _CASTING_PUNCTUAL_LIGHT_SHADOW
  710. float3 lightDirectionWS = normalize(_LightPosition - positionWS);
  711. #else
  712. float3 lightDirectionWS = _LightDirection;
  713. #endif
  714. float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
  715. #if UNITY_REVERSED_Z
  716. clipPos.z = min(clipPos.z, UNITY_NEAR_CLIP_VALUE);
  717. #else
  718. clipPos.z = max(clipPos.z, UNITY_NEAR_CLIP_VALUE);
  719. #endif
  720. #else
  721. float4 clipPos = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
  722. #if UNITY_REVERSED_Z
  723. clipPos.z = min(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE);
  724. #else
  725. clipPos.z = max(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE);
  726. #endif
  727. #endif
  728. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  729. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  730. vertexInput.positionWS = positionWS;
  731. vertexInput.positionCS = clipPos;
  732. o.shadowCoord = GetShadowCoord( vertexInput );
  733. #endif
  734. o.clipPos = clipPos;
  735. return o;
  736. }
  737. #if defined(TESSELLATION_ON)
  738. struct VertexControl
  739. {
  740. float4 vertex : INTERNALTESSPOS;
  741. float3 ase_normal : NORMAL;
  742. UNITY_VERTEX_INPUT_INSTANCE_ID
  743. };
  744. struct TessellationFactors
  745. {
  746. float edge[3] : SV_TessFactor;
  747. float inside : SV_InsideTessFactor;
  748. };
  749. VertexControl vert ( VertexInput v )
  750. {
  751. VertexControl o;
  752. UNITY_SETUP_INSTANCE_ID(v);
  753. UNITY_TRANSFER_INSTANCE_ID(v, o);
  754. o.vertex = v.vertex;
  755. o.ase_normal = v.ase_normal;
  756. return o;
  757. }
  758. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  759. {
  760. TessellationFactors o;
  761. float4 tf = 1;
  762. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  763. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  764. #if defined(ASE_FIXED_TESSELLATION)
  765. tf = FixedTess( tessValue );
  766. #elif defined(ASE_DISTANCE_TESSELLATION)
  767. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  768. #elif defined(ASE_LENGTH_TESSELLATION)
  769. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  770. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  771. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  772. #endif
  773. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  774. return o;
  775. }
  776. [domain("tri")]
  777. [partitioning("fractional_odd")]
  778. [outputtopology("triangle_cw")]
  779. [patchconstantfunc("TessellationFunction")]
  780. [outputcontrolpoints(3)]
  781. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  782. {
  783. return patch[id];
  784. }
  785. [domain("tri")]
  786. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  787. {
  788. VertexInput o = (VertexInput) 0;
  789. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  790. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  791. #if defined(ASE_PHONG_TESSELLATION)
  792. float3 pp[3];
  793. for (int i = 0; i < 3; ++i)
  794. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  795. float phongStrength = _TessPhongStrength;
  796. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  797. #endif
  798. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  799. return VertexFunction(o);
  800. }
  801. #else
  802. VertexOutput vert ( VertexInput v )
  803. {
  804. return VertexFunction( v );
  805. }
  806. #endif
  807. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
  808. #define ASE_SV_DEPTH SV_DepthLessEqual
  809. #else
  810. #define ASE_SV_DEPTH SV_Depth
  811. #endif
  812. half4 frag( VertexOutput IN
  813. #ifdef ASE_DEPTH_WRITE_ON
  814. ,out float outputDepth : ASE_SV_DEPTH
  815. #endif
  816. ) : SV_TARGET
  817. {
  818. UNITY_SETUP_INSTANCE_ID( IN );
  819. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
  820. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  821. float3 WorldPosition = IN.worldPos;
  822. #endif
  823. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  824. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  825. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  826. ShadowCoords = IN.shadowCoord;
  827. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  828. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  829. #endif
  830. #endif
  831. float Alpha = 1;
  832. float AlphaClipThreshold = 0.5;
  833. float AlphaClipThresholdShadow = 0.5;
  834. #ifdef ASE_DEPTH_WRITE_ON
  835. float DepthValue = 0;
  836. #endif
  837. #ifdef _ALPHATEST_ON
  838. #ifdef _ALPHATEST_SHADOW_ON
  839. clip(Alpha - AlphaClipThresholdShadow);
  840. #else
  841. clip(Alpha - AlphaClipThreshold);
  842. #endif
  843. #endif
  844. #ifdef LOD_FADE_CROSSFADE
  845. LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
  846. #endif
  847. #ifdef ASE_DEPTH_WRITE_ON
  848. outputDepth = DepthValue;
  849. #endif
  850. return 0;
  851. }
  852. ENDHLSL
  853. }
  854. Pass
  855. {
  856. Name "DepthOnly"
  857. Tags { "LightMode"="DepthOnly" }
  858. ZWrite On
  859. ColorMask 0
  860. AlphaToMask Off
  861. HLSLPROGRAM
  862. #define _SPECULAR_SETUP 1
  863. #define _NORMAL_DROPOFF_TS 1
  864. #pragma multi_compile_instancing
  865. #pragma multi_compile _ LOD_FADE_CROSSFADE
  866. #pragma multi_compile_fog
  867. #define ASE_FOG 1
  868. #define _NORMALMAP 1
  869. #define ASE_SRP_VERSION 100500
  870. #pragma vertex vert
  871. #pragma fragment frag
  872. #define SHADERPASS_DEPTHONLY
  873. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  874. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  875. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  876. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  877. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  878. struct VertexInput
  879. {
  880. float4 vertex : POSITION;
  881. float3 ase_normal : NORMAL;
  882. UNITY_VERTEX_INPUT_INSTANCE_ID
  883. };
  884. struct VertexOutput
  885. {
  886. float4 clipPos : SV_POSITION;
  887. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  888. float3 worldPos : TEXCOORD0;
  889. #endif
  890. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  891. float4 shadowCoord : TEXCOORD1;
  892. #endif
  893. UNITY_VERTEX_INPUT_INSTANCE_ID
  894. UNITY_VERTEX_OUTPUT_STEREO
  895. };
  896. CBUFFER_START(UnityPerMaterial)
  897. float4 _Control_ST;
  898. float4 _Splat0_ST;
  899. float4 _Splat1_ST;
  900. float4 _SpecularColor;
  901. float _Smoothness0;
  902. float _Smoothness1;
  903. float _NormalIntensity0;
  904. float _NormalIntensity1;
  905. #ifdef _TRANSMISSION_ASE
  906. float _TransmissionShadow;
  907. #endif
  908. #ifdef _TRANSLUCENCY_ASE
  909. float _TransStrength;
  910. float _TransNormal;
  911. float _TransScattering;
  912. float _TransDirect;
  913. float _TransAmbient;
  914. float _TransShadow;
  915. #endif
  916. #ifdef TESSELLATION_ON
  917. float _TessPhongStrength;
  918. float _TessValue;
  919. float _TessMin;
  920. float _TessMax;
  921. float _TessEdgeLength;
  922. float _TessMaxDisp;
  923. #endif
  924. CBUFFER_END
  925. VertexOutput VertexFunction( VertexInput v )
  926. {
  927. VertexOutput o = (VertexOutput)0;
  928. UNITY_SETUP_INSTANCE_ID(v);
  929. UNITY_TRANSFER_INSTANCE_ID(v, o);
  930. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  931. #ifdef ASE_ABSOLUTE_VERTEX_POS
  932. float3 defaultVertexValue = v.vertex.xyz;
  933. #else
  934. float3 defaultVertexValue = float3(0, 0, 0);
  935. #endif
  936. float3 vertexValue = defaultVertexValue;
  937. #ifdef ASE_ABSOLUTE_VERTEX_POS
  938. v.vertex.xyz = vertexValue;
  939. #else
  940. v.vertex.xyz += vertexValue;
  941. #endif
  942. v.ase_normal = v.ase_normal;
  943. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  944. float4 positionCS = TransformWorldToHClip( positionWS );
  945. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  946. o.worldPos = positionWS;
  947. #endif
  948. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  949. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  950. vertexInput.positionWS = positionWS;
  951. vertexInput.positionCS = positionCS;
  952. o.shadowCoord = GetShadowCoord( vertexInput );
  953. #endif
  954. o.clipPos = positionCS;
  955. return o;
  956. }
  957. #if defined(TESSELLATION_ON)
  958. struct VertexControl
  959. {
  960. float4 vertex : INTERNALTESSPOS;
  961. float3 ase_normal : NORMAL;
  962. UNITY_VERTEX_INPUT_INSTANCE_ID
  963. };
  964. struct TessellationFactors
  965. {
  966. float edge[3] : SV_TessFactor;
  967. float inside : SV_InsideTessFactor;
  968. };
  969. VertexControl vert ( VertexInput v )
  970. {
  971. VertexControl o;
  972. UNITY_SETUP_INSTANCE_ID(v);
  973. UNITY_TRANSFER_INSTANCE_ID(v, o);
  974. o.vertex = v.vertex;
  975. o.ase_normal = v.ase_normal;
  976. return o;
  977. }
  978. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  979. {
  980. TessellationFactors o;
  981. float4 tf = 1;
  982. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  983. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  984. #if defined(ASE_FIXED_TESSELLATION)
  985. tf = FixedTess( tessValue );
  986. #elif defined(ASE_DISTANCE_TESSELLATION)
  987. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  988. #elif defined(ASE_LENGTH_TESSELLATION)
  989. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  990. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  991. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  992. #endif
  993. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  994. return o;
  995. }
  996. [domain("tri")]
  997. [partitioning("fractional_odd")]
  998. [outputtopology("triangle_cw")]
  999. [patchconstantfunc("TessellationFunction")]
  1000. [outputcontrolpoints(3)]
  1001. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1002. {
  1003. return patch[id];
  1004. }
  1005. [domain("tri")]
  1006. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1007. {
  1008. VertexInput o = (VertexInput) 0;
  1009. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1010. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  1011. #if defined(ASE_PHONG_TESSELLATION)
  1012. float3 pp[3];
  1013. for (int i = 0; i < 3; ++i)
  1014. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  1015. float phongStrength = _TessPhongStrength;
  1016. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  1017. #endif
  1018. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  1019. return VertexFunction(o);
  1020. }
  1021. #else
  1022. VertexOutput vert ( VertexInput v )
  1023. {
  1024. return VertexFunction( v );
  1025. }
  1026. #endif
  1027. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
  1028. #define ASE_SV_DEPTH SV_DepthLessEqual
  1029. #else
  1030. #define ASE_SV_DEPTH SV_Depth
  1031. #endif
  1032. half4 frag( VertexOutput IN
  1033. #ifdef ASE_DEPTH_WRITE_ON
  1034. ,out float outputDepth : ASE_SV_DEPTH
  1035. #endif
  1036. ) : SV_TARGET
  1037. {
  1038. UNITY_SETUP_INSTANCE_ID(IN);
  1039. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
  1040. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1041. float3 WorldPosition = IN.worldPos;
  1042. #endif
  1043. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1044. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1045. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1046. ShadowCoords = IN.shadowCoord;
  1047. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1048. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1049. #endif
  1050. #endif
  1051. float Alpha = 1;
  1052. float AlphaClipThreshold = 0.5;
  1053. #ifdef ASE_DEPTH_WRITE_ON
  1054. float DepthValue = 0;
  1055. #endif
  1056. #ifdef _ALPHATEST_ON
  1057. clip(Alpha - AlphaClipThreshold);
  1058. #endif
  1059. #ifdef LOD_FADE_CROSSFADE
  1060. LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
  1061. #endif
  1062. #ifdef ASE_DEPTH_WRITE_ON
  1063. outputDepth = DepthValue;
  1064. #endif
  1065. return 0;
  1066. }
  1067. ENDHLSL
  1068. }
  1069. Pass
  1070. {
  1071. Name "Meta"
  1072. Tags { "LightMode"="Meta" }
  1073. Cull Off
  1074. HLSLPROGRAM
  1075. #define _SPECULAR_SETUP 1
  1076. #define _NORMAL_DROPOFF_TS 1
  1077. #pragma multi_compile_instancing
  1078. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1079. #pragma multi_compile_fog
  1080. #define ASE_FOG 1
  1081. #define _NORMALMAP 1
  1082. #define ASE_SRP_VERSION 100500
  1083. #pragma vertex vert
  1084. #pragma fragment frag
  1085. #define SHADERPASS_META
  1086. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1087. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
  1088. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1089. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1090. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  1091. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  1092. struct VertexInput
  1093. {
  1094. float4 vertex : POSITION;
  1095. float3 ase_normal : NORMAL;
  1096. float4 texcoord1 : TEXCOORD1;
  1097. float4 texcoord2 : TEXCOORD2;
  1098. float4 ase_texcoord : TEXCOORD0;
  1099. UNITY_VERTEX_INPUT_INSTANCE_ID
  1100. };
  1101. struct VertexOutput
  1102. {
  1103. float4 clipPos : SV_POSITION;
  1104. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1105. float3 worldPos : TEXCOORD0;
  1106. #endif
  1107. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1108. float4 shadowCoord : TEXCOORD1;
  1109. #endif
  1110. float4 ase_texcoord2 : TEXCOORD2;
  1111. UNITY_VERTEX_INPUT_INSTANCE_ID
  1112. UNITY_VERTEX_OUTPUT_STEREO
  1113. };
  1114. CBUFFER_START(UnityPerMaterial)
  1115. float4 _Control_ST;
  1116. float4 _Splat0_ST;
  1117. float4 _Splat1_ST;
  1118. float4 _SpecularColor;
  1119. float _Smoothness0;
  1120. float _Smoothness1;
  1121. float _NormalIntensity0;
  1122. float _NormalIntensity1;
  1123. #ifdef _TRANSMISSION_ASE
  1124. float _TransmissionShadow;
  1125. #endif
  1126. #ifdef _TRANSLUCENCY_ASE
  1127. float _TransStrength;
  1128. float _TransNormal;
  1129. float _TransScattering;
  1130. float _TransDirect;
  1131. float _TransAmbient;
  1132. float _TransShadow;
  1133. #endif
  1134. #ifdef TESSELLATION_ON
  1135. float _TessPhongStrength;
  1136. float _TessValue;
  1137. float _TessMin;
  1138. float _TessMax;
  1139. float _TessEdgeLength;
  1140. float _TessMaxDisp;
  1141. #endif
  1142. CBUFFER_END
  1143. sampler2D _Control;
  1144. sampler2D _Splat0;
  1145. sampler2D _Splat1;
  1146. float4 WeightedBlend2144( half4 Weight, float4 Layer1, float4 Layer2 )
  1147. {
  1148. return Layer1 * Weight.r + Layer2 * Weight.g;
  1149. }
  1150. VertexOutput VertexFunction( VertexInput v )
  1151. {
  1152. VertexOutput o = (VertexOutput)0;
  1153. UNITY_SETUP_INSTANCE_ID(v);
  1154. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1155. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  1156. o.ase_texcoord2.xy = v.ase_texcoord.xy;
  1157. //setting value to unused interpolator channels and avoid initialization warnings
  1158. o.ase_texcoord2.zw = 0;
  1159. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1160. float3 defaultVertexValue = v.vertex.xyz;
  1161. #else
  1162. float3 defaultVertexValue = float3(0, 0, 0);
  1163. #endif
  1164. float3 vertexValue = defaultVertexValue;
  1165. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1166. v.vertex.xyz = vertexValue;
  1167. #else
  1168. v.vertex.xyz += vertexValue;
  1169. #endif
  1170. v.ase_normal = v.ase_normal;
  1171. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  1172. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1173. o.worldPos = positionWS;
  1174. #endif
  1175. o.clipPos = MetaVertexPosition( v.vertex, v.texcoord1.xy, v.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST );
  1176. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1177. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1178. vertexInput.positionWS = positionWS;
  1179. vertexInput.positionCS = o.clipPos;
  1180. o.shadowCoord = GetShadowCoord( vertexInput );
  1181. #endif
  1182. return o;
  1183. }
  1184. #if defined(TESSELLATION_ON)
  1185. struct VertexControl
  1186. {
  1187. float4 vertex : INTERNALTESSPOS;
  1188. float3 ase_normal : NORMAL;
  1189. float4 texcoord1 : TEXCOORD1;
  1190. float4 texcoord2 : TEXCOORD2;
  1191. float4 ase_texcoord : TEXCOORD0;
  1192. UNITY_VERTEX_INPUT_INSTANCE_ID
  1193. };
  1194. struct TessellationFactors
  1195. {
  1196. float edge[3] : SV_TessFactor;
  1197. float inside : SV_InsideTessFactor;
  1198. };
  1199. VertexControl vert ( VertexInput v )
  1200. {
  1201. VertexControl o;
  1202. UNITY_SETUP_INSTANCE_ID(v);
  1203. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1204. o.vertex = v.vertex;
  1205. o.ase_normal = v.ase_normal;
  1206. o.texcoord1 = v.texcoord1;
  1207. o.texcoord2 = v.texcoord2;
  1208. o.ase_texcoord = v.ase_texcoord;
  1209. return o;
  1210. }
  1211. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  1212. {
  1213. TessellationFactors o;
  1214. float4 tf = 1;
  1215. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1216. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1217. #if defined(ASE_FIXED_TESSELLATION)
  1218. tf = FixedTess( tessValue );
  1219. #elif defined(ASE_DISTANCE_TESSELLATION)
  1220. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1221. #elif defined(ASE_LENGTH_TESSELLATION)
  1222. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1223. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1224. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1225. #endif
  1226. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  1227. return o;
  1228. }
  1229. [domain("tri")]
  1230. [partitioning("fractional_odd")]
  1231. [outputtopology("triangle_cw")]
  1232. [patchconstantfunc("TessellationFunction")]
  1233. [outputcontrolpoints(3)]
  1234. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1235. {
  1236. return patch[id];
  1237. }
  1238. [domain("tri")]
  1239. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1240. {
  1241. VertexInput o = (VertexInput) 0;
  1242. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1243. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  1244. o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  1245. o.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  1246. o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1247. #if defined(ASE_PHONG_TESSELLATION)
  1248. float3 pp[3];
  1249. for (int i = 0; i < 3; ++i)
  1250. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  1251. float phongStrength = _TessPhongStrength;
  1252. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  1253. #endif
  1254. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  1255. return VertexFunction(o);
  1256. }
  1257. #else
  1258. VertexOutput vert ( VertexInput v )
  1259. {
  1260. return VertexFunction( v );
  1261. }
  1262. #endif
  1263. half4 frag(VertexOutput IN ) : SV_TARGET
  1264. {
  1265. UNITY_SETUP_INSTANCE_ID(IN);
  1266. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
  1267. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1268. float3 WorldPosition = IN.worldPos;
  1269. #endif
  1270. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1271. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1272. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1273. ShadowCoords = IN.shadowCoord;
  1274. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1275. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1276. #endif
  1277. #endif
  1278. float4 localBreakRGBA115 = ( float4( 0,0,0,0 ) );
  1279. float2 uv_Control = IN.ase_texcoord2.xy * _Control_ST.xy + _Control_ST.zw;
  1280. float4 tex2DNode6 = tex2D( _Control, uv_Control );
  1281. float4 Weight144 = tex2DNode6;
  1282. float2 uv_Splat0 = IN.ase_texcoord2.xy * _Splat0_ST.xy + _Splat0_ST.zw;
  1283. float4 appendResult123 = (float4(1.0 , 1.0 , 1.0 , _Smoothness0));
  1284. float4 Layer1144 = ( tex2D( _Splat0, uv_Splat0 ) * appendResult123 );
  1285. float2 uv_Splat1 = IN.ase_texcoord2.xy * _Splat1_ST.xy + _Splat1_ST.zw;
  1286. float4 appendResult126 = (float4(1.0 , 1.0 , 1.0 , _Smoothness1));
  1287. float4 Layer2144 = ( tex2D( _Splat1, uv_Splat1 ) * appendResult126 );
  1288. float4 localWeightedBlend2144 = WeightedBlend2144( Weight144 , Layer1144 , Layer2144 );
  1289. float4 RGBA115 = localWeightedBlend2144;
  1290. float3 RGB115 = float3( 0,0,0 );
  1291. float A115 = 0;
  1292. {
  1293. RGB115 = RGBA115.rgb;
  1294. A115 = RGBA115.a;
  1295. }
  1296. float3 Albedo = RGB115;
  1297. float3 Emission = 0;
  1298. float Alpha = 1;
  1299. float AlphaClipThreshold = 0.5;
  1300. #ifdef _ALPHATEST_ON
  1301. clip(Alpha - AlphaClipThreshold);
  1302. #endif
  1303. MetaInput metaInput = (MetaInput)0;
  1304. metaInput.Albedo = Albedo;
  1305. metaInput.Emission = Emission;
  1306. return MetaFragment(metaInput);
  1307. }
  1308. ENDHLSL
  1309. }
  1310. Pass
  1311. {
  1312. Name "Universal2D"
  1313. Tags { "LightMode"="Universal2D" }
  1314. Blend One Zero, One Zero
  1315. ZWrite On
  1316. ZTest LEqual
  1317. Offset 0 , 0
  1318. ColorMask RGBA
  1319. HLSLPROGRAM
  1320. #define _SPECULAR_SETUP 1
  1321. #define _NORMAL_DROPOFF_TS 1
  1322. #pragma multi_compile_instancing
  1323. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1324. #pragma multi_compile_fog
  1325. #define ASE_FOG 1
  1326. #define _NORMALMAP 1
  1327. #define ASE_SRP_VERSION 100500
  1328. #pragma vertex vert
  1329. #pragma fragment frag
  1330. #define SHADERPASS_2D
  1331. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1332. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1333. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1334. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
  1335. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1336. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  1337. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  1338. struct VertexInput
  1339. {
  1340. float4 vertex : POSITION;
  1341. float3 ase_normal : NORMAL;
  1342. float4 ase_texcoord : TEXCOORD0;
  1343. UNITY_VERTEX_INPUT_INSTANCE_ID
  1344. };
  1345. struct VertexOutput
  1346. {
  1347. float4 clipPos : SV_POSITION;
  1348. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1349. float3 worldPos : TEXCOORD0;
  1350. #endif
  1351. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1352. float4 shadowCoord : TEXCOORD1;
  1353. #endif
  1354. float4 ase_texcoord2 : TEXCOORD2;
  1355. UNITY_VERTEX_INPUT_INSTANCE_ID
  1356. UNITY_VERTEX_OUTPUT_STEREO
  1357. };
  1358. CBUFFER_START(UnityPerMaterial)
  1359. float4 _Control_ST;
  1360. float4 _Splat0_ST;
  1361. float4 _Splat1_ST;
  1362. float4 _SpecularColor;
  1363. float _Smoothness0;
  1364. float _Smoothness1;
  1365. float _NormalIntensity0;
  1366. float _NormalIntensity1;
  1367. #ifdef _TRANSMISSION_ASE
  1368. float _TransmissionShadow;
  1369. #endif
  1370. #ifdef _TRANSLUCENCY_ASE
  1371. float _TransStrength;
  1372. float _TransNormal;
  1373. float _TransScattering;
  1374. float _TransDirect;
  1375. float _TransAmbient;
  1376. float _TransShadow;
  1377. #endif
  1378. #ifdef TESSELLATION_ON
  1379. float _TessPhongStrength;
  1380. float _TessValue;
  1381. float _TessMin;
  1382. float _TessMax;
  1383. float _TessEdgeLength;
  1384. float _TessMaxDisp;
  1385. #endif
  1386. CBUFFER_END
  1387. sampler2D _Control;
  1388. sampler2D _Splat0;
  1389. sampler2D _Splat1;
  1390. float4 WeightedBlend2144( half4 Weight, float4 Layer1, float4 Layer2 )
  1391. {
  1392. return Layer1 * Weight.r + Layer2 * Weight.g;
  1393. }
  1394. VertexOutput VertexFunction( VertexInput v )
  1395. {
  1396. VertexOutput o = (VertexOutput)0;
  1397. UNITY_SETUP_INSTANCE_ID( v );
  1398. UNITY_TRANSFER_INSTANCE_ID( v, o );
  1399. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
  1400. o.ase_texcoord2.xy = v.ase_texcoord.xy;
  1401. //setting value to unused interpolator channels and avoid initialization warnings
  1402. o.ase_texcoord2.zw = 0;
  1403. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1404. float3 defaultVertexValue = v.vertex.xyz;
  1405. #else
  1406. float3 defaultVertexValue = float3(0, 0, 0);
  1407. #endif
  1408. float3 vertexValue = defaultVertexValue;
  1409. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1410. v.vertex.xyz = vertexValue;
  1411. #else
  1412. v.vertex.xyz += vertexValue;
  1413. #endif
  1414. v.ase_normal = v.ase_normal;
  1415. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  1416. float4 positionCS = TransformWorldToHClip( positionWS );
  1417. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1418. o.worldPos = positionWS;
  1419. #endif
  1420. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1421. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1422. vertexInput.positionWS = positionWS;
  1423. vertexInput.positionCS = positionCS;
  1424. o.shadowCoord = GetShadowCoord( vertexInput );
  1425. #endif
  1426. o.clipPos = positionCS;
  1427. return o;
  1428. }
  1429. #if defined(TESSELLATION_ON)
  1430. struct VertexControl
  1431. {
  1432. float4 vertex : INTERNALTESSPOS;
  1433. float3 ase_normal : NORMAL;
  1434. float4 ase_texcoord : TEXCOORD0;
  1435. UNITY_VERTEX_INPUT_INSTANCE_ID
  1436. };
  1437. struct TessellationFactors
  1438. {
  1439. float edge[3] : SV_TessFactor;
  1440. float inside : SV_InsideTessFactor;
  1441. };
  1442. VertexControl vert ( VertexInput v )
  1443. {
  1444. VertexControl o;
  1445. UNITY_SETUP_INSTANCE_ID(v);
  1446. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1447. o.vertex = v.vertex;
  1448. o.ase_normal = v.ase_normal;
  1449. o.ase_texcoord = v.ase_texcoord;
  1450. return o;
  1451. }
  1452. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  1453. {
  1454. TessellationFactors o;
  1455. float4 tf = 1;
  1456. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1457. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1458. #if defined(ASE_FIXED_TESSELLATION)
  1459. tf = FixedTess( tessValue );
  1460. #elif defined(ASE_DISTANCE_TESSELLATION)
  1461. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1462. #elif defined(ASE_LENGTH_TESSELLATION)
  1463. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1464. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1465. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1466. #endif
  1467. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  1468. return o;
  1469. }
  1470. [domain("tri")]
  1471. [partitioning("fractional_odd")]
  1472. [outputtopology("triangle_cw")]
  1473. [patchconstantfunc("TessellationFunction")]
  1474. [outputcontrolpoints(3)]
  1475. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1476. {
  1477. return patch[id];
  1478. }
  1479. [domain("tri")]
  1480. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1481. {
  1482. VertexInput o = (VertexInput) 0;
  1483. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1484. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  1485. o.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1486. #if defined(ASE_PHONG_TESSELLATION)
  1487. float3 pp[3];
  1488. for (int i = 0; i < 3; ++i)
  1489. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  1490. float phongStrength = _TessPhongStrength;
  1491. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  1492. #endif
  1493. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  1494. return VertexFunction(o);
  1495. }
  1496. #else
  1497. VertexOutput vert ( VertexInput v )
  1498. {
  1499. return VertexFunction( v );
  1500. }
  1501. #endif
  1502. half4 frag(VertexOutput IN ) : SV_TARGET
  1503. {
  1504. UNITY_SETUP_INSTANCE_ID( IN );
  1505. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
  1506. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1507. float3 WorldPosition = IN.worldPos;
  1508. #endif
  1509. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1510. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1511. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1512. ShadowCoords = IN.shadowCoord;
  1513. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1514. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1515. #endif
  1516. #endif
  1517. float4 localBreakRGBA115 = ( float4( 0,0,0,0 ) );
  1518. float2 uv_Control = IN.ase_texcoord2.xy * _Control_ST.xy + _Control_ST.zw;
  1519. float4 tex2DNode6 = tex2D( _Control, uv_Control );
  1520. float4 Weight144 = tex2DNode6;
  1521. float2 uv_Splat0 = IN.ase_texcoord2.xy * _Splat0_ST.xy + _Splat0_ST.zw;
  1522. float4 appendResult123 = (float4(1.0 , 1.0 , 1.0 , _Smoothness0));
  1523. float4 Layer1144 = ( tex2D( _Splat0, uv_Splat0 ) * appendResult123 );
  1524. float2 uv_Splat1 = IN.ase_texcoord2.xy * _Splat1_ST.xy + _Splat1_ST.zw;
  1525. float4 appendResult126 = (float4(1.0 , 1.0 , 1.0 , _Smoothness1));
  1526. float4 Layer2144 = ( tex2D( _Splat1, uv_Splat1 ) * appendResult126 );
  1527. float4 localWeightedBlend2144 = WeightedBlend2144( Weight144 , Layer1144 , Layer2144 );
  1528. float4 RGBA115 = localWeightedBlend2144;
  1529. float3 RGB115 = float3( 0,0,0 );
  1530. float A115 = 0;
  1531. {
  1532. RGB115 = RGBA115.rgb;
  1533. A115 = RGBA115.a;
  1534. }
  1535. float3 Albedo = RGB115;
  1536. float Alpha = 1;
  1537. float AlphaClipThreshold = 0.5;
  1538. half4 color = half4( Albedo, Alpha );
  1539. #ifdef _ALPHATEST_ON
  1540. clip(Alpha - AlphaClipThreshold);
  1541. #endif
  1542. return color;
  1543. }
  1544. ENDHLSL
  1545. }
  1546. Pass
  1547. {
  1548. Name "DepthNormals"
  1549. Tags { "LightMode"="DepthNormals" }
  1550. ZWrite On
  1551. Blend One Zero
  1552. ZTest LEqual
  1553. ZWrite On
  1554. HLSLPROGRAM
  1555. #define _SPECULAR_SETUP 1
  1556. #define _NORMAL_DROPOFF_TS 1
  1557. #pragma multi_compile_instancing
  1558. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1559. #pragma multi_compile_fog
  1560. #define ASE_FOG 1
  1561. #define _NORMALMAP 1
  1562. #define ASE_SRP_VERSION 100500
  1563. #pragma vertex vert
  1564. #pragma fragment frag
  1565. #define SHADERPASS_DEPTHNORMALSONLY
  1566. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1567. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1568. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1569. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1570. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  1571. struct VertexInput
  1572. {
  1573. float4 vertex : POSITION;
  1574. float3 ase_normal : NORMAL;
  1575. UNITY_VERTEX_INPUT_INSTANCE_ID
  1576. };
  1577. struct VertexOutput
  1578. {
  1579. float4 clipPos : SV_POSITION;
  1580. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1581. float3 worldPos : TEXCOORD0;
  1582. #endif
  1583. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1584. float4 shadowCoord : TEXCOORD1;
  1585. #endif
  1586. float3 worldNormal : TEXCOORD2;
  1587. UNITY_VERTEX_INPUT_INSTANCE_ID
  1588. UNITY_VERTEX_OUTPUT_STEREO
  1589. };
  1590. CBUFFER_START(UnityPerMaterial)
  1591. float4 _Control_ST;
  1592. float4 _Splat0_ST;
  1593. float4 _Splat1_ST;
  1594. float4 _SpecularColor;
  1595. float _Smoothness0;
  1596. float _Smoothness1;
  1597. float _NormalIntensity0;
  1598. float _NormalIntensity1;
  1599. #ifdef _TRANSMISSION_ASE
  1600. float _TransmissionShadow;
  1601. #endif
  1602. #ifdef _TRANSLUCENCY_ASE
  1603. float _TransStrength;
  1604. float _TransNormal;
  1605. float _TransScattering;
  1606. float _TransDirect;
  1607. float _TransAmbient;
  1608. float _TransShadow;
  1609. #endif
  1610. #ifdef TESSELLATION_ON
  1611. float _TessPhongStrength;
  1612. float _TessValue;
  1613. float _TessMin;
  1614. float _TessMax;
  1615. float _TessEdgeLength;
  1616. float _TessMaxDisp;
  1617. #endif
  1618. CBUFFER_END
  1619. VertexOutput VertexFunction( VertexInput v )
  1620. {
  1621. VertexOutput o = (VertexOutput)0;
  1622. UNITY_SETUP_INSTANCE_ID(v);
  1623. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1624. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  1625. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1626. float3 defaultVertexValue = v.vertex.xyz;
  1627. #else
  1628. float3 defaultVertexValue = float3(0, 0, 0);
  1629. #endif
  1630. float3 vertexValue = defaultVertexValue;
  1631. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1632. v.vertex.xyz = vertexValue;
  1633. #else
  1634. v.vertex.xyz += vertexValue;
  1635. #endif
  1636. v.ase_normal = v.ase_normal;
  1637. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  1638. float3 normalWS = TransformObjectToWorldNormal( v.ase_normal );
  1639. float4 positionCS = TransformWorldToHClip( positionWS );
  1640. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1641. o.worldPos = positionWS;
  1642. #endif
  1643. o.worldNormal = normalWS;
  1644. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1645. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1646. vertexInput.positionWS = positionWS;
  1647. vertexInput.positionCS = positionCS;
  1648. o.shadowCoord = GetShadowCoord( vertexInput );
  1649. #endif
  1650. o.clipPos = positionCS;
  1651. return o;
  1652. }
  1653. #if defined(TESSELLATION_ON)
  1654. struct VertexControl
  1655. {
  1656. float4 vertex : INTERNALTESSPOS;
  1657. float3 ase_normal : NORMAL;
  1658. UNITY_VERTEX_INPUT_INSTANCE_ID
  1659. };
  1660. struct TessellationFactors
  1661. {
  1662. float edge[3] : SV_TessFactor;
  1663. float inside : SV_InsideTessFactor;
  1664. };
  1665. VertexControl vert ( VertexInput v )
  1666. {
  1667. VertexControl o;
  1668. UNITY_SETUP_INSTANCE_ID(v);
  1669. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1670. o.vertex = v.vertex;
  1671. o.ase_normal = v.ase_normal;
  1672. return o;
  1673. }
  1674. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  1675. {
  1676. TessellationFactors o;
  1677. float4 tf = 1;
  1678. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1679. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1680. #if defined(ASE_FIXED_TESSELLATION)
  1681. tf = FixedTess( tessValue );
  1682. #elif defined(ASE_DISTANCE_TESSELLATION)
  1683. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1684. #elif defined(ASE_LENGTH_TESSELLATION)
  1685. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1686. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1687. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1688. #endif
  1689. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  1690. return o;
  1691. }
  1692. [domain("tri")]
  1693. [partitioning("fractional_odd")]
  1694. [outputtopology("triangle_cw")]
  1695. [patchconstantfunc("TessellationFunction")]
  1696. [outputcontrolpoints(3)]
  1697. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1698. {
  1699. return patch[id];
  1700. }
  1701. [domain("tri")]
  1702. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1703. {
  1704. VertexInput o = (VertexInput) 0;
  1705. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1706. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  1707. #if defined(ASE_PHONG_TESSELLATION)
  1708. float3 pp[3];
  1709. for (int i = 0; i < 3; ++i)
  1710. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  1711. float phongStrength = _TessPhongStrength;
  1712. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  1713. #endif
  1714. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  1715. return VertexFunction(o);
  1716. }
  1717. #else
  1718. VertexOutput vert ( VertexInput v )
  1719. {
  1720. return VertexFunction( v );
  1721. }
  1722. #endif
  1723. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
  1724. #define ASE_SV_DEPTH SV_DepthLessEqual
  1725. #else
  1726. #define ASE_SV_DEPTH SV_Depth
  1727. #endif
  1728. half4 frag( VertexOutput IN
  1729. #ifdef ASE_DEPTH_WRITE_ON
  1730. ,out float outputDepth : ASE_SV_DEPTH
  1731. #endif
  1732. ) : SV_TARGET
  1733. {
  1734. UNITY_SETUP_INSTANCE_ID(IN);
  1735. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
  1736. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1737. float3 WorldPosition = IN.worldPos;
  1738. #endif
  1739. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1740. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1741. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1742. ShadowCoords = IN.shadowCoord;
  1743. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1744. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1745. #endif
  1746. #endif
  1747. float Alpha = 1;
  1748. float AlphaClipThreshold = 0.5;
  1749. #ifdef ASE_DEPTH_WRITE_ON
  1750. float DepthValue = 0;
  1751. #endif
  1752. #ifdef _ALPHATEST_ON
  1753. clip(Alpha - AlphaClipThreshold);
  1754. #endif
  1755. #ifdef LOD_FADE_CROSSFADE
  1756. LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
  1757. #endif
  1758. #ifdef ASE_DEPTH_WRITE_ON
  1759. outputDepth = DepthValue;
  1760. #endif
  1761. return float4(PackNormalOctRectEncode(TransformWorldToViewDir(IN.worldNormal, true)), 0.0, 0.0);
  1762. }
  1763. ENDHLSL
  1764. }
  1765. Pass
  1766. {
  1767. Name "GBuffer"
  1768. Tags { "LightMode"="UniversalGBuffer" }
  1769. Blend One Zero, One Zero
  1770. ZWrite On
  1771. ZTest LEqual
  1772. Offset 0 , 0
  1773. ColorMask RGBA
  1774. HLSLPROGRAM
  1775. #define _SPECULAR_SETUP 1
  1776. #define _NORMAL_DROPOFF_TS 1
  1777. #pragma multi_compile_instancing
  1778. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1779. #pragma multi_compile_fog
  1780. #define ASE_FOG 1
  1781. #define _NORMALMAP 1
  1782. #define ASE_SRP_VERSION 100500
  1783. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
  1784. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
  1785. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  1786. #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
  1787. #pragma multi_compile _ _SHADOWS_SOFT
  1788. #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
  1789. #pragma multi_compile _ _GBUFFER_NORMALS_OCT
  1790. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  1791. #pragma multi_compile _ LIGHTMAP_ON
  1792. #pragma vertex vert
  1793. #pragma fragment frag
  1794. #define SHADERPASS SHADERPASS_GBUFFER
  1795. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1796. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1797. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1798. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
  1799. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1800. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
  1801. #if ASE_SRP_VERSION <= 70108
  1802. #define REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR
  1803. #endif
  1804. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  1805. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  1806. #endif
  1807. #pragma shader_feature_local SMOOTHNESS_TEXTURE
  1808. #pragma shader_feature_local ENABLE_NORMAL_INTENSITY
  1809. struct VertexInput
  1810. {
  1811. float4 vertex : POSITION;
  1812. float3 ase_normal : NORMAL;
  1813. float4 ase_tangent : TANGENT;
  1814. float4 texcoord1 : TEXCOORD1;
  1815. float4 texcoord : TEXCOORD0;
  1816. UNITY_VERTEX_INPUT_INSTANCE_ID
  1817. };
  1818. struct VertexOutput
  1819. {
  1820. float4 clipPos : SV_POSITION;
  1821. float4 lightmapUVOrVertexSH : TEXCOORD0;
  1822. half4 fogFactorAndVertexLight : TEXCOORD1;
  1823. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1824. float4 shadowCoord : TEXCOORD2;
  1825. #endif
  1826. float4 tSpace0 : TEXCOORD3;
  1827. float4 tSpace1 : TEXCOORD4;
  1828. float4 tSpace2 : TEXCOORD5;
  1829. #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
  1830. float4 screenPos : TEXCOORD6;
  1831. #endif
  1832. float4 ase_texcoord7 : TEXCOORD7;
  1833. UNITY_VERTEX_INPUT_INSTANCE_ID
  1834. UNITY_VERTEX_OUTPUT_STEREO
  1835. };
  1836. CBUFFER_START(UnityPerMaterial)
  1837. float4 _Control_ST;
  1838. float4 _Splat0_ST;
  1839. float4 _Splat1_ST;
  1840. float4 _SpecularColor;
  1841. float _Smoothness0;
  1842. float _Smoothness1;
  1843. float _NormalIntensity0;
  1844. float _NormalIntensity1;
  1845. #ifdef _TRANSMISSION_ASE
  1846. float _TransmissionShadow;
  1847. #endif
  1848. #ifdef _TRANSLUCENCY_ASE
  1849. float _TransStrength;
  1850. float _TransNormal;
  1851. float _TransScattering;
  1852. float _TransDirect;
  1853. float _TransAmbient;
  1854. float _TransShadow;
  1855. #endif
  1856. #ifdef TESSELLATION_ON
  1857. float _TessPhongStrength;
  1858. float _TessValue;
  1859. float _TessMin;
  1860. float _TessMax;
  1861. float _TessEdgeLength;
  1862. float _TessMaxDisp;
  1863. #endif
  1864. CBUFFER_END
  1865. sampler2D _Control;
  1866. sampler2D _Splat0;
  1867. sampler2D _Splat1;
  1868. sampler2D _Normal0;
  1869. sampler2D _Normal1;
  1870. float4 WeightedBlend2144( half4 Weight, float4 Layer1, float4 Layer2 )
  1871. {
  1872. return Layer1 * Weight.r + Layer2 * Weight.g;
  1873. }
  1874. inline float3 MTE_NormalIntensity_fixed147( float3 Normal, float Strength )
  1875. {
  1876. return lerp(Normal, float3(0,0,1), - Strength + 1.0);
  1877. }
  1878. inline float3 MTE_NormalIntensity_fixed150( float3 Normal, float Strength )
  1879. {
  1880. return lerp(Normal, float3(0,0,1), - Strength + 1.0);
  1881. }
  1882. float4 WeightedBlend2145( half4 Weight, float4 Layer1, float4 Layer2 )
  1883. {
  1884. return Layer1 * Weight.r + Layer2 * Weight.g;
  1885. }
  1886. VertexOutput VertexFunction( VertexInput v )
  1887. {
  1888. VertexOutput o = (VertexOutput)0;
  1889. UNITY_SETUP_INSTANCE_ID(v);
  1890. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1891. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  1892. o.ase_texcoord7.xy = v.texcoord.xy;
  1893. //setting value to unused interpolator channels and avoid initialization warnings
  1894. o.ase_texcoord7.zw = 0;
  1895. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1896. float3 defaultVertexValue = v.vertex.xyz;
  1897. #else
  1898. float3 defaultVertexValue = float3(0, 0, 0);
  1899. #endif
  1900. float3 vertexValue = defaultVertexValue;
  1901. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1902. v.vertex.xyz = vertexValue;
  1903. #else
  1904. v.vertex.xyz += vertexValue;
  1905. #endif
  1906. v.ase_normal = v.ase_normal;
  1907. float3 positionWS = TransformObjectToWorld( v.vertex.xyz );
  1908. float3 positionVS = TransformWorldToView( positionWS );
  1909. float4 positionCS = TransformWorldToHClip( positionWS );
  1910. VertexNormalInputs normalInput = GetVertexNormalInputs( v.ase_normal, v.ase_tangent );
  1911. o.tSpace0 = float4( normalInput.normalWS, positionWS.x);
  1912. o.tSpace1 = float4( normalInput.tangentWS, positionWS.y);
  1913. o.tSpace2 = float4( normalInput.bitangentWS, positionWS.z);
  1914. OUTPUT_LIGHTMAP_UV( v.texcoord1, unity_LightmapST, o.lightmapUVOrVertexSH.xy );
  1915. OUTPUT_SH( normalInput.normalWS.xyz, o.lightmapUVOrVertexSH.xyz );
  1916. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  1917. o.lightmapUVOrVertexSH.zw = v.texcoord;
  1918. o.lightmapUVOrVertexSH.xy = v.texcoord * unity_LightmapST.xy + unity_LightmapST.zw;
  1919. #endif
  1920. half3 vertexLight = VertexLighting( positionWS, normalInput.normalWS );
  1921. #ifdef ASE_FOG
  1922. half fogFactor = ComputeFogFactor( positionCS.z );
  1923. #else
  1924. half fogFactor = 0;
  1925. #endif
  1926. o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
  1927. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1928. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1929. vertexInput.positionWS = positionWS;
  1930. vertexInput.positionCS = positionCS;
  1931. o.shadowCoord = GetShadowCoord( vertexInput );
  1932. #endif
  1933. o.clipPos = positionCS;
  1934. #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
  1935. o.screenPos = ComputeScreenPos(positionCS);
  1936. #endif
  1937. return o;
  1938. }
  1939. #if defined(TESSELLATION_ON)
  1940. struct VertexControl
  1941. {
  1942. float4 vertex : INTERNALTESSPOS;
  1943. float3 ase_normal : NORMAL;
  1944. float4 ase_tangent : TANGENT;
  1945. float4 texcoord : TEXCOORD0;
  1946. float4 texcoord1 : TEXCOORD1;
  1947. UNITY_VERTEX_INPUT_INSTANCE_ID
  1948. };
  1949. struct TessellationFactors
  1950. {
  1951. float edge[3] : SV_TessFactor;
  1952. float inside : SV_InsideTessFactor;
  1953. };
  1954. VertexControl vert ( VertexInput v )
  1955. {
  1956. VertexControl o;
  1957. UNITY_SETUP_INSTANCE_ID(v);
  1958. UNITY_TRANSFER_INSTANCE_ID(v, o);
  1959. o.vertex = v.vertex;
  1960. o.ase_normal = v.ase_normal;
  1961. o.ase_tangent = v.ase_tangent;
  1962. o.texcoord = v.texcoord;
  1963. o.texcoord1 = v.texcoord1;
  1964. return o;
  1965. }
  1966. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> v)
  1967. {
  1968. TessellationFactors o;
  1969. float4 tf = 1;
  1970. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1971. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1972. #if defined(ASE_FIXED_TESSELLATION)
  1973. tf = FixedTess( tessValue );
  1974. #elif defined(ASE_DISTANCE_TESSELLATION)
  1975. tf = DistanceBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1976. #elif defined(ASE_LENGTH_TESSELLATION)
  1977. tf = EdgeLengthBasedTess(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1978. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1979. tf = EdgeLengthBasedTessCull(v[0].vertex, v[1].vertex, v[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1980. #endif
  1981. o.edge[0] = tf.x; o.edge[1] = tf.y; o.edge[2] = tf.z; o.inside = tf.w;
  1982. return o;
  1983. }
  1984. [domain("tri")]
  1985. [partitioning("fractional_odd")]
  1986. [outputtopology("triangle_cw")]
  1987. [patchconstantfunc("TessellationFunction")]
  1988. [outputcontrolpoints(3)]
  1989. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1990. {
  1991. return patch[id];
  1992. }
  1993. [domain("tri")]
  1994. VertexOutput DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1995. {
  1996. VertexInput o = (VertexInput) 0;
  1997. o.vertex = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1998. o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z;
  1999. o.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  2000. o.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  2001. o.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  2002. #if defined(ASE_PHONG_TESSELLATION)
  2003. float3 pp[3];
  2004. for (int i = 0; i < 3; ++i)
  2005. pp[i] = o.vertex.xyz - patch[i].ase_normal * (dot(o.vertex.xyz, patch[i].ase_normal) - dot(patch[i].vertex.xyz, patch[i].ase_normal));
  2006. float phongStrength = _TessPhongStrength;
  2007. o.vertex.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * o.vertex.xyz;
  2008. #endif
  2009. UNITY_TRANSFER_INSTANCE_ID(patch[0], o);
  2010. return VertexFunction(o);
  2011. }
  2012. #else
  2013. VertexOutput vert ( VertexInput v )
  2014. {
  2015. return VertexFunction( v );
  2016. }
  2017. #endif
  2018. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE)
  2019. #define ASE_SV_DEPTH SV_DepthLessEqual
  2020. #else
  2021. #define ASE_SV_DEPTH SV_Depth
  2022. #endif
  2023. FragmentOutput frag ( VertexOutput IN
  2024. #ifdef ASE_DEPTH_WRITE_ON
  2025. ,out float outputDepth : ASE_SV_DEPTH
  2026. #endif
  2027. )
  2028. {
  2029. UNITY_SETUP_INSTANCE_ID(IN);
  2030. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
  2031. #ifdef LOD_FADE_CROSSFADE
  2032. LODDitheringTransition( IN.clipPos.xyz, unity_LODFade.x );
  2033. #endif
  2034. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2035. float2 sampleCoords = (IN.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  2036. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  2037. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  2038. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  2039. #else
  2040. float3 WorldNormal = normalize( IN.tSpace0.xyz );
  2041. float3 WorldTangent = IN.tSpace1.xyz;
  2042. float3 WorldBiTangent = IN.tSpace2.xyz;
  2043. #endif
  2044. float3 WorldPosition = float3(IN.tSpace0.w,IN.tSpace1.w,IN.tSpace2.w);
  2045. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  2046. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  2047. #if defined(ASE_NEEDS_FRAG_SCREEN_POSITION)
  2048. float4 ScreenPos = IN.screenPos;
  2049. #endif
  2050. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2051. ShadowCoords = IN.shadowCoord;
  2052. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  2053. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  2054. #endif
  2055. WorldViewDirection = SafeNormalize( WorldViewDirection );
  2056. float4 localBreakRGBA115 = ( float4( 0,0,0,0 ) );
  2057. float2 uv_Control = IN.ase_texcoord7.xy * _Control_ST.xy + _Control_ST.zw;
  2058. float4 tex2DNode6 = tex2D( _Control, uv_Control );
  2059. float4 Weight144 = tex2DNode6;
  2060. float2 uv_Splat0 = IN.ase_texcoord7.xy * _Splat0_ST.xy + _Splat0_ST.zw;
  2061. float4 appendResult123 = (float4(1.0 , 1.0 , 1.0 , _Smoothness0));
  2062. float4 Layer1144 = ( tex2D( _Splat0, uv_Splat0 ) * appendResult123 );
  2063. float2 uv_Splat1 = IN.ase_texcoord7.xy * _Splat1_ST.xy + _Splat1_ST.zw;
  2064. float4 appendResult126 = (float4(1.0 , 1.0 , 1.0 , _Smoothness1));
  2065. float4 Layer2144 = ( tex2D( _Splat1, uv_Splat1 ) * appendResult126 );
  2066. float4 localWeightedBlend2144 = WeightedBlend2144( Weight144 , Layer1144 , Layer2144 );
  2067. float4 RGBA115 = localWeightedBlend2144;
  2068. float3 RGB115 = float3( 0,0,0 );
  2069. float A115 = 0;
  2070. {
  2071. RGB115 = RGBA115.rgb;
  2072. A115 = RGBA115.a;
  2073. }
  2074. float4 Weight145 = tex2DNode6;
  2075. float3 tex2DNode16 = UnpackNormalScale( tex2D( _Normal0, uv_Splat0 ), 1.0f );
  2076. float3 Normal147 = tex2DNode16;
  2077. float Strength147 = _NormalIntensity0;
  2078. float3 localMTE_NormalIntensity_fixed147 = MTE_NormalIntensity_fixed147( Normal147 , Strength147 );
  2079. #ifdef ENABLE_NORMAL_INTENSITY
  2080. float3 staticSwitch148 = localMTE_NormalIntensity_fixed147;
  2081. #else
  2082. float3 staticSwitch148 = tex2DNode16;
  2083. #endif
  2084. float4 Layer1145 = float4( staticSwitch148 , 0.0 );
  2085. float3 tex2DNode39 = UnpackNormalScale( tex2D( _Normal1, uv_Splat1 ), 1.0f );
  2086. float3 Normal150 = tex2DNode39;
  2087. float Strength150 = _NormalIntensity1;
  2088. float3 localMTE_NormalIntensity_fixed150 = MTE_NormalIntensity_fixed150( Normal150 , Strength150 );
  2089. #ifdef ENABLE_NORMAL_INTENSITY
  2090. float3 staticSwitch151 = localMTE_NormalIntensity_fixed150;
  2091. #else
  2092. float3 staticSwitch151 = tex2DNode39;
  2093. #endif
  2094. float4 Layer2145 = float4( staticSwitch151 , 0.0 );
  2095. float4 localWeightedBlend2145 = WeightedBlend2145( Weight145 , Layer1145 , Layer2145 );
  2096. float3 Albedo = RGB115;
  2097. float3 Normal = localWeightedBlend2145.xyz;
  2098. float3 Emission = 0;
  2099. float3 Specular = _SpecularColor.rgb;
  2100. float Metallic = 0;
  2101. float Smoothness = A115;
  2102. float Occlusion = 1;
  2103. float Alpha = 1;
  2104. float AlphaClipThreshold = 0.5;
  2105. float AlphaClipThresholdShadow = 0.5;
  2106. float3 BakedGI = 0;
  2107. float3 RefractionColor = 1;
  2108. float RefractionIndex = 1;
  2109. float3 Transmission = 1;
  2110. float3 Translucency = 1;
  2111. #ifdef ASE_DEPTH_WRITE_ON
  2112. float DepthValue = 0;
  2113. #endif
  2114. #ifdef _ALPHATEST_ON
  2115. clip(Alpha - AlphaClipThreshold);
  2116. #endif
  2117. InputData inputData;
  2118. inputData.positionWS = WorldPosition;
  2119. inputData.viewDirectionWS = WorldViewDirection;
  2120. inputData.shadowCoord = ShadowCoords;
  2121. #ifdef _NORMALMAP
  2122. #if _NORMAL_DROPOFF_TS
  2123. inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal ));
  2124. #elif _NORMAL_DROPOFF_OS
  2125. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  2126. #elif _NORMAL_DROPOFF_WS
  2127. inputData.normalWS = Normal;
  2128. #endif
  2129. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  2130. #else
  2131. inputData.normalWS = WorldNormal;
  2132. #endif
  2133. #ifdef ASE_FOG
  2134. inputData.fogCoord = IN.fogFactorAndVertexLight.x;
  2135. #endif
  2136. inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw;
  2137. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2138. float3 SH = SampleSH(inputData.normalWS.xyz);
  2139. #else
  2140. float3 SH = IN.lightmapUVOrVertexSH.xyz;
  2141. #endif
  2142. inputData.bakedGI = SAMPLE_GI( IN.lightmapUVOrVertexSH.xy, SH, inputData.normalWS );
  2143. #ifdef _ASE_BAKEDGI
  2144. inputData.bakedGI = BakedGI;
  2145. #endif
  2146. BRDFData brdfData;
  2147. InitializeBRDFData( Albedo, Metallic, Specular, Smoothness, Alpha, brdfData);
  2148. half4 color;
  2149. color.rgb = GlobalIllumination( brdfData, inputData.bakedGI, Occlusion, inputData.normalWS, inputData.viewDirectionWS);
  2150. color.a = Alpha;
  2151. #ifdef _TRANSMISSION_ASE
  2152. {
  2153. float shadow = _TransmissionShadow;
  2154. Light mainLight = GetMainLight( inputData.shadowCoord );
  2155. float3 mainAtten = mainLight.color * mainLight.distanceAttenuation;
  2156. mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow );
  2157. half3 mainTransmission = max(0 , -dot(inputData.normalWS, mainLight.direction)) * mainAtten * Transmission;
  2158. color.rgb += Albedo * mainTransmission;
  2159. #ifdef _ADDITIONAL_LIGHTS
  2160. int transPixelLightCount = GetAdditionalLightsCount();
  2161. for (int i = 0; i < transPixelLightCount; ++i)
  2162. {
  2163. Light light = GetAdditionalLight(i, inputData.positionWS);
  2164. float3 atten = light.color * light.distanceAttenuation;
  2165. atten = lerp( atten, atten * light.shadowAttenuation, shadow );
  2166. half3 transmission = max(0 , -dot(inputData.normalWS, light.direction)) * atten * Transmission;
  2167. color.rgb += Albedo * transmission;
  2168. }
  2169. #endif
  2170. }
  2171. #endif
  2172. #ifdef _TRANSLUCENCY_ASE
  2173. {
  2174. float shadow = _TransShadow;
  2175. float normal = _TransNormal;
  2176. float scattering = _TransScattering;
  2177. float direct = _TransDirect;
  2178. float ambient = _TransAmbient;
  2179. float strength = _TransStrength;
  2180. Light mainLight = GetMainLight( inputData.shadowCoord );
  2181. float3 mainAtten = mainLight.color * mainLight.distanceAttenuation;
  2182. mainAtten = lerp( mainAtten, mainAtten * mainLight.shadowAttenuation, shadow );
  2183. half3 mainLightDir = mainLight.direction + inputData.normalWS * normal;
  2184. half mainVdotL = pow( saturate( dot( inputData.viewDirectionWS, -mainLightDir ) ), scattering );
  2185. half3 mainTranslucency = mainAtten * ( mainVdotL * direct + inputData.bakedGI * ambient ) * Translucency;
  2186. color.rgb += Albedo * mainTranslucency * strength;
  2187. #ifdef _ADDITIONAL_LIGHTS
  2188. int transPixelLightCount = GetAdditionalLightsCount();
  2189. for (int i = 0; i < transPixelLightCount; ++i)
  2190. {
  2191. Light light = GetAdditionalLight(i, inputData.positionWS);
  2192. float3 atten = light.color * light.distanceAttenuation;
  2193. atten = lerp( atten, atten * light.shadowAttenuation, shadow );
  2194. half3 lightDir = light.direction + inputData.normalWS * normal;
  2195. half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );
  2196. half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;
  2197. color.rgb += Albedo * translucency * strength;
  2198. }
  2199. #endif
  2200. }
  2201. #endif
  2202. #ifdef _REFRACTION_ASE
  2203. float4 projScreenPos = ScreenPos / ScreenPos.w;
  2204. float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal, 0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) );
  2205. projScreenPos.xy += refractionOffset.xy;
  2206. float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor;
  2207. color.rgb = lerp( refraction, color.rgb, color.a );
  2208. color.a = 1;
  2209. #endif
  2210. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  2211. color.rgb *= color.a;
  2212. #endif
  2213. #ifdef ASE_FOG
  2214. #ifdef TERRAIN_SPLAT_ADDPASS
  2215. color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), IN.fogFactorAndVertexLight.x );
  2216. #else
  2217. color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x);
  2218. #endif
  2219. #endif
  2220. #ifdef ASE_DEPTH_WRITE_ON
  2221. outputDepth = DepthValue;
  2222. #endif
  2223. return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb);
  2224. }
  2225. ENDHLSL
  2226. }
  2227. }
  2228. CustomEditor "MTE.MTEShaderGUI"
  2229. Fallback "Hidden/InternalErrorShader"
  2230. }
  2231. /*ASEBEGIN
  2232. Version=18927
  2233. 301;67;1329;899;514.3845;1086.868;1;True;False
  2234. Node;AmplifyShaderEditor.TexturePropertyNode;37;-1644.116,-562.9706;Float;True;Property;_Splat1;Layer 2;1;0;Create;False;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  2235. Node;AmplifyShaderEditor.TexturePropertyNode;19;-1654.834,-945.6718;Float;True;Property;_Splat0;Layer 1;0;0;Create;False;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  2236. Node;AmplifyShaderEditor.TexturePropertyNode;103;-1635.359,-1358.877;Float;True;Property;_Control;Control;8;0;Create;True;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  2237. Node;AmplifyShaderEditor.RangedFloatNode;54;-1121.69,-946.0693;Float;False;Property;_Smoothness0;Smoothness 1;6;0;Create;False;0;0;0;False;0;False;0.5;0.354;0;1;0;1;FLOAT;0
  2238. Node;AmplifyShaderEditor.RangedFloatNode;57;-1116.138,-464.2166;Float;False;Property;_Smoothness1;Smoothness 2;7;0;Create;False;0;0;0;False;0;False;0.5;0.382;0;1;0;1;FLOAT;0
  2239. Node;AmplifyShaderEditor.TextureCoordinatesNode;40;-1390.519,-501.1515;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2240. Node;AmplifyShaderEditor.TextureCoordinatesNode;28;-1366.124,-928.462;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2241. Node;AmplifyShaderEditor.SamplerNode;16;-1129.263,-866.5981;Inherit;True;Property;_Normal0;Normalmap 1;2;0;Create;False;0;0;0;False;0;False;-1;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2242. Node;AmplifyShaderEditor.SamplerNode;38;-1116.809,-655.905;Inherit;True;Property;_TextureSample1;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;44b550da39bfea448a4be6b25b1b626c;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2243. Node;AmplifyShaderEditor.RangedFloatNode;149;-838.327,-266.2906;Inherit;False;Property;_NormalIntensity1;Normal Intensity 2;12;0;Create;False;0;0;0;False;0;False;1;1;0.01;10;0;1;FLOAT;0
  2244. Node;AmplifyShaderEditor.SamplerNode;5;-1134.41,-1133.135;Inherit;True;Property;_Splat0;Splat0;0;0;Create;True;0;0;0;False;0;False;103;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2245. Node;AmplifyShaderEditor.TextureCoordinatesNode;104;-1381.158,-1291.34;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2246. Node;AmplifyShaderEditor.RangedFloatNode;146;-851.8998,-773.3616;Inherit;False;Property;_NormalIntensity0;Normal Intensity 1;11;0;Create;False;0;0;0;False;0;False;1;1;0.01;10;0;1;FLOAT;0
  2247. Node;AmplifyShaderEditor.SamplerNode;39;-1119.519,-373.9468;Inherit;True;Property;_Normal1;Normalmap 2;3;0;Create;False;0;0;0;False;0;False;-1;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2248. Node;AmplifyShaderEditor.DynamicAppendNode;123;-832.7972,-1031.363;Inherit;False;FLOAT4;4;0;FLOAT;1;False;1;FLOAT;1;False;2;FLOAT;1;False;3;FLOAT;0;False;1;FLOAT4;0
  2249. Node;AmplifyShaderEditor.DynamicAppendNode;126;-824.8046,-536.2642;Inherit;False;FLOAT4;4;0;FLOAT;1;False;1;FLOAT;1;False;2;FLOAT;1;False;3;FLOAT;0;False;1;FLOAT4;0
  2250. Node;AmplifyShaderEditor.CustomExpressionNode;147;-594.1448,-792.2508;Inherit;False; lerp(Normal, float3(0,0,1), - Strength + 1.0);3;Create;2;True;Normal;FLOAT3;0,0,0;In;;Inherit;False;True;Strength;FLOAT;1;In;;Inherit;False;MTE_NormalIntensity_fixed;True;False;0;;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;1;False;1;FLOAT3;0
  2251. Node;AmplifyShaderEditor.CustomExpressionNode;150;-564.6006,-284.9253;Inherit;False; lerp(Normal, float3(0,0,1), - Strength + 1.0);3;Create;2;True;Normal;FLOAT3;0,0,0;In;;Inherit;False;True;Strength;FLOAT;1;In;;Inherit;False;MTE_NormalIntensity_fixed;True;False;0;;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;1;False;1;FLOAT3;0
  2252. Node;AmplifyShaderEditor.SamplerNode;6;-1133.791,-1356.361;Inherit;True;Property;_CC;CC;1;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2253. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;125;-706.6159,-1080.008;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0
  2254. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;127;-694.8233,-589.3093;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0
  2255. Node;AmplifyShaderEditor.CustomExpressionNode;144;-32.2532,-964.9514;Float;False;return Layer1 * Weight.r + Layer2 * Weight.g@;4;Create;3;True;Weight;FLOAT4;0,0,0,0;In;float[5];Half;False;True;Layer1;FLOAT4;0,0,0,0;In;;Float;False;True;Layer2;FLOAT4;0,0,0,0;In;;Float;False;Weighted Blend 2;True;False;0;;False;3;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  2256. Node;AmplifyShaderEditor.CommentaryNode;141;-28.76276,-412.144;Inherit;False;642.571;223.6749;Comment;4;136;137;56;53;Metaillic (not used);0.5882353,0.5882353,0.5921569,1;0;0
  2257. Node;AmplifyShaderEditor.StaticSwitch;151;-358.2669,-370.8559;Inherit;False;Property;ENABLE_NORMAL_INTENSITY;Normal Intensity;9;0;Create;False;0;0;0;False;0;False;0;1;1;True;ENABLE_NORMAL_INTENSITY;Toggle;2;Key0;Key1;Create;True;False;9;1;FLOAT3;0,0,0;False;0;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT3;0,0,0;False;1;FLOAT3;0
  2258. Node;AmplifyShaderEditor.StaticSwitch;148;-396.0649,-866.4645;Inherit;False;Property;ENABLE_NORMAL_INTENSITY;Normal Intensity;9;0;Create;False;0;0;0;False;0;False;0;1;1;True;ENABLE_NORMAL_INTENSITY;Toggle;2;Key0;Key1;Create;True;False;9;1;FLOAT3;0,0,0;False;0;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT3;0,0,0;False;1;FLOAT3;0
  2259. Node;AmplifyShaderEditor.CommentaryNode;153;0.5703115,-1297.395;Inherit;False;332;155;Required by MTE shader UI. Don't Delete.;1;152;;1,1,1,1;0;0
  2260. Node;AmplifyShaderEditor.DotProductOpNode;136;491.1776,-369.1068;Inherit;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0
  2261. Node;AmplifyShaderEditor.DynamicAppendNode;137;340.7014,-338.7963;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
  2262. Node;AmplifyShaderEditor.RangedFloatNode;56;21.23708,-270.9185;Float;False;Property;_Metallic1;Metallic 2;5;1;[Gamma];Create;False;0;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0
  2263. Node;AmplifyShaderEditor.StaticSwitch;152;42.79092,-1252.967;Inherit;False;Property;SMOOTHNESS_TEXTURE;Smoothness Texture;10;0;Create;False;0;0;0;True;0;False;0;0;0;True;SMOOTHNESS_TEXTURE;Toggle;2;Key0;Key1;Create;True;False;9;1;FLOAT3;0,0,0;False;0;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT3;0,0,0;False;1;FLOAT3;0
  2264. Node;AmplifyShaderEditor.CustomExpressionNode;115;169.8219,-988.0154;Inherit;False;RGB = RGBA.rgb@$A = RGBA.a@;7;Create;3;True;RGBA;FLOAT4;0,0,0,0;In;;Inherit;False;True;RGB;FLOAT3;0,0,0;Out;;Inherit;False;True;A;FLOAT;0;Out;;Inherit;False;BreakRGBA;False;False;0;;False;4;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;3;FLOAT4;0;FLOAT3;3;FLOAT;4
  2265. Node;AmplifyShaderEditor.CustomExpressionNode;145;-23.12711,-849.3043;Float;False;return Layer1 * Weight.r + Layer2 * Weight.g@;4;Create;3;True;Weight;FLOAT4;0,0,0,0;In;float[5];Half;False;True;Layer1;FLOAT4;0,0,0,0;In;;Float;False;True;Layer2;FLOAT4;0,0,0,0;In;;Float;False;Weighted Blend 2;True;False;0;;False;3;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  2266. Node;AmplifyShaderEditor.RangedFloatNode;53;24.73714,-362.1428;Float;False;Property;_Metallic0;Metallic 1;4;1;[Gamma];Create;False;0;0;0;False;0;False;0;0.6331881;0;1;0;1;FLOAT;0
  2267. Node;AmplifyShaderEditor.ColorNode;158;136.6155,-731.368;Inherit;False;Property;_SpecularColor;SpecularColor;13;0;Create;True;0;0;0;False;0;False;0,0,0,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  2268. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;112;240.7755,-183.3562;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2269. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;110;240.7755,-183.3562;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2270. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;156;374.646,-913.5243;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2271. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;155;374.646,-913.5243;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthNormals;0;6;DepthNormals;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2272. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;111;240.7755,-183.3562;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;False;False;True;False;False;False;False;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2273. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;108;211.4312,-658.9133;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2274. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;109;374.646,-973.5243;Float;False;True;-1;2;MTE.MTEShaderGUI;0;2;MTE/URP/2 Textures;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;18;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;2;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;38;Workflow;0;Surface;0; Refraction Model;0; Blend;0;Two Sided;1;Fragment Normal Space,InvertActionOnDeselection;0;Transmission;0; Transmission Shadow;0.5,False,-1;Translucency;0; Translucency Strength;1,False,-1; Normal Distortion;0.5,False,-1; Scattering;2,False,-1; Direct;0.9,False,-1; Ambient;0.1,False,-1; Shadow;0.5,False,-1;Cast Shadows;1; Use Shadow Threshold;0;Receive Shadows;1;GPU Instancing;1;LOD CrossFade;1;Built-in Fog;1;_FinalColorxAlpha;0;Meta Pass;1;Override Baked GI;0;Extra Pre Pass;0;DOTS Instancing;0;Tessellation;0; Phong;0; Strength;0.5,False,-1; Type;0; Tess;16,False,-1; Min;10,False,-1; Max;25,False,-1; Edge Length;16,False,-1; Max Displacement;25,False,-1;Write Depth;0; Early Z;0;Vertex Position,InvertActionOnDeselection;1;0;8;False;True;True;True;True;True;True;True;False;;False;0
  2275. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;113;240.7755,-183.3562;Float;False;False;-1;2;UnityEditor.ShaderGraph.PBRMasterGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;False;False;False;True;3;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;True;0;True;17;d3d9;d3d11;glcore;gles;gles3;metal;vulkan;xbox360;xboxone;xboxseries;ps4;playstation;psp2;n3ds;wiiu;switch;nomrt;0;False;True;1;1;False;-1;0;False;-1;1;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2276. WireConnection;40;2;37;0
  2277. WireConnection;28;2;19;0
  2278. WireConnection;16;1;28;0
  2279. WireConnection;38;0;37;0
  2280. WireConnection;38;1;40;0
  2281. WireConnection;5;0;19;0
  2282. WireConnection;5;1;28;0
  2283. WireConnection;104;2;103;0
  2284. WireConnection;39;1;40;0
  2285. WireConnection;123;3;54;0
  2286. WireConnection;126;3;57;0
  2287. WireConnection;147;0;16;0
  2288. WireConnection;147;1;146;0
  2289. WireConnection;150;0;39;0
  2290. WireConnection;150;1;149;0
  2291. WireConnection;6;0;103;0
  2292. WireConnection;6;1;104;0
  2293. WireConnection;125;0;5;0
  2294. WireConnection;125;1;123;0
  2295. WireConnection;127;0;38;0
  2296. WireConnection;127;1;126;0
  2297. WireConnection;144;0;6;0
  2298. WireConnection;144;1;125;0
  2299. WireConnection;144;2;127;0
  2300. WireConnection;151;1;39;0
  2301. WireConnection;151;0;150;0
  2302. WireConnection;148;1;16;0
  2303. WireConnection;148;0;147;0
  2304. WireConnection;136;0;6;0
  2305. WireConnection;136;1;137;0
  2306. WireConnection;137;0;53;0
  2307. WireConnection;137;1;56;0
  2308. WireConnection;115;1;144;0
  2309. WireConnection;145;0;6;0
  2310. WireConnection;145;1;148;0
  2311. WireConnection;145;2;151;0
  2312. WireConnection;109;0;115;3
  2313. WireConnection;109;1;145;0
  2314. WireConnection;109;9;158;0
  2315. WireConnection;109;4;115;4
  2316. ASEEND*/
  2317. //CHKSM=E01EAE9CF279B8D5FEF9914D58483E8122E2F883