Leaves Fast.shader 131 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591
  1. // Made with Amplify Shader Editor v1.9.7.1
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Tobyfredson/Leaves Fast_URP"
  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. [SingleLineTexture]_Albedo("Albedo", 2D) = "white" {}
  10. _AlphaClip("Alpha Clip", Range( 0 , 1)) = 0.4
  11. [SingleLineTexture]_NormalMap("Normal Map", 2D) = "bump" {}
  12. _NormalIntensity("Normal Intensity", Range( -3 , 3)) = 1
  13. [SingleLineTexture]_Gloss("Gloss", 2D) = "black" {}
  14. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  15. //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5
  16. //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1
  17. //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5
  18. //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2
  19. //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9
  20. //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1
  21. //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5
  22. //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
  23. //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
  24. //_TessMin( "Tess Min Distance", Float ) = 10
  25. //_TessMax( "Tess Max Distance", Float ) = 25
  26. //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
  27. //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
  28. [HideInInspector][ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1
  29. [HideInInspector][ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1
  30. [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0
  31. [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0
  32. [HideInInspector] _QueueControl("_QueueControl", Float) = -1
  33. [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
  34. [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
  35. [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
  36. //[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1
  37. }
  38. SubShader
  39. {
  40. LOD 0
  41. Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" "UniversalMaterialType"="Lit" }
  42. Cull Back
  43. ZWrite On
  44. ZTest LEqual
  45. Offset 0 , 0
  46. AlphaToMask Off
  47. HLSLINCLUDE
  48. #pragma target 4.5
  49. #pragma prefer_hlslcc gles
  50. // ensure rendering platforms toggle list is visible
  51. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  52. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
  53. #ifndef ASE_TESS_FUNCS
  54. #define ASE_TESS_FUNCS
  55. float4 FixedTess( float tessValue )
  56. {
  57. return tessValue;
  58. }
  59. float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
  60. {
  61. float3 wpos = mul(o2w,vertex).xyz;
  62. float dist = distance (wpos, cameraPos);
  63. float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
  64. return f;
  65. }
  66. float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
  67. {
  68. float4 tess;
  69. tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
  70. tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
  71. tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
  72. tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
  73. return tess;
  74. }
  75. float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
  76. {
  77. float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
  78. float len = distance(wpos0, wpos1);
  79. float f = max(len * scParams.y / (edgeLen * dist), 1.0);
  80. return f;
  81. }
  82. float DistanceFromPlane (float3 pos, float4 plane)
  83. {
  84. float d = dot (float4(pos,1.0f), plane);
  85. return d;
  86. }
  87. bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
  88. {
  89. float4 planeTest;
  90. planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  91. (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  92. (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
  93. planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  94. (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  95. (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
  96. planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  97. (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  98. (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
  99. planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  100. (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  101. (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
  102. return !all (planeTest);
  103. }
  104. float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
  105. {
  106. float3 f;
  107. f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
  108. f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
  109. f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
  110. return CalcTriEdgeTessFactors (f);
  111. }
  112. float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
  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. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  119. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  120. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  121. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  122. return tess;
  123. }
  124. float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
  125. {
  126. float3 pos0 = mul(o2w,v0).xyz;
  127. float3 pos1 = mul(o2w,v1).xyz;
  128. float3 pos2 = mul(o2w,v2).xyz;
  129. float4 tess;
  130. if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
  131. {
  132. tess = 0.0f;
  133. }
  134. else
  135. {
  136. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  137. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  138. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  139. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  140. }
  141. return tess;
  142. }
  143. #endif //ASE_TESS_FUNCS
  144. ENDHLSL
  145. Pass
  146. {
  147. Name "Forward"
  148. Tags { "LightMode"="UniversalForward" }
  149. Blend One Zero, One Zero
  150. ZWrite On
  151. ZTest LEqual
  152. Offset 0 , 0
  153. ColorMask RGBA
  154. HLSLPROGRAM
  155. #pragma multi_compile_local_fragment _ALPHATEST_ON
  156. #define _NORMAL_DROPOFF_TS 1
  157. #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
  158. #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
  159. #pragma multi_compile _ LOD_FADE_CROSSFADE
  160. #pragma multi_compile_fog
  161. #define ASE_FOG 1
  162. #pragma multi_compile_instancing
  163. #pragma instancing_options renderinglayer
  164. #define _NORMALMAP 1
  165. #define ASE_VERSION 19701
  166. #define ASE_SRP_VERSION 170003
  167. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
  168. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  169. #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
  170. #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
  171. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
  172. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
  173. #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
  174. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  175. #pragma multi_compile _ _LIGHT_LAYERS
  176. #pragma multi_compile_fragment _ _LIGHT_COOKIES
  177. #pragma multi_compile _ _FORWARD_PLUS
  178. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  179. #pragma multi_compile _ SHADOWS_SHADOWMASK
  180. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  181. #pragma multi_compile _ LIGHTMAP_ON
  182. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  183. #pragma multi_compile _ USE_LEGACY_LIGHTMAPS
  184. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  185. #pragma vertex vert
  186. #pragma fragment frag
  187. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  188. #define _SPECULAR_COLOR 1
  189. #endif
  190. #define SHADERPASS SHADERPASS_FORWARD
  191. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  192. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  193. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  194. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  195. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  196. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  197. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  198. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  199. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  200. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  201. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  202. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  203. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  204. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  205. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  206. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  207. #if defined(LOD_FADE_CROSSFADE)
  208. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  209. #endif
  210. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  211. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  212. #endif
  213. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  214. #define ASE_SV_DEPTH SV_DepthLessEqual
  215. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  216. #else
  217. #define ASE_SV_DEPTH SV_Depth
  218. #define ASE_SV_POSITION_QUALIFIERS
  219. #endif
  220. struct Attributes
  221. {
  222. float4 positionOS : POSITION;
  223. float3 normalOS : NORMAL;
  224. float4 tangentOS : TANGENT;
  225. float4 texcoord : TEXCOORD0;
  226. float4 texcoord1 : TEXCOORD1;
  227. float4 texcoord2 : TEXCOORD2;
  228. UNITY_VERTEX_INPUT_INSTANCE_ID
  229. };
  230. struct PackedVaryings
  231. {
  232. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  233. float4 clipPosV : TEXCOORD0;
  234. float4 lightmapUVOrVertexSH : TEXCOORD1;
  235. half4 fogFactorAndVertexLight : TEXCOORD2;
  236. float4 tSpace0 : TEXCOORD3;
  237. float4 tSpace1 : TEXCOORD4;
  238. float4 tSpace2 : TEXCOORD5;
  239. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  240. float4 shadowCoord : TEXCOORD6;
  241. #endif
  242. #if defined(DYNAMICLIGHTMAP_ON)
  243. float2 dynamicLightmapUV : TEXCOORD7;
  244. #endif
  245. #if defined(USE_APV_PROBE_OCCLUSION)
  246. float4 probeOcclusion : TEXCOORD8;
  247. #endif
  248. float4 ase_texcoord9 : TEXCOORD9;
  249. UNITY_VERTEX_INPUT_INSTANCE_ID
  250. UNITY_VERTEX_OUTPUT_STEREO
  251. };
  252. CBUFFER_START(UnityPerMaterial)
  253. float4 _Albedo_ST;
  254. float4 _NormalMap_ST;
  255. float4 _Gloss_ST;
  256. float _NormalIntensity;
  257. float _AlphaClip;
  258. #ifdef ASE_TRANSMISSION
  259. float _TransmissionShadow;
  260. #endif
  261. #ifdef ASE_TRANSLUCENCY
  262. float _TransStrength;
  263. float _TransNormal;
  264. float _TransScattering;
  265. float _TransDirect;
  266. float _TransAmbient;
  267. float _TransShadow;
  268. #endif
  269. #ifdef ASE_TESSELLATION
  270. float _TessPhongStrength;
  271. float _TessValue;
  272. float _TessMin;
  273. float _TessMax;
  274. float _TessEdgeLength;
  275. float _TessMaxDisp;
  276. #endif
  277. CBUFFER_END
  278. #ifdef SCENEPICKINGPASS
  279. float4 _SelectionID;
  280. #endif
  281. #ifdef SCENESELECTIONPASS
  282. int _ObjectId;
  283. int _PassValue;
  284. #endif
  285. sampler2D _Albedo;
  286. sampler2D _NormalMap;
  287. sampler2D _Gloss;
  288. PackedVaryings VertexFunction( Attributes input )
  289. {
  290. PackedVaryings output = (PackedVaryings)0;
  291. UNITY_SETUP_INSTANCE_ID(input);
  292. UNITY_TRANSFER_INSTANCE_ID(input, output);
  293. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  294. output.ase_texcoord9.xy = input.texcoord.xy;
  295. //setting value to unused interpolator channels and avoid initialization warnings
  296. output.ase_texcoord9.zw = 0;
  297. #ifdef ASE_ABSOLUTE_VERTEX_POS
  298. float3 defaultVertexValue = input.positionOS.xyz;
  299. #else
  300. float3 defaultVertexValue = float3(0, 0, 0);
  301. #endif
  302. float3 vertexValue = defaultVertexValue;
  303. #ifdef ASE_ABSOLUTE_VERTEX_POS
  304. input.positionOS.xyz = vertexValue;
  305. #else
  306. input.positionOS.xyz += vertexValue;
  307. #endif
  308. input.normalOS = input.normalOS;
  309. input.tangentOS = input.tangentOS;
  310. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  311. VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS );
  312. output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x );
  313. output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y );
  314. output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z );
  315. #if defined(LIGHTMAP_ON)
  316. OUTPUT_LIGHTMAP_UV( input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy );
  317. #endif
  318. #if defined(DYNAMICLIGHTMAP_ON)
  319. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  320. #endif
  321. OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion );
  322. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  323. output.lightmapUVOrVertexSH.zw = input.texcoord.xy;
  324. output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  325. #endif
  326. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  327. #ifdef ASE_FOG
  328. half fogFactor = ComputeFogFactor( vertexInput.positionCS.z );
  329. #else
  330. half fogFactor = 0;
  331. #endif
  332. output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
  333. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  334. output.shadowCoord = GetShadowCoord( vertexInput );
  335. #endif
  336. output.positionCS = vertexInput.positionCS;
  337. output.clipPosV = vertexInput.positionCS;
  338. return output;
  339. }
  340. #if defined(ASE_TESSELLATION)
  341. struct VertexControl
  342. {
  343. float4 vertex : INTERNALTESSPOS;
  344. float3 normalOS : NORMAL;
  345. float4 tangentOS : TANGENT;
  346. float4 texcoord : TEXCOORD0;
  347. float4 texcoord1 : TEXCOORD1;
  348. float4 texcoord2 : TEXCOORD2;
  349. UNITY_VERTEX_INPUT_INSTANCE_ID
  350. };
  351. struct TessellationFactors
  352. {
  353. float edge[3] : SV_TessFactor;
  354. float inside : SV_InsideTessFactor;
  355. };
  356. VertexControl vert ( Attributes input )
  357. {
  358. VertexControl output;
  359. UNITY_SETUP_INSTANCE_ID(input);
  360. UNITY_TRANSFER_INSTANCE_ID(input, output);
  361. output.vertex = input.positionOS;
  362. output.normalOS = input.normalOS;
  363. output.tangentOS = input.tangentOS;
  364. output.texcoord = input.texcoord;
  365. output.texcoord1 = input.texcoord1;
  366. output.texcoord2 = input.texcoord2;
  367. return output;
  368. }
  369. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  370. {
  371. TessellationFactors output;
  372. float4 tf = 1;
  373. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  374. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  375. #if defined(ASE_FIXED_TESSELLATION)
  376. tf = FixedTess( tessValue );
  377. #elif defined(ASE_DISTANCE_TESSELLATION)
  378. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  379. #elif defined(ASE_LENGTH_TESSELLATION)
  380. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  381. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  382. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  383. #endif
  384. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  385. return output;
  386. }
  387. [domain("tri")]
  388. [partitioning("fractional_odd")]
  389. [outputtopology("triangle_cw")]
  390. [patchconstantfunc("TessellationFunction")]
  391. [outputcontrolpoints(3)]
  392. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  393. {
  394. return patch[id];
  395. }
  396. [domain("tri")]
  397. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  398. {
  399. Attributes output = (Attributes) 0;
  400. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  401. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  402. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  403. output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  404. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  405. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  406. #if defined(ASE_PHONG_TESSELLATION)
  407. float3 pp[3];
  408. for (int i = 0; i < 3; ++i)
  409. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  410. float phongStrength = _TessPhongStrength;
  411. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  412. #endif
  413. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  414. return VertexFunction(output);
  415. }
  416. #else
  417. PackedVaryings vert ( Attributes input )
  418. {
  419. return VertexFunction( input );
  420. }
  421. #endif
  422. half4 frag ( PackedVaryings input
  423. #ifdef ASE_DEPTH_WRITE_ON
  424. ,out float outputDepth : ASE_SV_DEPTH
  425. #endif
  426. #ifdef _WRITE_RENDERING_LAYERS
  427. , out float4 outRenderingLayers : SV_Target1
  428. #endif
  429. ) : SV_Target
  430. {
  431. UNITY_SETUP_INSTANCE_ID(input);
  432. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  433. #if defined(LOD_FADE_CROSSFADE)
  434. LODFadeCrossFade( input.positionCS );
  435. #endif
  436. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  437. float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  438. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  439. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  440. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  441. #else
  442. float3 WorldNormal = normalize( input.tSpace0.xyz );
  443. float3 WorldTangent = input.tSpace1.xyz;
  444. float3 WorldBiTangent = input.tSpace2.xyz;
  445. #endif
  446. float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w);
  447. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  448. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  449. float4 ClipPos = input.clipPosV;
  450. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  451. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  452. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  453. ShadowCoords = input.shadowCoord;
  454. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  455. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  456. #endif
  457. WorldViewDirection = SafeNormalize( WorldViewDirection );
  458. float2 uv_Albedo = input.ase_texcoord9.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  459. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  460. float2 uv_NormalMap = input.ase_texcoord9.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
  461. float3 unpack8 = UnpackNormalScale( tex2D( _NormalMap, uv_NormalMap ), _NormalIntensity );
  462. unpack8.z = lerp( 1, unpack8.z, saturate(_NormalIntensity) );
  463. float2 uv_Gloss = input.ase_texcoord9.xy * _Gloss_ST.xy + _Gloss_ST.zw;
  464. float3 BaseColor = tex2DNode6.rgb;
  465. float3 Normal = unpack8;
  466. float3 Emission = 0;
  467. float3 Specular = 0.5;
  468. float Metallic = 0;
  469. float Smoothness = tex2D( _Gloss, uv_Gloss ).a;
  470. float Occlusion = 1;
  471. float Alpha = tex2DNode6.a;
  472. float AlphaClipThreshold = _AlphaClip;
  473. float AlphaClipThresholdShadow = 0.5;
  474. float3 BakedGI = 0;
  475. float3 RefractionColor = 1;
  476. float RefractionIndex = 1;
  477. float3 Transmission = 1;
  478. float3 Translucency = 1;
  479. #ifdef ASE_DEPTH_WRITE_ON
  480. float DepthValue = input.positionCS.z;
  481. #endif
  482. #ifdef _CLEARCOAT
  483. float CoatMask = 0;
  484. float CoatSmoothness = 0;
  485. #endif
  486. #ifdef _ALPHATEST_ON
  487. clip(Alpha - AlphaClipThreshold);
  488. #endif
  489. InputData inputData = (InputData)0;
  490. inputData.positionWS = WorldPosition;
  491. inputData.positionCS = input.positionCS;
  492. inputData.viewDirectionWS = WorldViewDirection;
  493. #ifdef _NORMALMAP
  494. #if _NORMAL_DROPOFF_TS
  495. inputData.normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent, WorldBiTangent, WorldNormal));
  496. #elif _NORMAL_DROPOFF_OS
  497. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  498. #elif _NORMAL_DROPOFF_WS
  499. inputData.normalWS = Normal;
  500. #endif
  501. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  502. #else
  503. inputData.normalWS = WorldNormal;
  504. #endif
  505. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  506. inputData.shadowCoord = ShadowCoords;
  507. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  508. inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
  509. #else
  510. inputData.shadowCoord = float4(0, 0, 0, 0);
  511. #endif
  512. #ifdef ASE_FOG
  513. inputData.fogCoord = input.fogFactorAndVertexLight.x;
  514. #endif
  515. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  516. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  517. float3 SH = SampleSH(inputData.normalWS.xyz);
  518. #else
  519. float3 SH = input.lightmapUVOrVertexSH.xyz;
  520. #endif
  521. #if defined(DYNAMICLIGHTMAP_ON)
  522. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS);
  523. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  524. #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
  525. inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS),
  526. inputData.normalWS,
  527. inputData.viewDirectionWS,
  528. input.positionCS.xy,
  529. input.probeOcclusion,
  530. inputData.shadowMask );
  531. #else
  532. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
  533. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  534. #endif
  535. #ifdef ASE_BAKEDGI
  536. inputData.bakedGI = BakedGI;
  537. #endif
  538. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  539. #if defined(DEBUG_DISPLAY)
  540. #if defined(DYNAMICLIGHTMAP_ON)
  541. inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
  542. #endif
  543. #if defined(LIGHTMAP_ON)
  544. inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy;
  545. #else
  546. inputData.vertexSH = SH;
  547. #endif
  548. #if defined(USE_APV_PROBE_OCCLUSION)
  549. inputData.probeOcclusion = input.probeOcclusion;
  550. #endif
  551. #endif
  552. SurfaceData surfaceData;
  553. surfaceData.albedo = BaseColor;
  554. surfaceData.metallic = saturate(Metallic);
  555. surfaceData.specular = Specular;
  556. surfaceData.smoothness = saturate(Smoothness),
  557. surfaceData.occlusion = Occlusion,
  558. surfaceData.emission = Emission,
  559. surfaceData.alpha = saturate(Alpha);
  560. surfaceData.normalTS = Normal;
  561. surfaceData.clearCoatMask = 0;
  562. surfaceData.clearCoatSmoothness = 1;
  563. #ifdef _CLEARCOAT
  564. surfaceData.clearCoatMask = saturate(CoatMask);
  565. surfaceData.clearCoatSmoothness = saturate(CoatSmoothness);
  566. #endif
  567. #ifdef _DBUFFER
  568. ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
  569. #endif
  570. #ifdef _ASE_LIGHTING_SIMPLE
  571. half4 color = UniversalFragmentBlinnPhong( inputData, surfaceData);
  572. #else
  573. half4 color = UniversalFragmentPBR( inputData, surfaceData);
  574. #endif
  575. #ifdef ASE_TRANSMISSION
  576. {
  577. float shadow = _TransmissionShadow;
  578. #define SUM_LIGHT_TRANSMISSION(Light)\
  579. float3 atten = Light.color * Light.distanceAttenuation;\
  580. atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\
  581. half3 transmission = max( 0, -dot( inputData.normalWS, Light.direction ) ) * atten * Transmission;\
  582. color.rgb += BaseColor * transmission;
  583. SUM_LIGHT_TRANSMISSION( GetMainLight( inputData.shadowCoord ) );
  584. #if defined(_ADDITIONAL_LIGHTS)
  585. uint meshRenderingLayers = GetMeshRenderingLayer();
  586. uint pixelLightCount = GetAdditionalLightsCount();
  587. #if USE_FORWARD_PLUS
  588. [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
  589. {
  590. FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
  591. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  592. #ifdef _LIGHT_LAYERS
  593. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  594. #endif
  595. {
  596. SUM_LIGHT_TRANSMISSION( light );
  597. }
  598. }
  599. #endif
  600. LIGHT_LOOP_BEGIN( pixelLightCount )
  601. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  602. #ifdef _LIGHT_LAYERS
  603. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  604. #endif
  605. {
  606. SUM_LIGHT_TRANSMISSION( light );
  607. }
  608. LIGHT_LOOP_END
  609. #endif
  610. }
  611. #endif
  612. #ifdef ASE_TRANSLUCENCY
  613. {
  614. float shadow = _TransShadow;
  615. float normal = _TransNormal;
  616. float scattering = _TransScattering;
  617. float direct = _TransDirect;
  618. float ambient = _TransAmbient;
  619. float strength = _TransStrength;
  620. #define SUM_LIGHT_TRANSLUCENCY(Light)\
  621. float3 atten = Light.color * Light.distanceAttenuation;\
  622. atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\
  623. half3 lightDir = Light.direction + inputData.normalWS * normal;\
  624. half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );\
  625. half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;\
  626. color.rgb += BaseColor * translucency * strength;
  627. SUM_LIGHT_TRANSLUCENCY( GetMainLight( inputData.shadowCoord ) );
  628. #if defined(_ADDITIONAL_LIGHTS)
  629. uint meshRenderingLayers = GetMeshRenderingLayer();
  630. uint pixelLightCount = GetAdditionalLightsCount();
  631. #if USE_FORWARD_PLUS
  632. [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
  633. {
  634. FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
  635. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  636. #ifdef _LIGHT_LAYERS
  637. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  638. #endif
  639. {
  640. SUM_LIGHT_TRANSLUCENCY( light );
  641. }
  642. }
  643. #endif
  644. LIGHT_LOOP_BEGIN( pixelLightCount )
  645. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  646. #ifdef _LIGHT_LAYERS
  647. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  648. #endif
  649. {
  650. SUM_LIGHT_TRANSLUCENCY( light );
  651. }
  652. LIGHT_LOOP_END
  653. #endif
  654. }
  655. #endif
  656. #ifdef ASE_REFRACTION
  657. float4 projScreenPos = ScreenPos / ScreenPos.w;
  658. float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) );
  659. projScreenPos.xy += refractionOffset.xy;
  660. float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor;
  661. color.rgb = lerp( refraction, color.rgb, color.a );
  662. color.a = 1;
  663. #endif
  664. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  665. color.rgb *= color.a;
  666. #endif
  667. #ifdef ASE_FOG
  668. #ifdef TERRAIN_SPLAT_ADDPASS
  669. color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), input.fogFactorAndVertexLight.x );
  670. #else
  671. color.rgb = MixFog(color.rgb, input.fogFactorAndVertexLight.x);
  672. #endif
  673. #endif
  674. #ifdef ASE_DEPTH_WRITE_ON
  675. outputDepth = DepthValue;
  676. #endif
  677. #ifdef _WRITE_RENDERING_LAYERS
  678. uint renderingLayers = GetMeshRenderingLayer();
  679. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  680. #endif
  681. return color;
  682. }
  683. ENDHLSL
  684. }
  685. Pass
  686. {
  687. Name "ShadowCaster"
  688. Tags { "LightMode"="ShadowCaster" }
  689. ZWrite On
  690. ZTest LEqual
  691. AlphaToMask Off
  692. ColorMask 0
  693. HLSLPROGRAM
  694. #pragma multi_compile_local_fragment _ALPHATEST_ON
  695. #define _NORMAL_DROPOFF_TS 1
  696. #pragma multi_compile _ LOD_FADE_CROSSFADE
  697. #define ASE_FOG 1
  698. #pragma multi_compile_instancing
  699. #define _NORMALMAP 1
  700. #define ASE_VERSION 19701
  701. #define ASE_SRP_VERSION 170003
  702. #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
  703. #pragma vertex vert
  704. #pragma fragment frag
  705. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  706. #define _SPECULAR_COLOR 1
  707. #endif
  708. #define SHADERPASS SHADERPASS_SHADOWCASTER
  709. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  710. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  711. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  712. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  713. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  714. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  715. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  716. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  717. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  718. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  719. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  720. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  721. #if defined(LOD_FADE_CROSSFADE)
  722. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  723. #endif
  724. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  725. #define ASE_SV_DEPTH SV_DepthLessEqual
  726. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  727. #else
  728. #define ASE_SV_DEPTH SV_Depth
  729. #define ASE_SV_POSITION_QUALIFIERS
  730. #endif
  731. struct Attributes
  732. {
  733. float4 positionOS : POSITION;
  734. float3 normalOS : NORMAL;
  735. float4 ase_texcoord : TEXCOORD0;
  736. UNITY_VERTEX_INPUT_INSTANCE_ID
  737. };
  738. struct PackedVaryings
  739. {
  740. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  741. float4 clipPosV : TEXCOORD0;
  742. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  743. float3 positionWS : TEXCOORD1;
  744. #endif
  745. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  746. float4 shadowCoord : TEXCOORD2;
  747. #endif
  748. float4 ase_texcoord3 : TEXCOORD3;
  749. UNITY_VERTEX_INPUT_INSTANCE_ID
  750. UNITY_VERTEX_OUTPUT_STEREO
  751. };
  752. CBUFFER_START(UnityPerMaterial)
  753. float4 _Albedo_ST;
  754. float4 _NormalMap_ST;
  755. float4 _Gloss_ST;
  756. float _NormalIntensity;
  757. float _AlphaClip;
  758. #ifdef ASE_TRANSMISSION
  759. float _TransmissionShadow;
  760. #endif
  761. #ifdef ASE_TRANSLUCENCY
  762. float _TransStrength;
  763. float _TransNormal;
  764. float _TransScattering;
  765. float _TransDirect;
  766. float _TransAmbient;
  767. float _TransShadow;
  768. #endif
  769. #ifdef ASE_TESSELLATION
  770. float _TessPhongStrength;
  771. float _TessValue;
  772. float _TessMin;
  773. float _TessMax;
  774. float _TessEdgeLength;
  775. float _TessMaxDisp;
  776. #endif
  777. CBUFFER_END
  778. #ifdef SCENEPICKINGPASS
  779. float4 _SelectionID;
  780. #endif
  781. #ifdef SCENESELECTIONPASS
  782. int _ObjectId;
  783. int _PassValue;
  784. #endif
  785. sampler2D _Albedo;
  786. float3 _LightDirection;
  787. float3 _LightPosition;
  788. PackedVaryings VertexFunction( Attributes input )
  789. {
  790. PackedVaryings output;
  791. UNITY_SETUP_INSTANCE_ID(input);
  792. UNITY_TRANSFER_INSTANCE_ID(input, output);
  793. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
  794. output.ase_texcoord3.xy = input.ase_texcoord.xy;
  795. //setting value to unused interpolator channels and avoid initialization warnings
  796. output.ase_texcoord3.zw = 0;
  797. #ifdef ASE_ABSOLUTE_VERTEX_POS
  798. float3 defaultVertexValue = input.positionOS.xyz;
  799. #else
  800. float3 defaultVertexValue = float3(0, 0, 0);
  801. #endif
  802. float3 vertexValue = defaultVertexValue;
  803. #ifdef ASE_ABSOLUTE_VERTEX_POS
  804. input.positionOS.xyz = vertexValue;
  805. #else
  806. input.positionOS.xyz += vertexValue;
  807. #endif
  808. input.normalOS = input.normalOS;
  809. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  810. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  811. output.positionWS = positionWS;
  812. #endif
  813. float3 normalWS = TransformObjectToWorldDir(input.normalOS);
  814. #if _CASTING_PUNCTUAL_LIGHT_SHADOW
  815. float3 lightDirectionWS = normalize(_LightPosition - positionWS);
  816. #else
  817. float3 lightDirectionWS = _LightDirection;
  818. #endif
  819. float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
  820. //code for UNITY_REVERSED_Z is moved into Shadows.hlsl from 6000.0.22 and or higher
  821. positionCS = ApplyShadowClamping(positionCS);
  822. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  823. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  824. vertexInput.positionWS = positionWS;
  825. vertexInput.positionCS = positionCS;
  826. output.shadowCoord = GetShadowCoord( vertexInput );
  827. #endif
  828. output.positionCS = positionCS;
  829. output.clipPosV = positionCS;
  830. return output;
  831. }
  832. #if defined(ASE_TESSELLATION)
  833. struct VertexControl
  834. {
  835. float4 vertex : INTERNALTESSPOS;
  836. float3 normalOS : NORMAL;
  837. float4 ase_texcoord : TEXCOORD0;
  838. UNITY_VERTEX_INPUT_INSTANCE_ID
  839. };
  840. struct TessellationFactors
  841. {
  842. float edge[3] : SV_TessFactor;
  843. float inside : SV_InsideTessFactor;
  844. };
  845. VertexControl vert ( Attributes input )
  846. {
  847. VertexControl output;
  848. UNITY_SETUP_INSTANCE_ID(input);
  849. UNITY_TRANSFER_INSTANCE_ID(input, output);
  850. output.vertex = input.positionOS;
  851. output.normalOS = input.normalOS;
  852. output.ase_texcoord = input.ase_texcoord;
  853. return output;
  854. }
  855. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  856. {
  857. TessellationFactors output;
  858. float4 tf = 1;
  859. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  860. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  861. #if defined(ASE_FIXED_TESSELLATION)
  862. tf = FixedTess( tessValue );
  863. #elif defined(ASE_DISTANCE_TESSELLATION)
  864. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  865. #elif defined(ASE_LENGTH_TESSELLATION)
  866. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  867. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  868. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  869. #endif
  870. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  871. return output;
  872. }
  873. [domain("tri")]
  874. [partitioning("fractional_odd")]
  875. [outputtopology("triangle_cw")]
  876. [patchconstantfunc("TessellationFunction")]
  877. [outputcontrolpoints(3)]
  878. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  879. {
  880. return patch[id];
  881. }
  882. [domain("tri")]
  883. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  884. {
  885. Attributes output = (Attributes) 0;
  886. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  887. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  888. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  889. #if defined(ASE_PHONG_TESSELLATION)
  890. float3 pp[3];
  891. for (int i = 0; i < 3; ++i)
  892. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  893. float phongStrength = _TessPhongStrength;
  894. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  895. #endif
  896. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  897. return VertexFunction(output);
  898. }
  899. #else
  900. PackedVaryings vert ( Attributes input )
  901. {
  902. return VertexFunction( input );
  903. }
  904. #endif
  905. half4 frag( PackedVaryings input
  906. #ifdef ASE_DEPTH_WRITE_ON
  907. ,out float outputDepth : ASE_SV_DEPTH
  908. #endif
  909. ) : SV_TARGET
  910. {
  911. UNITY_SETUP_INSTANCE_ID( input );
  912. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  913. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  914. float3 WorldPosition = input.positionWS;
  915. #endif
  916. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  917. float4 ClipPos = input.clipPosV;
  918. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  919. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  920. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  921. ShadowCoords = input.shadowCoord;
  922. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  923. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  924. #endif
  925. #endif
  926. float2 uv_Albedo = input.ase_texcoord3.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  927. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  928. float Alpha = tex2DNode6.a;
  929. float AlphaClipThreshold = _AlphaClip;
  930. float AlphaClipThresholdShadow = 0.5;
  931. #ifdef ASE_DEPTH_WRITE_ON
  932. float DepthValue = input.positionCS.z;
  933. #endif
  934. #ifdef _ALPHATEST_ON
  935. #ifdef _ALPHATEST_SHADOW_ON
  936. clip(Alpha - AlphaClipThresholdShadow);
  937. #else
  938. clip(Alpha - AlphaClipThreshold);
  939. #endif
  940. #endif
  941. #if defined(LOD_FADE_CROSSFADE)
  942. LODFadeCrossFade( input.positionCS );
  943. #endif
  944. #ifdef ASE_DEPTH_WRITE_ON
  945. outputDepth = DepthValue;
  946. #endif
  947. return 0;
  948. }
  949. ENDHLSL
  950. }
  951. Pass
  952. {
  953. Name "DepthOnly"
  954. Tags { "LightMode"="DepthOnly" }
  955. ZWrite On
  956. ColorMask 0
  957. AlphaToMask Off
  958. HLSLPROGRAM
  959. #pragma multi_compile_local_fragment _ALPHATEST_ON
  960. #define _NORMAL_DROPOFF_TS 1
  961. #pragma multi_compile _ LOD_FADE_CROSSFADE
  962. #define ASE_FOG 1
  963. #pragma multi_compile_instancing
  964. #define _NORMALMAP 1
  965. #define ASE_VERSION 19701
  966. #define ASE_SRP_VERSION 170003
  967. #pragma vertex vert
  968. #pragma fragment frag
  969. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  970. #define _SPECULAR_COLOR 1
  971. #endif
  972. #define SHADERPASS SHADERPASS_DEPTHONLY
  973. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  974. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  975. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  976. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  977. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  978. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  979. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  980. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  981. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  982. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  983. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  984. #if defined(LOD_FADE_CROSSFADE)
  985. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  986. #endif
  987. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  988. #define ASE_SV_DEPTH SV_DepthLessEqual
  989. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  990. #else
  991. #define ASE_SV_DEPTH SV_Depth
  992. #define ASE_SV_POSITION_QUALIFIERS
  993. #endif
  994. struct Attributes
  995. {
  996. float4 positionOS : POSITION;
  997. float3 normalOS : NORMAL;
  998. float4 ase_texcoord : TEXCOORD0;
  999. UNITY_VERTEX_INPUT_INSTANCE_ID
  1000. };
  1001. struct PackedVaryings
  1002. {
  1003. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  1004. float4 clipPosV : TEXCOORD0;
  1005. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1006. float3 positionWS : TEXCOORD1;
  1007. #endif
  1008. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1009. float4 shadowCoord : TEXCOORD2;
  1010. #endif
  1011. float4 ase_texcoord3 : TEXCOORD3;
  1012. UNITY_VERTEX_INPUT_INSTANCE_ID
  1013. UNITY_VERTEX_OUTPUT_STEREO
  1014. };
  1015. CBUFFER_START(UnityPerMaterial)
  1016. float4 _Albedo_ST;
  1017. float4 _NormalMap_ST;
  1018. float4 _Gloss_ST;
  1019. float _NormalIntensity;
  1020. float _AlphaClip;
  1021. #ifdef ASE_TRANSMISSION
  1022. float _TransmissionShadow;
  1023. #endif
  1024. #ifdef ASE_TRANSLUCENCY
  1025. float _TransStrength;
  1026. float _TransNormal;
  1027. float _TransScattering;
  1028. float _TransDirect;
  1029. float _TransAmbient;
  1030. float _TransShadow;
  1031. #endif
  1032. #ifdef ASE_TESSELLATION
  1033. float _TessPhongStrength;
  1034. float _TessValue;
  1035. float _TessMin;
  1036. float _TessMax;
  1037. float _TessEdgeLength;
  1038. float _TessMaxDisp;
  1039. #endif
  1040. CBUFFER_END
  1041. #ifdef SCENEPICKINGPASS
  1042. float4 _SelectionID;
  1043. #endif
  1044. #ifdef SCENESELECTIONPASS
  1045. int _ObjectId;
  1046. int _PassValue;
  1047. #endif
  1048. sampler2D _Albedo;
  1049. PackedVaryings VertexFunction( Attributes input )
  1050. {
  1051. PackedVaryings output = (PackedVaryings)0;
  1052. UNITY_SETUP_INSTANCE_ID(input);
  1053. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1054. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1055. output.ase_texcoord3.xy = input.ase_texcoord.xy;
  1056. //setting value to unused interpolator channels and avoid initialization warnings
  1057. output.ase_texcoord3.zw = 0;
  1058. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1059. float3 defaultVertexValue = input.positionOS.xyz;
  1060. #else
  1061. float3 defaultVertexValue = float3(0, 0, 0);
  1062. #endif
  1063. float3 vertexValue = defaultVertexValue;
  1064. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1065. input.positionOS.xyz = vertexValue;
  1066. #else
  1067. input.positionOS.xyz += vertexValue;
  1068. #endif
  1069. input.normalOS = input.normalOS;
  1070. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1071. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1072. output.positionWS = vertexInput.positionWS;
  1073. #endif
  1074. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1075. output.shadowCoord = GetShadowCoord( vertexInput );
  1076. #endif
  1077. output.positionCS = vertexInput.positionCS;
  1078. output.clipPosV = vertexInput.positionCS;
  1079. return output;
  1080. }
  1081. #if defined(ASE_TESSELLATION)
  1082. struct VertexControl
  1083. {
  1084. float4 vertex : INTERNALTESSPOS;
  1085. float3 normalOS : NORMAL;
  1086. float4 ase_texcoord : TEXCOORD0;
  1087. UNITY_VERTEX_INPUT_INSTANCE_ID
  1088. };
  1089. struct TessellationFactors
  1090. {
  1091. float edge[3] : SV_TessFactor;
  1092. float inside : SV_InsideTessFactor;
  1093. };
  1094. VertexControl vert ( Attributes input )
  1095. {
  1096. VertexControl output;
  1097. UNITY_SETUP_INSTANCE_ID(input);
  1098. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1099. output.vertex = input.positionOS;
  1100. output.normalOS = input.normalOS;
  1101. output.ase_texcoord = input.ase_texcoord;
  1102. return output;
  1103. }
  1104. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1105. {
  1106. TessellationFactors output;
  1107. float4 tf = 1;
  1108. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1109. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1110. #if defined(ASE_FIXED_TESSELLATION)
  1111. tf = FixedTess( tessValue );
  1112. #elif defined(ASE_DISTANCE_TESSELLATION)
  1113. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1114. #elif defined(ASE_LENGTH_TESSELLATION)
  1115. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1116. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1117. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1118. #endif
  1119. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1120. return output;
  1121. }
  1122. [domain("tri")]
  1123. [partitioning("fractional_odd")]
  1124. [outputtopology("triangle_cw")]
  1125. [patchconstantfunc("TessellationFunction")]
  1126. [outputcontrolpoints(3)]
  1127. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1128. {
  1129. return patch[id];
  1130. }
  1131. [domain("tri")]
  1132. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1133. {
  1134. Attributes output = (Attributes) 0;
  1135. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1136. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1137. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1138. #if defined(ASE_PHONG_TESSELLATION)
  1139. float3 pp[3];
  1140. for (int i = 0; i < 3; ++i)
  1141. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1142. float phongStrength = _TessPhongStrength;
  1143. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1144. #endif
  1145. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1146. return VertexFunction(output);
  1147. }
  1148. #else
  1149. PackedVaryings vert ( Attributes input )
  1150. {
  1151. return VertexFunction( input );
  1152. }
  1153. #endif
  1154. half4 frag( PackedVaryings input
  1155. #ifdef ASE_DEPTH_WRITE_ON
  1156. ,out float outputDepth : ASE_SV_DEPTH
  1157. #endif
  1158. ) : SV_TARGET
  1159. {
  1160. UNITY_SETUP_INSTANCE_ID(input);
  1161. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1162. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1163. float3 WorldPosition = input.positionWS;
  1164. #endif
  1165. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1166. float4 ClipPos = input.clipPosV;
  1167. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  1168. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1169. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1170. ShadowCoords = input.shadowCoord;
  1171. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1172. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1173. #endif
  1174. #endif
  1175. float2 uv_Albedo = input.ase_texcoord3.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  1176. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  1177. float Alpha = tex2DNode6.a;
  1178. float AlphaClipThreshold = _AlphaClip;
  1179. #ifdef ASE_DEPTH_WRITE_ON
  1180. float DepthValue = input.positionCS.z;
  1181. #endif
  1182. #ifdef _ALPHATEST_ON
  1183. clip(Alpha - AlphaClipThreshold);
  1184. #endif
  1185. #if defined(LOD_FADE_CROSSFADE)
  1186. LODFadeCrossFade( input.positionCS );
  1187. #endif
  1188. #ifdef ASE_DEPTH_WRITE_ON
  1189. outputDepth = DepthValue;
  1190. #endif
  1191. return 0;
  1192. }
  1193. ENDHLSL
  1194. }
  1195. Pass
  1196. {
  1197. Name "Meta"
  1198. Tags { "LightMode"="Meta" }
  1199. Cull Off
  1200. HLSLPROGRAM
  1201. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1202. #define _NORMAL_DROPOFF_TS 1
  1203. #define ASE_FOG 1
  1204. #define _NORMALMAP 1
  1205. #define ASE_VERSION 19701
  1206. #define ASE_SRP_VERSION 170003
  1207. #pragma shader_feature EDITOR_VISUALIZATION
  1208. #pragma vertex vert
  1209. #pragma fragment frag
  1210. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1211. #define _SPECULAR_COLOR 1
  1212. #endif
  1213. #define SHADERPASS SHADERPASS_META
  1214. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1215. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1216. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1217. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1218. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1219. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1220. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1221. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1222. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1223. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1224. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
  1225. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1226. struct Attributes
  1227. {
  1228. float4 positionOS : POSITION;
  1229. float3 normalOS : NORMAL;
  1230. float4 texcoord0 : TEXCOORD0;
  1231. float4 texcoord1 : TEXCOORD1;
  1232. float4 texcoord2 : TEXCOORD2;
  1233. UNITY_VERTEX_INPUT_INSTANCE_ID
  1234. };
  1235. struct PackedVaryings
  1236. {
  1237. float4 positionCS : SV_POSITION;
  1238. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1239. float3 positionWS : TEXCOORD0;
  1240. #endif
  1241. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1242. float4 shadowCoord : TEXCOORD1;
  1243. #endif
  1244. #ifdef EDITOR_VISUALIZATION
  1245. float4 VizUV : TEXCOORD2;
  1246. float4 LightCoord : TEXCOORD3;
  1247. #endif
  1248. float4 ase_texcoord4 : TEXCOORD4;
  1249. UNITY_VERTEX_INPUT_INSTANCE_ID
  1250. UNITY_VERTEX_OUTPUT_STEREO
  1251. };
  1252. CBUFFER_START(UnityPerMaterial)
  1253. float4 _Albedo_ST;
  1254. float4 _NormalMap_ST;
  1255. float4 _Gloss_ST;
  1256. float _NormalIntensity;
  1257. float _AlphaClip;
  1258. #ifdef ASE_TRANSMISSION
  1259. float _TransmissionShadow;
  1260. #endif
  1261. #ifdef ASE_TRANSLUCENCY
  1262. float _TransStrength;
  1263. float _TransNormal;
  1264. float _TransScattering;
  1265. float _TransDirect;
  1266. float _TransAmbient;
  1267. float _TransShadow;
  1268. #endif
  1269. #ifdef ASE_TESSELLATION
  1270. float _TessPhongStrength;
  1271. float _TessValue;
  1272. float _TessMin;
  1273. float _TessMax;
  1274. float _TessEdgeLength;
  1275. float _TessMaxDisp;
  1276. #endif
  1277. CBUFFER_END
  1278. #ifdef SCENEPICKINGPASS
  1279. float4 _SelectionID;
  1280. #endif
  1281. #ifdef SCENESELECTIONPASS
  1282. int _ObjectId;
  1283. int _PassValue;
  1284. #endif
  1285. sampler2D _Albedo;
  1286. PackedVaryings VertexFunction( Attributes input )
  1287. {
  1288. PackedVaryings output = (PackedVaryings)0;
  1289. UNITY_SETUP_INSTANCE_ID(input);
  1290. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1291. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1292. output.ase_texcoord4.xy = input.texcoord0.xy;
  1293. //setting value to unused interpolator channels and avoid initialization warnings
  1294. output.ase_texcoord4.zw = 0;
  1295. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1296. float3 defaultVertexValue = input.positionOS.xyz;
  1297. #else
  1298. float3 defaultVertexValue = float3(0, 0, 0);
  1299. #endif
  1300. float3 vertexValue = defaultVertexValue;
  1301. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1302. input.positionOS.xyz = vertexValue;
  1303. #else
  1304. input.positionOS.xyz += vertexValue;
  1305. #endif
  1306. input.normalOS = input.normalOS;
  1307. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  1308. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1309. output.positionWS = positionWS;
  1310. #endif
  1311. output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST );
  1312. #ifdef EDITOR_VISUALIZATION
  1313. float2 VizUV = 0;
  1314. float4 LightCoord = 0;
  1315. UnityEditorVizData(input.positionOS.xyz, input.texcoord0.xy, input.texcoord1.xy, input.texcoord2.xy, VizUV, LightCoord);
  1316. output.VizUV = float4(VizUV, 0, 0);
  1317. output.LightCoord = LightCoord;
  1318. #endif
  1319. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1320. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1321. vertexInput.positionWS = positionWS;
  1322. vertexInput.positionCS = output.positionCS;
  1323. output.shadowCoord = GetShadowCoord( vertexInput );
  1324. #endif
  1325. return output;
  1326. }
  1327. #if defined(ASE_TESSELLATION)
  1328. struct VertexControl
  1329. {
  1330. float4 vertex : INTERNALTESSPOS;
  1331. float3 normalOS : NORMAL;
  1332. float4 texcoord0 : TEXCOORD0;
  1333. float4 texcoord1 : TEXCOORD1;
  1334. float4 texcoord2 : TEXCOORD2;
  1335. UNITY_VERTEX_INPUT_INSTANCE_ID
  1336. };
  1337. struct TessellationFactors
  1338. {
  1339. float edge[3] : SV_TessFactor;
  1340. float inside : SV_InsideTessFactor;
  1341. };
  1342. VertexControl vert ( Attributes input )
  1343. {
  1344. VertexControl output;
  1345. UNITY_SETUP_INSTANCE_ID(input);
  1346. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1347. output.vertex = input.positionOS;
  1348. output.normalOS = input.normalOS;
  1349. output.texcoord0 = input.texcoord0;
  1350. output.texcoord1 = input.texcoord1;
  1351. output.texcoord2 = input.texcoord2;
  1352. return output;
  1353. }
  1354. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1355. {
  1356. TessellationFactors output;
  1357. float4 tf = 1;
  1358. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1359. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1360. #if defined(ASE_FIXED_TESSELLATION)
  1361. tf = FixedTess( tessValue );
  1362. #elif defined(ASE_DISTANCE_TESSELLATION)
  1363. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1364. #elif defined(ASE_LENGTH_TESSELLATION)
  1365. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1366. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1367. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1368. #endif
  1369. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1370. return output;
  1371. }
  1372. [domain("tri")]
  1373. [partitioning("fractional_odd")]
  1374. [outputtopology("triangle_cw")]
  1375. [patchconstantfunc("TessellationFunction")]
  1376. [outputcontrolpoints(3)]
  1377. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1378. {
  1379. return patch[id];
  1380. }
  1381. [domain("tri")]
  1382. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1383. {
  1384. Attributes output = (Attributes) 0;
  1385. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1386. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1387. output.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z;
  1388. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  1389. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  1390. #if defined(ASE_PHONG_TESSELLATION)
  1391. float3 pp[3];
  1392. for (int i = 0; i < 3; ++i)
  1393. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1394. float phongStrength = _TessPhongStrength;
  1395. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1396. #endif
  1397. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1398. return VertexFunction(output);
  1399. }
  1400. #else
  1401. PackedVaryings vert ( Attributes input )
  1402. {
  1403. return VertexFunction( input );
  1404. }
  1405. #endif
  1406. half4 frag(PackedVaryings input ) : SV_TARGET
  1407. {
  1408. UNITY_SETUP_INSTANCE_ID(input);
  1409. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1410. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1411. float3 WorldPosition = input.positionWS;
  1412. #endif
  1413. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1414. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1415. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1416. ShadowCoords = input.shadowCoord;
  1417. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1418. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1419. #endif
  1420. #endif
  1421. float2 uv_Albedo = input.ase_texcoord4.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  1422. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  1423. float3 BaseColor = tex2DNode6.rgb;
  1424. float3 Emission = 0;
  1425. float Alpha = tex2DNode6.a;
  1426. float AlphaClipThreshold = _AlphaClip;
  1427. #ifdef _ALPHATEST_ON
  1428. clip(Alpha - AlphaClipThreshold);
  1429. #endif
  1430. MetaInput metaInput = (MetaInput)0;
  1431. metaInput.Albedo = BaseColor;
  1432. metaInput.Emission = Emission;
  1433. #ifdef EDITOR_VISUALIZATION
  1434. metaInput.VizUV = input.VizUV.xy;
  1435. metaInput.LightCoord = input.LightCoord;
  1436. #endif
  1437. return UnityMetaFragment(metaInput);
  1438. }
  1439. ENDHLSL
  1440. }
  1441. Pass
  1442. {
  1443. Name "Universal2D"
  1444. Tags { "LightMode"="Universal2D" }
  1445. Blend One Zero, One Zero
  1446. ZWrite On
  1447. ZTest LEqual
  1448. Offset 0 , 0
  1449. ColorMask RGBA
  1450. HLSLPROGRAM
  1451. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1452. #define _NORMAL_DROPOFF_TS 1
  1453. #define ASE_FOG 1
  1454. #define _NORMALMAP 1
  1455. #define ASE_VERSION 19701
  1456. #define ASE_SRP_VERSION 170003
  1457. #pragma vertex vert
  1458. #pragma fragment frag
  1459. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1460. #define _SPECULAR_COLOR 1
  1461. #endif
  1462. #define SHADERPASS SHADERPASS_2D
  1463. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1464. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1465. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1466. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1467. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1468. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1469. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1470. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1471. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1472. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1473. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1474. struct Attributes
  1475. {
  1476. float4 positionOS : POSITION;
  1477. float3 normalOS : NORMAL;
  1478. float4 ase_texcoord : TEXCOORD0;
  1479. UNITY_VERTEX_INPUT_INSTANCE_ID
  1480. };
  1481. struct PackedVaryings
  1482. {
  1483. float4 positionCS : SV_POSITION;
  1484. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1485. float3 positionWS : TEXCOORD0;
  1486. #endif
  1487. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1488. float4 shadowCoord : TEXCOORD1;
  1489. #endif
  1490. float4 ase_texcoord2 : TEXCOORD2;
  1491. UNITY_VERTEX_INPUT_INSTANCE_ID
  1492. UNITY_VERTEX_OUTPUT_STEREO
  1493. };
  1494. CBUFFER_START(UnityPerMaterial)
  1495. float4 _Albedo_ST;
  1496. float4 _NormalMap_ST;
  1497. float4 _Gloss_ST;
  1498. float _NormalIntensity;
  1499. float _AlphaClip;
  1500. #ifdef ASE_TRANSMISSION
  1501. float _TransmissionShadow;
  1502. #endif
  1503. #ifdef ASE_TRANSLUCENCY
  1504. float _TransStrength;
  1505. float _TransNormal;
  1506. float _TransScattering;
  1507. float _TransDirect;
  1508. float _TransAmbient;
  1509. float _TransShadow;
  1510. #endif
  1511. #ifdef ASE_TESSELLATION
  1512. float _TessPhongStrength;
  1513. float _TessValue;
  1514. float _TessMin;
  1515. float _TessMax;
  1516. float _TessEdgeLength;
  1517. float _TessMaxDisp;
  1518. #endif
  1519. CBUFFER_END
  1520. #ifdef SCENEPICKINGPASS
  1521. float4 _SelectionID;
  1522. #endif
  1523. #ifdef SCENESELECTIONPASS
  1524. int _ObjectId;
  1525. int _PassValue;
  1526. #endif
  1527. sampler2D _Albedo;
  1528. PackedVaryings VertexFunction( Attributes input )
  1529. {
  1530. PackedVaryings output = (PackedVaryings)0;
  1531. UNITY_SETUP_INSTANCE_ID( input );
  1532. UNITY_TRANSFER_INSTANCE_ID( input, output );
  1533. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
  1534. output.ase_texcoord2.xy = input.ase_texcoord.xy;
  1535. //setting value to unused interpolator channels and avoid initialization warnings
  1536. output.ase_texcoord2.zw = 0;
  1537. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1538. float3 defaultVertexValue = input.positionOS.xyz;
  1539. #else
  1540. float3 defaultVertexValue = float3(0, 0, 0);
  1541. #endif
  1542. float3 vertexValue = defaultVertexValue;
  1543. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1544. input.positionOS.xyz = vertexValue;
  1545. #else
  1546. input.positionOS.xyz += vertexValue;
  1547. #endif
  1548. input.normalOS = input.normalOS;
  1549. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1550. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1551. output.positionWS = vertexInput.positionWS;
  1552. #endif
  1553. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1554. output.shadowCoord = GetShadowCoord( vertexInput );
  1555. #endif
  1556. output.positionCS = vertexInput.positionCS;
  1557. return output;
  1558. }
  1559. #if defined(ASE_TESSELLATION)
  1560. struct VertexControl
  1561. {
  1562. float4 vertex : INTERNALTESSPOS;
  1563. float3 normalOS : NORMAL;
  1564. float4 ase_texcoord : TEXCOORD0;
  1565. UNITY_VERTEX_INPUT_INSTANCE_ID
  1566. };
  1567. struct TessellationFactors
  1568. {
  1569. float edge[3] : SV_TessFactor;
  1570. float inside : SV_InsideTessFactor;
  1571. };
  1572. VertexControl vert ( Attributes input )
  1573. {
  1574. VertexControl output;
  1575. UNITY_SETUP_INSTANCE_ID(input);
  1576. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1577. output.vertex = input.positionOS;
  1578. output.normalOS = input.normalOS;
  1579. output.ase_texcoord = input.ase_texcoord;
  1580. return output;
  1581. }
  1582. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1583. {
  1584. TessellationFactors output;
  1585. float4 tf = 1;
  1586. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1587. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1588. #if defined(ASE_FIXED_TESSELLATION)
  1589. tf = FixedTess( tessValue );
  1590. #elif defined(ASE_DISTANCE_TESSELLATION)
  1591. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1592. #elif defined(ASE_LENGTH_TESSELLATION)
  1593. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1594. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1595. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1596. #endif
  1597. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1598. return output;
  1599. }
  1600. [domain("tri")]
  1601. [partitioning("fractional_odd")]
  1602. [outputtopology("triangle_cw")]
  1603. [patchconstantfunc("TessellationFunction")]
  1604. [outputcontrolpoints(3)]
  1605. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1606. {
  1607. return patch[id];
  1608. }
  1609. [domain("tri")]
  1610. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1611. {
  1612. Attributes output = (Attributes) 0;
  1613. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1614. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1615. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1616. #if defined(ASE_PHONG_TESSELLATION)
  1617. float3 pp[3];
  1618. for (int i = 0; i < 3; ++i)
  1619. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1620. float phongStrength = _TessPhongStrength;
  1621. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1622. #endif
  1623. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1624. return VertexFunction(output);
  1625. }
  1626. #else
  1627. PackedVaryings vert ( Attributes input )
  1628. {
  1629. return VertexFunction( input );
  1630. }
  1631. #endif
  1632. half4 frag(PackedVaryings input ) : SV_TARGET
  1633. {
  1634. UNITY_SETUP_INSTANCE_ID( input );
  1635. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1636. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1637. float3 WorldPosition = input.positionWS;
  1638. #endif
  1639. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1640. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1641. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1642. ShadowCoords = input.shadowCoord;
  1643. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1644. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1645. #endif
  1646. #endif
  1647. float2 uv_Albedo = input.ase_texcoord2.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  1648. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  1649. float3 BaseColor = tex2DNode6.rgb;
  1650. float Alpha = tex2DNode6.a;
  1651. float AlphaClipThreshold = _AlphaClip;
  1652. half4 color = half4(BaseColor, Alpha );
  1653. #ifdef _ALPHATEST_ON
  1654. clip(Alpha - AlphaClipThreshold);
  1655. #endif
  1656. return color;
  1657. }
  1658. ENDHLSL
  1659. }
  1660. Pass
  1661. {
  1662. Name "DepthNormals"
  1663. Tags { "LightMode"="DepthNormals" }
  1664. ZWrite On
  1665. Blend One Zero
  1666. ZTest LEqual
  1667. ZWrite On
  1668. HLSLPROGRAM
  1669. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1670. #define _NORMAL_DROPOFF_TS 1
  1671. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1672. #define ASE_FOG 1
  1673. #pragma multi_compile_instancing
  1674. #define _NORMALMAP 1
  1675. #define ASE_VERSION 19701
  1676. #define ASE_SRP_VERSION 170003
  1677. #pragma vertex vert
  1678. #pragma fragment frag
  1679. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1680. #define _SPECULAR_COLOR 1
  1681. #endif
  1682. #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
  1683. //#define SHADERPASS SHADERPASS_DEPTHNORMALS
  1684. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  1685. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  1686. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1687. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1688. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1689. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1690. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1691. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1692. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1693. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1694. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1695. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1696. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1697. #if defined(LOD_FADE_CROSSFADE)
  1698. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  1699. #endif
  1700. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  1701. #define ASE_SV_DEPTH SV_DepthLessEqual
  1702. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  1703. #else
  1704. #define ASE_SV_DEPTH SV_Depth
  1705. #define ASE_SV_POSITION_QUALIFIERS
  1706. #endif
  1707. struct Attributes
  1708. {
  1709. float4 positionOS : POSITION;
  1710. float3 normalOS : NORMAL;
  1711. float4 tangentOS : TANGENT;
  1712. float4 ase_texcoord : TEXCOORD0;
  1713. UNITY_VERTEX_INPUT_INSTANCE_ID
  1714. };
  1715. struct PackedVaryings
  1716. {
  1717. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  1718. float4 clipPosV : TEXCOORD0;
  1719. float3 worldNormal : TEXCOORD1;
  1720. float4 worldTangent : TEXCOORD2;
  1721. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1722. float3 positionWS : TEXCOORD3;
  1723. #endif
  1724. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1725. float4 shadowCoord : TEXCOORD4;
  1726. #endif
  1727. float4 ase_texcoord5 : TEXCOORD5;
  1728. UNITY_VERTEX_INPUT_INSTANCE_ID
  1729. UNITY_VERTEX_OUTPUT_STEREO
  1730. };
  1731. CBUFFER_START(UnityPerMaterial)
  1732. float4 _Albedo_ST;
  1733. float4 _NormalMap_ST;
  1734. float4 _Gloss_ST;
  1735. float _NormalIntensity;
  1736. float _AlphaClip;
  1737. #ifdef ASE_TRANSMISSION
  1738. float _TransmissionShadow;
  1739. #endif
  1740. #ifdef ASE_TRANSLUCENCY
  1741. float _TransStrength;
  1742. float _TransNormal;
  1743. float _TransScattering;
  1744. float _TransDirect;
  1745. float _TransAmbient;
  1746. float _TransShadow;
  1747. #endif
  1748. #ifdef ASE_TESSELLATION
  1749. float _TessPhongStrength;
  1750. float _TessValue;
  1751. float _TessMin;
  1752. float _TessMax;
  1753. float _TessEdgeLength;
  1754. float _TessMaxDisp;
  1755. #endif
  1756. CBUFFER_END
  1757. #ifdef SCENEPICKINGPASS
  1758. float4 _SelectionID;
  1759. #endif
  1760. #ifdef SCENESELECTIONPASS
  1761. int _ObjectId;
  1762. int _PassValue;
  1763. #endif
  1764. sampler2D _NormalMap;
  1765. sampler2D _Albedo;
  1766. PackedVaryings VertexFunction( Attributes input )
  1767. {
  1768. PackedVaryings output = (PackedVaryings)0;
  1769. UNITY_SETUP_INSTANCE_ID(input);
  1770. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1771. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1772. output.ase_texcoord5.xy = input.ase_texcoord.xy;
  1773. //setting value to unused interpolator channels and avoid initialization warnings
  1774. output.ase_texcoord5.zw = 0;
  1775. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1776. float3 defaultVertexValue = input.positionOS.xyz;
  1777. #else
  1778. float3 defaultVertexValue = float3(0, 0, 0);
  1779. #endif
  1780. float3 vertexValue = defaultVertexValue;
  1781. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1782. input.positionOS.xyz = vertexValue;
  1783. #else
  1784. input.positionOS.xyz += vertexValue;
  1785. #endif
  1786. input.normalOS = input.normalOS;
  1787. input.tangentOS = input.tangentOS;
  1788. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1789. float3 normalWS = TransformObjectToWorldNormal( input.normalOS );
  1790. float4 tangentWS = float4( TransformObjectToWorldDir( input.tangentOS.xyz ), input.tangentOS.w );
  1791. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1792. output.positionWS = vertexInput.positionWS;
  1793. #endif
  1794. output.worldNormal = normalWS;
  1795. output.worldTangent = tangentWS;
  1796. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1797. output.shadowCoord = GetShadowCoord( vertexInput );
  1798. #endif
  1799. output.positionCS = vertexInput.positionCS;
  1800. output.clipPosV = vertexInput.positionCS;
  1801. return output;
  1802. }
  1803. #if defined(ASE_TESSELLATION)
  1804. struct VertexControl
  1805. {
  1806. float4 vertex : INTERNALTESSPOS;
  1807. float3 normalOS : NORMAL;
  1808. float4 tangentOS : TANGENT;
  1809. float4 ase_texcoord : TEXCOORD0;
  1810. UNITY_VERTEX_INPUT_INSTANCE_ID
  1811. };
  1812. struct TessellationFactors
  1813. {
  1814. float edge[3] : SV_TessFactor;
  1815. float inside : SV_InsideTessFactor;
  1816. };
  1817. VertexControl vert ( Attributes input )
  1818. {
  1819. VertexControl output;
  1820. UNITY_SETUP_INSTANCE_ID(input);
  1821. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1822. output.vertex = input.positionOS;
  1823. output.normalOS = input.normalOS;
  1824. output.tangentOS = input.tangentOS;
  1825. output.ase_texcoord = input.ase_texcoord;
  1826. return output;
  1827. }
  1828. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1829. {
  1830. TessellationFactors output;
  1831. float4 tf = 1;
  1832. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1833. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1834. #if defined(ASE_FIXED_TESSELLATION)
  1835. tf = FixedTess( tessValue );
  1836. #elif defined(ASE_DISTANCE_TESSELLATION)
  1837. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1838. #elif defined(ASE_LENGTH_TESSELLATION)
  1839. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1840. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1841. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1842. #endif
  1843. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1844. return output;
  1845. }
  1846. [domain("tri")]
  1847. [partitioning("fractional_odd")]
  1848. [outputtopology("triangle_cw")]
  1849. [patchconstantfunc("TessellationFunction")]
  1850. [outputcontrolpoints(3)]
  1851. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1852. {
  1853. return patch[id];
  1854. }
  1855. [domain("tri")]
  1856. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1857. {
  1858. Attributes output = (Attributes) 0;
  1859. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1860. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1861. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  1862. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1863. #if defined(ASE_PHONG_TESSELLATION)
  1864. float3 pp[3];
  1865. for (int i = 0; i < 3; ++i)
  1866. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1867. float phongStrength = _TessPhongStrength;
  1868. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1869. #endif
  1870. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1871. return VertexFunction(output);
  1872. }
  1873. #else
  1874. PackedVaryings vert ( Attributes input )
  1875. {
  1876. return VertexFunction( input );
  1877. }
  1878. #endif
  1879. void frag( PackedVaryings input
  1880. , out half4 outNormalWS : SV_Target0
  1881. #ifdef ASE_DEPTH_WRITE_ON
  1882. ,out float outputDepth : ASE_SV_DEPTH
  1883. #endif
  1884. #ifdef _WRITE_RENDERING_LAYERS
  1885. , out float4 outRenderingLayers : SV_Target1
  1886. #endif
  1887. )
  1888. {
  1889. UNITY_SETUP_INSTANCE_ID(input);
  1890. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1891. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1892. float3 WorldPosition = input.positionWS;
  1893. #endif
  1894. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1895. float3 WorldNormal = input.worldNormal;
  1896. float4 WorldTangent = input.worldTangent;
  1897. float4 ClipPos = input.clipPosV;
  1898. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  1899. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1900. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1901. ShadowCoords = input.shadowCoord;
  1902. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1903. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1904. #endif
  1905. #endif
  1906. float2 uv_NormalMap = input.ase_texcoord5.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
  1907. float3 unpack8 = UnpackNormalScale( tex2D( _NormalMap, uv_NormalMap ), _NormalIntensity );
  1908. unpack8.z = lerp( 1, unpack8.z, saturate(_NormalIntensity) );
  1909. float2 uv_Albedo = input.ase_texcoord5.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  1910. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  1911. float3 Normal = unpack8;
  1912. float Alpha = tex2DNode6.a;
  1913. float AlphaClipThreshold = _AlphaClip;
  1914. #ifdef ASE_DEPTH_WRITE_ON
  1915. float DepthValue = input.positionCS.z;
  1916. #endif
  1917. #ifdef _ALPHATEST_ON
  1918. clip(Alpha - AlphaClipThreshold);
  1919. #endif
  1920. #if defined(LOD_FADE_CROSSFADE)
  1921. LODFadeCrossFade( input.positionCS );
  1922. #endif
  1923. #ifdef ASE_DEPTH_WRITE_ON
  1924. outputDepth = DepthValue;
  1925. #endif
  1926. #if defined(_GBUFFER_NORMALS_OCT)
  1927. float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal);
  1928. float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);
  1929. half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);
  1930. outNormalWS = half4(packedNormalWS, 0.0);
  1931. #else
  1932. #if defined(_NORMALMAP)
  1933. #if _NORMAL_DROPOFF_TS
  1934. float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
  1935. float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz);
  1936. float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz));
  1937. #elif _NORMAL_DROPOFF_OS
  1938. float3 normalWS = TransformObjectToWorldNormal(Normal);
  1939. #elif _NORMAL_DROPOFF_WS
  1940. float3 normalWS = Normal;
  1941. #endif
  1942. #else
  1943. float3 normalWS = WorldNormal;
  1944. #endif
  1945. outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0);
  1946. #endif
  1947. #ifdef _WRITE_RENDERING_LAYERS
  1948. uint renderingLayers = GetMeshRenderingLayer();
  1949. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  1950. #endif
  1951. }
  1952. ENDHLSL
  1953. }
  1954. Pass
  1955. {
  1956. Name "GBuffer"
  1957. Tags { "LightMode"="UniversalGBuffer" }
  1958. Blend One Zero, One Zero
  1959. ZWrite On
  1960. ZTest LEqual
  1961. Offset 0 , 0
  1962. ColorMask RGBA
  1963. HLSLPROGRAM
  1964. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1965. #define _NORMAL_DROPOFF_TS 1
  1966. #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
  1967. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1968. #pragma multi_compile_fog
  1969. #define ASE_FOG 1
  1970. #pragma multi_compile_instancing
  1971. #pragma instancing_options renderinglayer
  1972. #define _NORMALMAP 1
  1973. #define ASE_VERSION 19701
  1974. #define ASE_SRP_VERSION 170003
  1975. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
  1976. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
  1977. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
  1978. #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
  1979. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  1980. #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
  1981. #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
  1982. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  1983. #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
  1984. #pragma multi_compile _ SHADOWS_SHADOWMASK
  1985. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  1986. #pragma multi_compile _ USE_LEGACY_LIGHTMAPS
  1987. #pragma multi_compile _ LIGHTMAP_ON
  1988. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  1989. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  1990. #pragma vertex vert
  1991. #pragma fragment frag
  1992. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1993. #define _SPECULAR_COLOR 1
  1994. #endif
  1995. #define SHADERPASS SHADERPASS_GBUFFER
  1996. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  1997. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  1998. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  1999. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2000. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2001. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2002. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2003. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2004. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2005. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2006. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2007. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2008. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  2009. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2010. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  2011. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2012. #if defined(LOD_FADE_CROSSFADE)
  2013. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  2014. #endif
  2015. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  2016. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  2017. #endif
  2018. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  2019. #define ASE_SV_DEPTH SV_DepthLessEqual
  2020. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  2021. #else
  2022. #define ASE_SV_DEPTH SV_Depth
  2023. #define ASE_SV_POSITION_QUALIFIERS
  2024. #endif
  2025. struct Attributes
  2026. {
  2027. float4 positionOS : POSITION;
  2028. float3 normalOS : NORMAL;
  2029. float4 tangentOS : TANGENT;
  2030. float4 texcoord : TEXCOORD0;
  2031. float4 texcoord1 : TEXCOORD1;
  2032. float4 texcoord2 : TEXCOORD2;
  2033. UNITY_VERTEX_INPUT_INSTANCE_ID
  2034. };
  2035. struct PackedVaryings
  2036. {
  2037. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  2038. float4 clipPosV : TEXCOORD0;
  2039. float4 lightmapUVOrVertexSH : TEXCOORD1;
  2040. half4 fogFactorAndVertexLight : TEXCOORD2;
  2041. float4 tSpace0 : TEXCOORD3;
  2042. float4 tSpace1 : TEXCOORD4;
  2043. float4 tSpace2 : TEXCOORD5;
  2044. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2045. float4 shadowCoord : TEXCOORD6;
  2046. #endif
  2047. #if defined(DYNAMICLIGHTMAP_ON)
  2048. float2 dynamicLightmapUV : TEXCOORD7;
  2049. #endif
  2050. #if defined(USE_APV_PROBE_OCCLUSION)
  2051. float4 probeOcclusion : TEXCOORD8;
  2052. #endif
  2053. float4 ase_texcoord9 : TEXCOORD9;
  2054. UNITY_VERTEX_INPUT_INSTANCE_ID
  2055. UNITY_VERTEX_OUTPUT_STEREO
  2056. };
  2057. CBUFFER_START(UnityPerMaterial)
  2058. float4 _Albedo_ST;
  2059. float4 _NormalMap_ST;
  2060. float4 _Gloss_ST;
  2061. float _NormalIntensity;
  2062. float _AlphaClip;
  2063. #ifdef ASE_TRANSMISSION
  2064. float _TransmissionShadow;
  2065. #endif
  2066. #ifdef ASE_TRANSLUCENCY
  2067. float _TransStrength;
  2068. float _TransNormal;
  2069. float _TransScattering;
  2070. float _TransDirect;
  2071. float _TransAmbient;
  2072. float _TransShadow;
  2073. #endif
  2074. #ifdef ASE_TESSELLATION
  2075. float _TessPhongStrength;
  2076. float _TessValue;
  2077. float _TessMin;
  2078. float _TessMax;
  2079. float _TessEdgeLength;
  2080. float _TessMaxDisp;
  2081. #endif
  2082. CBUFFER_END
  2083. #ifdef SCENEPICKINGPASS
  2084. float4 _SelectionID;
  2085. #endif
  2086. #ifdef SCENESELECTIONPASS
  2087. int _ObjectId;
  2088. int _PassValue;
  2089. #endif
  2090. sampler2D _Albedo;
  2091. sampler2D _NormalMap;
  2092. sampler2D _Gloss;
  2093. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
  2094. PackedVaryings VertexFunction( Attributes input )
  2095. {
  2096. PackedVaryings output = (PackedVaryings)0;
  2097. UNITY_SETUP_INSTANCE_ID(input);
  2098. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2099. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2100. output.ase_texcoord9.xy = input.texcoord.xy;
  2101. //setting value to unused interpolator channels and avoid initialization warnings
  2102. output.ase_texcoord9.zw = 0;
  2103. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2104. float3 defaultVertexValue = input.positionOS.xyz;
  2105. #else
  2106. float3 defaultVertexValue = float3(0, 0, 0);
  2107. #endif
  2108. float3 vertexValue = defaultVertexValue;
  2109. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2110. input.positionOS.xyz = vertexValue;
  2111. #else
  2112. input.positionOS.xyz += vertexValue;
  2113. #endif
  2114. input.normalOS = input.normalOS;
  2115. input.tangentOS = input.tangentOS;
  2116. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  2117. VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS );
  2118. output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x);
  2119. output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y);
  2120. output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z);
  2121. #if defined(LIGHTMAP_ON)
  2122. OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy);
  2123. #endif
  2124. #if defined(DYNAMICLIGHTMAP_ON)
  2125. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  2126. #endif
  2127. OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion );
  2128. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2129. output.lightmapUVOrVertexSH.zw = input.texcoord.xy;
  2130. output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  2131. #endif
  2132. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  2133. output.fogFactorAndVertexLight = half4(0, vertexLight);
  2134. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2135. output.shadowCoord = GetShadowCoord( vertexInput );
  2136. #endif
  2137. output.positionCS = vertexInput.positionCS;
  2138. output.clipPosV = vertexInput.positionCS;
  2139. return output;
  2140. }
  2141. #if defined(ASE_TESSELLATION)
  2142. struct VertexControl
  2143. {
  2144. float4 vertex : INTERNALTESSPOS;
  2145. float3 normalOS : NORMAL;
  2146. float4 tangentOS : TANGENT;
  2147. float4 texcoord : TEXCOORD0;
  2148. float4 texcoord1 : TEXCOORD1;
  2149. float4 texcoord2 : TEXCOORD2;
  2150. UNITY_VERTEX_INPUT_INSTANCE_ID
  2151. };
  2152. struct TessellationFactors
  2153. {
  2154. float edge[3] : SV_TessFactor;
  2155. float inside : SV_InsideTessFactor;
  2156. };
  2157. VertexControl vert ( Attributes input )
  2158. {
  2159. VertexControl output;
  2160. UNITY_SETUP_INSTANCE_ID(input);
  2161. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2162. output.vertex = input.positionOS;
  2163. output.normalOS = input.normalOS;
  2164. output.tangentOS = input.tangentOS;
  2165. output.texcoord = input.texcoord;
  2166. output.texcoord1 = input.texcoord1;
  2167. output.texcoord2 = input.texcoord2;
  2168. return output;
  2169. }
  2170. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2171. {
  2172. TessellationFactors output;
  2173. float4 tf = 1;
  2174. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2175. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2176. #if defined(ASE_FIXED_TESSELLATION)
  2177. tf = FixedTess( tessValue );
  2178. #elif defined(ASE_DISTANCE_TESSELLATION)
  2179. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2180. #elif defined(ASE_LENGTH_TESSELLATION)
  2181. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2182. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2183. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2184. #endif
  2185. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2186. return output;
  2187. }
  2188. [domain("tri")]
  2189. [partitioning("fractional_odd")]
  2190. [outputtopology("triangle_cw")]
  2191. [patchconstantfunc("TessellationFunction")]
  2192. [outputcontrolpoints(3)]
  2193. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2194. {
  2195. return patch[id];
  2196. }
  2197. [domain("tri")]
  2198. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2199. {
  2200. Attributes output = (Attributes) 0;
  2201. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2202. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2203. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  2204. output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  2205. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  2206. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  2207. #if defined(ASE_PHONG_TESSELLATION)
  2208. float3 pp[3];
  2209. for (int i = 0; i < 3; ++i)
  2210. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2211. float phongStrength = _TessPhongStrength;
  2212. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2213. #endif
  2214. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2215. return VertexFunction(output);
  2216. }
  2217. #else
  2218. PackedVaryings vert ( Attributes input )
  2219. {
  2220. return VertexFunction( input );
  2221. }
  2222. #endif
  2223. FragmentOutput frag ( PackedVaryings input
  2224. #ifdef ASE_DEPTH_WRITE_ON
  2225. ,out float outputDepth : ASE_SV_DEPTH
  2226. #endif
  2227. )
  2228. {
  2229. UNITY_SETUP_INSTANCE_ID(input);
  2230. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  2231. #if defined(LOD_FADE_CROSSFADE)
  2232. LODFadeCrossFade( input.positionCS );
  2233. #endif
  2234. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2235. float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  2236. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  2237. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  2238. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  2239. #else
  2240. float3 WorldNormal = normalize( input.tSpace0.xyz );
  2241. float3 WorldTangent = input.tSpace1.xyz;
  2242. float3 WorldBiTangent = input.tSpace2.xyz;
  2243. #endif
  2244. float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w);
  2245. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  2246. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  2247. float4 ClipPos = input.clipPosV;
  2248. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  2249. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  2250. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2251. ShadowCoords = input.shadowCoord;
  2252. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  2253. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  2254. #else
  2255. ShadowCoords = float4(0, 0, 0, 0);
  2256. #endif
  2257. WorldViewDirection = SafeNormalize( WorldViewDirection );
  2258. float2 uv_Albedo = input.ase_texcoord9.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  2259. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  2260. float2 uv_NormalMap = input.ase_texcoord9.xy * _NormalMap_ST.xy + _NormalMap_ST.zw;
  2261. float3 unpack8 = UnpackNormalScale( tex2D( _NormalMap, uv_NormalMap ), _NormalIntensity );
  2262. unpack8.z = lerp( 1, unpack8.z, saturate(_NormalIntensity) );
  2263. float2 uv_Gloss = input.ase_texcoord9.xy * _Gloss_ST.xy + _Gloss_ST.zw;
  2264. float3 BaseColor = tex2DNode6.rgb;
  2265. float3 Normal = unpack8;
  2266. float3 Emission = 0;
  2267. float3 Specular = 0.5;
  2268. float Metallic = 0;
  2269. float Smoothness = tex2D( _Gloss, uv_Gloss ).a;
  2270. float Occlusion = 1;
  2271. float Alpha = tex2DNode6.a;
  2272. float AlphaClipThreshold = _AlphaClip;
  2273. float AlphaClipThresholdShadow = 0.5;
  2274. float3 BakedGI = 0;
  2275. float3 RefractionColor = 1;
  2276. float RefractionIndex = 1;
  2277. float3 Transmission = 1;
  2278. float3 Translucency = 1;
  2279. #ifdef ASE_DEPTH_WRITE_ON
  2280. float DepthValue = input.positionCS.z;
  2281. #endif
  2282. #ifdef _ALPHATEST_ON
  2283. clip(Alpha - AlphaClipThreshold);
  2284. #endif
  2285. InputData inputData = (InputData)0;
  2286. inputData.positionWS = WorldPosition;
  2287. inputData.positionCS = input.positionCS;
  2288. inputData.shadowCoord = ShadowCoords;
  2289. #ifdef _NORMALMAP
  2290. #if _NORMAL_DROPOFF_TS
  2291. inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal ));
  2292. #elif _NORMAL_DROPOFF_OS
  2293. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  2294. #elif _NORMAL_DROPOFF_WS
  2295. inputData.normalWS = Normal;
  2296. #endif
  2297. #else
  2298. inputData.normalWS = WorldNormal;
  2299. #endif
  2300. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  2301. inputData.viewDirectionWS = SafeNormalize( WorldViewDirection );
  2302. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  2303. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2304. float3 SH = SampleSH(inputData.normalWS.xyz);
  2305. #else
  2306. float3 SH = input.lightmapUVOrVertexSH.xyz;
  2307. #endif
  2308. #if defined(DYNAMICLIGHTMAP_ON)
  2309. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS);
  2310. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  2311. #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
  2312. inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS),
  2313. inputData.normalWS,
  2314. inputData.viewDirectionWS,
  2315. input.positionCS.xy,
  2316. input.probeOcclusion,
  2317. inputData.shadowMask );
  2318. #else
  2319. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
  2320. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  2321. #endif
  2322. #ifdef ASE_BAKEDGI
  2323. inputData.bakedGI = BakedGI;
  2324. #endif
  2325. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  2326. #if defined(DEBUG_DISPLAY)
  2327. #if defined(DYNAMICLIGHTMAP_ON)
  2328. inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
  2329. #endif
  2330. #if defined(LIGHTMAP_ON)
  2331. inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy;
  2332. #else
  2333. inputData.vertexSH = SH;
  2334. #endif
  2335. #if defined(USE_APV_PROBE_OCCLUSION)
  2336. inputData.probeOcclusion = input.probeOcclusion;
  2337. #endif
  2338. #endif
  2339. #ifdef _DBUFFER
  2340. ApplyDecal(input.positionCS,
  2341. BaseColor,
  2342. Specular,
  2343. inputData.normalWS,
  2344. Metallic,
  2345. Occlusion,
  2346. Smoothness);
  2347. #endif
  2348. BRDFData brdfData;
  2349. InitializeBRDFData
  2350. (BaseColor, Metallic, Specular, Smoothness, Alpha, brdfData);
  2351. Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
  2352. half4 color;
  2353. MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask);
  2354. color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
  2355. color.a = Alpha;
  2356. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  2357. color.rgb *= color.a;
  2358. #endif
  2359. #ifdef ASE_DEPTH_WRITE_ON
  2360. outputDepth = DepthValue;
  2361. #endif
  2362. return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb, Occlusion);
  2363. }
  2364. ENDHLSL
  2365. }
  2366. Pass
  2367. {
  2368. Name "SceneSelectionPass"
  2369. Tags { "LightMode"="SceneSelectionPass" }
  2370. Cull Off
  2371. AlphaToMask Off
  2372. HLSLPROGRAM
  2373. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2374. #define _NORMAL_DROPOFF_TS 1
  2375. #define ASE_FOG 1
  2376. #define _NORMALMAP 1
  2377. #define ASE_VERSION 19701
  2378. #define ASE_SRP_VERSION 170003
  2379. #pragma vertex vert
  2380. #pragma fragment frag
  2381. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2382. #define _SPECULAR_COLOR 1
  2383. #endif
  2384. #define SCENESELECTIONPASS 1
  2385. #define ATTRIBUTES_NEED_NORMAL
  2386. #define ATTRIBUTES_NEED_TANGENT
  2387. #define SHADERPASS SHADERPASS_DEPTHONLY
  2388. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2389. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2390. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2391. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2392. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2393. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2394. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2395. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2396. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2397. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2398. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2399. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2400. struct Attributes
  2401. {
  2402. float4 positionOS : POSITION;
  2403. float3 normalOS : NORMAL;
  2404. float4 ase_texcoord : TEXCOORD0;
  2405. UNITY_VERTEX_INPUT_INSTANCE_ID
  2406. };
  2407. struct PackedVaryings
  2408. {
  2409. float4 positionCS : SV_POSITION;
  2410. float4 ase_texcoord : TEXCOORD0;
  2411. UNITY_VERTEX_INPUT_INSTANCE_ID
  2412. UNITY_VERTEX_OUTPUT_STEREO
  2413. };
  2414. CBUFFER_START(UnityPerMaterial)
  2415. float4 _Albedo_ST;
  2416. float4 _NormalMap_ST;
  2417. float4 _Gloss_ST;
  2418. float _NormalIntensity;
  2419. float _AlphaClip;
  2420. #ifdef ASE_TRANSMISSION
  2421. float _TransmissionShadow;
  2422. #endif
  2423. #ifdef ASE_TRANSLUCENCY
  2424. float _TransStrength;
  2425. float _TransNormal;
  2426. float _TransScattering;
  2427. float _TransDirect;
  2428. float _TransAmbient;
  2429. float _TransShadow;
  2430. #endif
  2431. #ifdef ASE_TESSELLATION
  2432. float _TessPhongStrength;
  2433. float _TessValue;
  2434. float _TessMin;
  2435. float _TessMax;
  2436. float _TessEdgeLength;
  2437. float _TessMaxDisp;
  2438. #endif
  2439. CBUFFER_END
  2440. #ifdef SCENEPICKINGPASS
  2441. float4 _SelectionID;
  2442. #endif
  2443. #ifdef SCENESELECTIONPASS
  2444. int _ObjectId;
  2445. int _PassValue;
  2446. #endif
  2447. sampler2D _Albedo;
  2448. struct SurfaceDescription
  2449. {
  2450. float Alpha;
  2451. float AlphaClipThreshold;
  2452. };
  2453. PackedVaryings VertexFunction(Attributes input )
  2454. {
  2455. PackedVaryings output;
  2456. ZERO_INITIALIZE(PackedVaryings, output);
  2457. UNITY_SETUP_INSTANCE_ID(input);
  2458. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2459. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2460. output.ase_texcoord.xy = input.ase_texcoord.xy;
  2461. //setting value to unused interpolator channels and avoid initialization warnings
  2462. output.ase_texcoord.zw = 0;
  2463. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2464. float3 defaultVertexValue = input.positionOS.xyz;
  2465. #else
  2466. float3 defaultVertexValue = float3(0, 0, 0);
  2467. #endif
  2468. float3 vertexValue = defaultVertexValue;
  2469. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2470. input.positionOS.xyz = vertexValue;
  2471. #else
  2472. input.positionOS.xyz += vertexValue;
  2473. #endif
  2474. input.normalOS = input.normalOS;
  2475. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  2476. output.positionCS = TransformWorldToHClip(positionWS);
  2477. return output;
  2478. }
  2479. #if defined(ASE_TESSELLATION)
  2480. struct VertexControl
  2481. {
  2482. float4 vertex : INTERNALTESSPOS;
  2483. float3 normalOS : NORMAL;
  2484. float4 ase_texcoord : TEXCOORD0;
  2485. UNITY_VERTEX_INPUT_INSTANCE_ID
  2486. };
  2487. struct TessellationFactors
  2488. {
  2489. float edge[3] : SV_TessFactor;
  2490. float inside : SV_InsideTessFactor;
  2491. };
  2492. VertexControl vert ( Attributes input )
  2493. {
  2494. VertexControl output;
  2495. UNITY_SETUP_INSTANCE_ID(input);
  2496. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2497. output.vertex = input.positionOS;
  2498. output.normalOS = input.normalOS;
  2499. output.ase_texcoord = input.ase_texcoord;
  2500. return output;
  2501. }
  2502. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2503. {
  2504. TessellationFactors output;
  2505. float4 tf = 1;
  2506. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2507. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2508. #if defined(ASE_FIXED_TESSELLATION)
  2509. tf = FixedTess( tessValue );
  2510. #elif defined(ASE_DISTANCE_TESSELLATION)
  2511. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2512. #elif defined(ASE_LENGTH_TESSELLATION)
  2513. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2514. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2515. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2516. #endif
  2517. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2518. return output;
  2519. }
  2520. [domain("tri")]
  2521. [partitioning("fractional_odd")]
  2522. [outputtopology("triangle_cw")]
  2523. [patchconstantfunc("TessellationFunction")]
  2524. [outputcontrolpoints(3)]
  2525. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2526. {
  2527. return patch[id];
  2528. }
  2529. [domain("tri")]
  2530. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2531. {
  2532. Attributes output = (Attributes) 0;
  2533. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2534. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2535. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  2536. #if defined(ASE_PHONG_TESSELLATION)
  2537. float3 pp[3];
  2538. for (int i = 0; i < 3; ++i)
  2539. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2540. float phongStrength = _TessPhongStrength;
  2541. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2542. #endif
  2543. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2544. return VertexFunction(output);
  2545. }
  2546. #else
  2547. PackedVaryings vert ( Attributes input )
  2548. {
  2549. return VertexFunction( input );
  2550. }
  2551. #endif
  2552. half4 frag(PackedVaryings input ) : SV_TARGET
  2553. {
  2554. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  2555. float2 uv_Albedo = input.ase_texcoord.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  2556. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  2557. surfaceDescription.Alpha = tex2DNode6.a;
  2558. surfaceDescription.AlphaClipThreshold = _AlphaClip;
  2559. #if _ALPHATEST_ON
  2560. float alphaClipThreshold = 0.01f;
  2561. #if ALPHA_CLIP_THRESHOLD
  2562. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  2563. #endif
  2564. clip(surfaceDescription.Alpha - alphaClipThreshold);
  2565. #endif
  2566. half4 outColor = 0;
  2567. #ifdef SCENESELECTIONPASS
  2568. outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  2569. #elif defined(SCENEPICKINGPASS)
  2570. outColor = _SelectionID;
  2571. #endif
  2572. return outColor;
  2573. }
  2574. ENDHLSL
  2575. }
  2576. Pass
  2577. {
  2578. Name "ScenePickingPass"
  2579. Tags { "LightMode"="Picking" }
  2580. AlphaToMask Off
  2581. HLSLPROGRAM
  2582. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2583. #define _NORMAL_DROPOFF_TS 1
  2584. #define ASE_FOG 1
  2585. #define _NORMALMAP 1
  2586. #define ASE_VERSION 19701
  2587. #define ASE_SRP_VERSION 170003
  2588. #pragma vertex vert
  2589. #pragma fragment frag
  2590. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2591. #define _SPECULAR_COLOR 1
  2592. #endif
  2593. #define SCENEPICKINGPASS 1
  2594. #define ATTRIBUTES_NEED_NORMAL
  2595. #define ATTRIBUTES_NEED_TANGENT
  2596. #define SHADERPASS SHADERPASS_DEPTHONLY
  2597. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2598. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2599. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2600. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2601. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2602. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2603. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2604. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2605. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2606. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2607. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2608. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2609. struct Attributes
  2610. {
  2611. float4 positionOS : POSITION;
  2612. float3 normalOS : NORMAL;
  2613. float4 ase_texcoord : TEXCOORD0;
  2614. UNITY_VERTEX_INPUT_INSTANCE_ID
  2615. };
  2616. struct PackedVaryings
  2617. {
  2618. float4 positionCS : SV_POSITION;
  2619. float4 ase_texcoord : TEXCOORD0;
  2620. UNITY_VERTEX_INPUT_INSTANCE_ID
  2621. UNITY_VERTEX_OUTPUT_STEREO
  2622. };
  2623. CBUFFER_START(UnityPerMaterial)
  2624. float4 _Albedo_ST;
  2625. float4 _NormalMap_ST;
  2626. float4 _Gloss_ST;
  2627. float _NormalIntensity;
  2628. float _AlphaClip;
  2629. #ifdef ASE_TRANSMISSION
  2630. float _TransmissionShadow;
  2631. #endif
  2632. #ifdef ASE_TRANSLUCENCY
  2633. float _TransStrength;
  2634. float _TransNormal;
  2635. float _TransScattering;
  2636. float _TransDirect;
  2637. float _TransAmbient;
  2638. float _TransShadow;
  2639. #endif
  2640. #ifdef ASE_TESSELLATION
  2641. float _TessPhongStrength;
  2642. float _TessValue;
  2643. float _TessMin;
  2644. float _TessMax;
  2645. float _TessEdgeLength;
  2646. float _TessMaxDisp;
  2647. #endif
  2648. CBUFFER_END
  2649. #ifdef SCENEPICKINGPASS
  2650. float4 _SelectionID;
  2651. #endif
  2652. #ifdef SCENESELECTIONPASS
  2653. int _ObjectId;
  2654. int _PassValue;
  2655. #endif
  2656. sampler2D _Albedo;
  2657. struct SurfaceDescription
  2658. {
  2659. float Alpha;
  2660. float AlphaClipThreshold;
  2661. };
  2662. PackedVaryings VertexFunction(Attributes input )
  2663. {
  2664. PackedVaryings output;
  2665. ZERO_INITIALIZE(PackedVaryings, output);
  2666. UNITY_SETUP_INSTANCE_ID(input);
  2667. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2668. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2669. output.ase_texcoord.xy = input.ase_texcoord.xy;
  2670. //setting value to unused interpolator channels and avoid initialization warnings
  2671. output.ase_texcoord.zw = 0;
  2672. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2673. float3 defaultVertexValue = input.positionOS.xyz;
  2674. #else
  2675. float3 defaultVertexValue = float3(0, 0, 0);
  2676. #endif
  2677. float3 vertexValue = defaultVertexValue;
  2678. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2679. input.positionOS.xyz = vertexValue;
  2680. #else
  2681. input.positionOS.xyz += vertexValue;
  2682. #endif
  2683. input.normalOS = input.normalOS;
  2684. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  2685. output.positionCS = TransformWorldToHClip(positionWS);
  2686. return output;
  2687. }
  2688. #if defined(ASE_TESSELLATION)
  2689. struct VertexControl
  2690. {
  2691. float4 vertex : INTERNALTESSPOS;
  2692. float3 normalOS : NORMAL;
  2693. float4 ase_texcoord : TEXCOORD0;
  2694. UNITY_VERTEX_INPUT_INSTANCE_ID
  2695. };
  2696. struct TessellationFactors
  2697. {
  2698. float edge[3] : SV_TessFactor;
  2699. float inside : SV_InsideTessFactor;
  2700. };
  2701. VertexControl vert ( Attributes input )
  2702. {
  2703. VertexControl output;
  2704. UNITY_SETUP_INSTANCE_ID(input);
  2705. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2706. output.vertex = input.positionOS;
  2707. output.normalOS = input.normalOS;
  2708. output.ase_texcoord = input.ase_texcoord;
  2709. return output;
  2710. }
  2711. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2712. {
  2713. TessellationFactors output;
  2714. float4 tf = 1;
  2715. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2716. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2717. #if defined(ASE_FIXED_TESSELLATION)
  2718. tf = FixedTess( tessValue );
  2719. #elif defined(ASE_DISTANCE_TESSELLATION)
  2720. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2721. #elif defined(ASE_LENGTH_TESSELLATION)
  2722. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2723. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2724. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2725. #endif
  2726. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2727. return output;
  2728. }
  2729. [domain("tri")]
  2730. [partitioning("fractional_odd")]
  2731. [outputtopology("triangle_cw")]
  2732. [patchconstantfunc("TessellationFunction")]
  2733. [outputcontrolpoints(3)]
  2734. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2735. {
  2736. return patch[id];
  2737. }
  2738. [domain("tri")]
  2739. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2740. {
  2741. Attributes output = (Attributes) 0;
  2742. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2743. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2744. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  2745. #if defined(ASE_PHONG_TESSELLATION)
  2746. float3 pp[3];
  2747. for (int i = 0; i < 3; ++i)
  2748. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2749. float phongStrength = _TessPhongStrength;
  2750. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2751. #endif
  2752. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2753. return VertexFunction(output);
  2754. }
  2755. #else
  2756. PackedVaryings vert ( Attributes input )
  2757. {
  2758. return VertexFunction( input );
  2759. }
  2760. #endif
  2761. half4 frag(PackedVaryings input ) : SV_TARGET
  2762. {
  2763. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  2764. float2 uv_Albedo = input.ase_texcoord.xy * _Albedo_ST.xy + _Albedo_ST.zw;
  2765. float4 tex2DNode6 = tex2D( _Albedo, uv_Albedo );
  2766. surfaceDescription.Alpha = tex2DNode6.a;
  2767. surfaceDescription.AlphaClipThreshold = _AlphaClip;
  2768. #if _ALPHATEST_ON
  2769. float alphaClipThreshold = 0.01f;
  2770. #if ALPHA_CLIP_THRESHOLD
  2771. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  2772. #endif
  2773. clip(surfaceDescription.Alpha - alphaClipThreshold);
  2774. #endif
  2775. half4 outColor = 0;
  2776. #ifdef SCENESELECTIONPASS
  2777. outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  2778. #elif defined(SCENEPICKINGPASS)
  2779. outColor = _SelectionID;
  2780. #endif
  2781. return outColor;
  2782. }
  2783. ENDHLSL
  2784. }
  2785. Pass
  2786. {
  2787. Name "MotionVectors"
  2788. Tags { "LightMode"="MotionVectors" }
  2789. ColorMask RG
  2790. HLSLPROGRAM
  2791. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2792. #define _NORMAL_DROPOFF_TS 1
  2793. #pragma multi_compile _ LOD_FADE_CROSSFADE
  2794. #define ASE_FOG 1
  2795. #pragma multi_compile_instancing
  2796. #define _NORMALMAP 1
  2797. #define ASE_VERSION 19701
  2798. #define ASE_SRP_VERSION 170003
  2799. #pragma vertex vert
  2800. #pragma fragment frag
  2801. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2802. #define _SPECULAR_COLOR 1
  2803. #endif
  2804. #define SHADERPASS SHADERPASS_MOTION_VECTORS
  2805. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2806. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  2807. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2808. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2809. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2810. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2811. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2812. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2813. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2814. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2815. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2816. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2817. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2818. #if defined(LOD_FADE_CROSSFADE)
  2819. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  2820. #endif
  2821. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl"
  2822. struct Attributes
  2823. {
  2824. float4 positionOS : POSITION;
  2825. float3 positionOld : TEXCOORD4;
  2826. #if _ADD_PRECOMPUTED_VELOCITY
  2827. float3 alembicMotionVector : TEXCOORD5;
  2828. #endif
  2829. UNITY_VERTEX_INPUT_INSTANCE_ID
  2830. };
  2831. struct PackedVaryings
  2832. {
  2833. float4 positionCS : SV_POSITION;
  2834. float4 positionCSNoJitter : TEXCOORD0;
  2835. float4 previousPositionCSNoJitter : TEXCOORD1;
  2836. UNITY_VERTEX_INPUT_INSTANCE_ID
  2837. UNITY_VERTEX_OUTPUT_STEREO
  2838. };
  2839. CBUFFER_START(UnityPerMaterial)
  2840. float4 _Albedo_ST;
  2841. float4 _NormalMap_ST;
  2842. float4 _Gloss_ST;
  2843. float _NormalIntensity;
  2844. float _AlphaClip;
  2845. #ifdef ASE_TRANSMISSION
  2846. float _TransmissionShadow;
  2847. #endif
  2848. #ifdef ASE_TRANSLUCENCY
  2849. float _TransStrength;
  2850. float _TransNormal;
  2851. float _TransScattering;
  2852. float _TransDirect;
  2853. float _TransAmbient;
  2854. float _TransShadow;
  2855. #endif
  2856. #ifdef ASE_TESSELLATION
  2857. float _TessPhongStrength;
  2858. float _TessValue;
  2859. float _TessMin;
  2860. float _TessMax;
  2861. float _TessEdgeLength;
  2862. float _TessMaxDisp;
  2863. #endif
  2864. CBUFFER_END
  2865. #ifdef SCENEPICKINGPASS
  2866. float4 _SelectionID;
  2867. #endif
  2868. #ifdef SCENESELECTIONPASS
  2869. int _ObjectId;
  2870. int _PassValue;
  2871. #endif
  2872. PackedVaryings VertexFunction( Attributes input )
  2873. {
  2874. PackedVaryings output = (PackedVaryings)0;
  2875. UNITY_SETUP_INSTANCE_ID(input);
  2876. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2877. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2878. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2879. float3 defaultVertexValue = input.positionOS.xyz;
  2880. #else
  2881. float3 defaultVertexValue = float3(0, 0, 0);
  2882. #endif
  2883. float3 vertexValue = defaultVertexValue;
  2884. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2885. input.positionOS.xyz = vertexValue;
  2886. #else
  2887. input.positionOS.xyz += vertexValue;
  2888. #endif
  2889. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  2890. #if defined(APLICATION_SPACE_WARP_MOTION)
  2891. // We do not need jittered position in ASW
  2892. output.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, mul(UNITY_MATRIX_M, input.positionOS));;
  2893. output.positionCS = output.positionCSNoJitter;
  2894. #else
  2895. // Jittered. Match the frame.
  2896. output.positionCS = vertexInput.positionCS;
  2897. output.positionCSNoJitter = mul( _NonJitteredViewProjMatrix, mul( UNITY_MATRIX_M, input.positionOS));
  2898. #endif
  2899. float4 prevPos = ( unity_MotionVectorsParams.x == 1 ) ? float4( input.positionOld, 1 ) : input.positionOS;
  2900. #if _ADD_PRECOMPUTED_VELOCITY
  2901. prevPos = prevPos - float4(input.alembicMotionVector, 0);
  2902. #endif
  2903. output.previousPositionCSNoJitter = mul( _PrevViewProjMatrix, mul( UNITY_PREV_MATRIX_M, prevPos ) );
  2904. // removed in ObjectMotionVectors.hlsl found in unity 6000.0.23 and higher
  2905. //ApplyMotionVectorZBias( output.positionCS );
  2906. return output;
  2907. }
  2908. PackedVaryings vert ( Attributes input )
  2909. {
  2910. return VertexFunction( input );
  2911. }
  2912. half4 frag( PackedVaryings input ) : SV_Target
  2913. {
  2914. UNITY_SETUP_INSTANCE_ID(input);
  2915. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  2916. float Alpha = 1;
  2917. float AlphaClipThreshold = 0.5;
  2918. #ifdef _ALPHATEST_ON
  2919. clip(Alpha - AlphaClipThreshold);
  2920. #endif
  2921. #if defined(LOD_FADE_CROSSFADE)
  2922. LODFadeCrossFade( input.positionCS );
  2923. #endif
  2924. #if defined(APLICATION_SPACE_WARP_MOTION)
  2925. return float4( CalcAswNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 1 );
  2926. #else
  2927. return float4( CalcNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 0, 0 );
  2928. #endif
  2929. }
  2930. ENDHLSL
  2931. }
  2932. }
  2933. FallBack "Hidden/Shader Graph/FallbackError"
  2934. Fallback "Hidden/InternalErrorShader"
  2935. }
  2936. /*ASEBEGIN
  2937. Version=19701
  2938. Node;AmplifyShaderEditor.RangedFloatNode;9;-800,192;Inherit;False;Property;_NormalIntensity;Normal Intensity;3;0;Create;True;0;0;0;False;0;False;1;1;-3;3;0;1;FLOAT;0
  2939. Node;AmplifyShaderEditor.SamplerNode;11;-512,352;Inherit;True;Property;_Gloss;Gloss;4;1;[SingleLineTexture];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;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  2940. Node;AmplifyShaderEditor.SamplerNode;8;-512,144;Inherit;True;Property;_NormalMap;Normal Map;2;1;[SingleLineTexture];Create;True;0;0;0;False;0;False;-1;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  2941. Node;AmplifyShaderEditor.SamplerNode;6;-512,-64;Inherit;True;Property;_Albedo;Albedo;0;1;[SingleLineTexture];Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  2942. Node;AmplifyShaderEditor.RangedFloatNode;18;-486.8523,546.7761;Inherit;False;Property;_AlphaClip;Alpha Clip;1;0;Create;True;0;0;0;False;0;False;0.4;0.184;0;1;0;1;FLOAT;0
  2943. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;12;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;0;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2944. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;13;0,0;Float;False;True;-1;2;;0;12;Tobyfredson/Leaves Fast_URP;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;21;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalForward;False;False;0;Hidden/InternalErrorShader;0;0;Standard;45;Lighting Model;0;0;Workflow;1;0;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;1;0;Alpha Clipping;1;0; Use Shadow Threshold;0;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Forward Only;0;0;Transmission;0;0; Transmission Shadow;0.5,False,;0;Translucency;0;0; Translucency Strength;1,False,;0; Normal Distortion;0.5,False,;0; Scattering;2,False,;0; Direct;0.9,False,;0; Ambient;0.1,False,;0; Shadow;0.5,False,;0;Cast Shadows;1;0;Receive Shadows;1;0;Receive SSAO;1;0;Motion Vectors;1;0; Add Precomputed Velocity;0;0;GPU Instancing;1;637775053850438043;LOD CrossFade;1;0;Built-in Fog;1;0;_FinalColorxAlpha;0;0;Meta Pass;1;0;Override Baked GI;0;0;Extra Pre Pass;0;0;Tessellation;0;0; Phong;0;0; Strength;0.5,False,;0; Type;0;0; Tess;16,False,;0; Min;10,False,;0; Max;25,False,;0; Edge Length;16,False,;0; Max Displacement;25,False,;0;Write Depth;0;0; Early Z;0;0;Vertex Position,InvertActionOnDeselection;1;0;Debug Display;0;0;Clear Coat;0;0;0;11;False;True;True;True;True;True;True;True;True;True;True;False;;False;0
  2945. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;14;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;False;True;1;LightMode=ShadowCaster;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2946. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;15;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;True;1;LightMode=DepthOnly;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2947. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;16;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;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
  2948. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;17;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=Universal2D;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2949. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;19;0,60;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;0;1;False;;0;False;;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;;True;3;False;;False;True;1;LightMode=DepthNormals;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2950. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;20;0,60;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;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;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalGBuffer;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2951. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;21;0,60;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;SceneSelectionPass;0;8;SceneSelectionPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=SceneSelectionPass;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2952. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;22;0,60;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ScenePickingPass;0;9;ScenePickingPass;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;255;False;;255;False;;255;False;;7;False;;1;False;;1;False;;1;False;;7;False;;1;False;;1;False;;1;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Picking;False;False;0;Hidden/InternalErrorShader;0;0;Standard;0;False;0
  2953. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;23;0,100;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;MotionVectors;0;10;MotionVectors;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;False;False;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=MotionVectors;False;False;0;;0;0;Standard;0;False;0
  2954. WireConnection;8;5;9;0
  2955. WireConnection;13;0;6;0
  2956. WireConnection;13;1;8;0
  2957. WireConnection;13;4;11;4
  2958. WireConnection;13;6;6;4
  2959. WireConnection;13;7;18;0
  2960. ASEEND*/
  2961. //CHKSM=9EC2ADA7C77AE0C29254B8E3E7E4CC59851AE6B0