Snow Foliage.shader 154 KB

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