TextureArray.shader 112 KB

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