Detail Map Coverage (Tessellation).shader 220 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950
  1. // Made with Amplify Shader Editor v1.9.7.1
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Tobyfredson/Detail Map Coverage (Tessellation)"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
  8. [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
  9. [Header(______(TFS) Detail Map Coverage (Tessellation)______)][Header(_____________________________________________________)][Header(Texture Maps)][NoScaleOffset]_AlbedoMap("Albedo Map", 2D) = "white" {}
  10. [NoScaleOffset][Normal]_NormalMap("Normal Map", 2D) = "bump" {}
  11. [NoScaleOffset]_MaskMapRGBA("Mask Map *RGB(A)", 2D) = "white" {}
  12. _Tiling("Tiling", Vector) = (1,1,0,0)
  13. _Offset("Offset", Vector) = (1,1,0,0)
  14. [Header(Texture Settings)][Header((Normal))]_NormalIntensity("Normal Intensity", Range( 0 , 0.99)) = 0.99
  15. [Header((Smoothness))]_Float4("Smoothness", Range( 0 , 1)) = 1
  16. [Header((Ambient Occlusion))]_Float5("Ambient Occlusion", Range( 0 , 1)) = 1
  17. [Header(_____________________________________________________)][Header(Detail Texture Maps)][NoScaleOffset]_DetailAlbedo("Detail Albedo", 2D) = "gray" {}
  18. [NoScaleOffset][Normal]_DetailNormal("Detail Normal", 2D) = "bump" {}
  19. [NoScaleOffset]_DetailMask("Detail Mask", 2D) = "white" {}
  20. _TilingDetail("Tiling Detail", Vector) = (1,1,0,0)
  21. _OffsetDetail("Offset Detail", Vector) = (1,1,0,0)
  22. [Header(Detail Texture Settings)][Header((Detail Normal))]_DetailNormalIntensity("Detail Normal Intensity", Range( -3 , 3)) = 1
  23. [Header(_____________________________________________________)][Header(Coverage Texture Maps)][NoScaleOffset]_CoverageAlbedo("Coverage Albedo", 2D) = "white" {}
  24. [NoScaleOffset][Normal]_CoverageNormal("Coverage Normal", 2D) = "bump" {}
  25. [NoScaleOffset]_CoverageMask("Coverage Mask", 2D) = "white" {}
  26. [NoScaleOffset]_CoverageHeight("Coverage Height", 2D) = "white" {}
  27. _TilingCoverage("Tiling Coverage", Vector) = (1,1,0,0)
  28. [Header(Coverage Texture Settings)][Header((Coverage Smoothness))]_Float6("Coverage Smoothness ", Range( 0 , 1)) = 1
  29. [Header((Coverage Ao))]_Float7("Coverage Ao ", Range( 0 , 1)) = 1
  30. [Toggle]_NormalBlur("Normal Blur", Float) = 1
  31. [Header((TS Edge Slope))]_TSSlopeMin("TS Slope Min", Float) = -1
  32. _TSSlopeMax("TS Slope Max", Float) = 8
  33. [Header((Edge Slope))]_SlopeMin("Slope Min", Float) = -1
  34. _SlopeMax("Slope Max", Float) = 8
  35. [KeywordEnum(TangentSlopeTS,TopDownSlope)] _SlopeMode("Slope Mode", Float) = 1
  36. [Toggle(_EDGESLOPE_ON)] _EdgeSlope("Edge Slope", Float) = 0
  37. [Toggle(_EDGESLOPETESSELLATION_ON)] _EdgeSlopeTessellation("Edge Slope (Tessellation)", Float) = 0
  38. [Header((Moss Color))]_DryColorScale("Dry Color Scale", Float) = 1
  39. _DryColorOffset("Dry Color Offset", Float) = 0
  40. [Toggle]_MossColor("Moss Color", Float) = 1
  41. _Drycolor1("Dry color", Color) = (0.4196078,0.4392157,0.2352941,0)
  42. _Healthycolor1("Healthy color", Color) = (0.75,0.5608132,0.1544118,0)
  43. [Header(_____________________________________________________)][Header(Tessellation Settings)][Header((Displacement))]_DisplacementAmount("Displacement Amount", Range( 0 , 1)) = 1
  44. _CoverageAmount("Coverage Amount", Range( 0 , 5)) = 1
  45. _CoverageFalloff("Coverage Falloff", Range( 1 , 20)) = 20
  46. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  47. //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5
  48. //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1
  49. //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5
  50. //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2
  51. //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9
  52. //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1
  53. //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5
  54. //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
  55. //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
  56. //_TessMin( "Tess Min Distance", Float ) = 10
  57. //_TessMax( "Tess Max Distance", Float ) = 25
  58. //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
  59. //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
  60. [HideInInspector][ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1
  61. [HideInInspector][ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1
  62. [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0
  63. [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0
  64. [HideInInspector] _QueueControl("_QueueControl", Float) = -1
  65. [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
  66. [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
  67. [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
  68. //[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1
  69. }
  70. SubShader
  71. {
  72. LOD 0
  73. Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" "UniversalMaterialType"="Lit" }
  74. Cull Back
  75. ZWrite On
  76. ZTest LEqual
  77. Offset 0 , 0
  78. AlphaToMask Off
  79. HLSLINCLUDE
  80. #pragma target 4.5
  81. #pragma prefer_hlslcc gles
  82. // ensure rendering platforms toggle list is visible
  83. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  84. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
  85. #ifndef ASE_TESS_FUNCS
  86. #define ASE_TESS_FUNCS
  87. float4 FixedTess( float tessValue )
  88. {
  89. return tessValue;
  90. }
  91. float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
  92. {
  93. float3 wpos = mul(o2w,vertex).xyz;
  94. float dist = distance (wpos, cameraPos);
  95. float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
  96. return f;
  97. }
  98. float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
  99. {
  100. float4 tess;
  101. tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
  102. tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
  103. tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
  104. tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
  105. return tess;
  106. }
  107. float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
  108. {
  109. float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
  110. float len = distance(wpos0, wpos1);
  111. float f = max(len * scParams.y / (edgeLen * dist), 1.0);
  112. return f;
  113. }
  114. float DistanceFromPlane (float3 pos, float4 plane)
  115. {
  116. float d = dot (float4(pos,1.0f), plane);
  117. return d;
  118. }
  119. bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
  120. {
  121. float4 planeTest;
  122. planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  123. (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  124. (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
  125. planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  126. (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  127. (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
  128. planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  129. (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  130. (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
  131. planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  132. (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  133. (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
  134. return !all (planeTest);
  135. }
  136. float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
  137. {
  138. float3 f;
  139. f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
  140. f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
  141. f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
  142. return CalcTriEdgeTessFactors (f);
  143. }
  144. float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
  145. {
  146. float3 pos0 = mul(o2w,v0).xyz;
  147. float3 pos1 = mul(o2w,v1).xyz;
  148. float3 pos2 = mul(o2w,v2).xyz;
  149. float4 tess;
  150. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  151. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  152. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  153. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  154. return tess;
  155. }
  156. float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
  157. {
  158. float3 pos0 = mul(o2w,v0).xyz;
  159. float3 pos1 = mul(o2w,v1).xyz;
  160. float3 pos2 = mul(o2w,v2).xyz;
  161. float4 tess;
  162. if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
  163. {
  164. tess = 0.0f;
  165. }
  166. else
  167. {
  168. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  169. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  170. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  171. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  172. }
  173. return tess;
  174. }
  175. #endif //ASE_TESS_FUNCS
  176. ENDHLSL
  177. Pass
  178. {
  179. Name "Forward"
  180. Tags { "LightMode"="UniversalForward" }
  181. Blend One Zero, One Zero
  182. ZWrite On
  183. ZTest LEqual
  184. Offset 0 , 0
  185. ColorMask RGBA
  186. HLSLPROGRAM
  187. #pragma multi_compile_local_fragment _ALPHATEST_ON
  188. #define _NORMAL_DROPOFF_TS 1
  189. #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
  190. #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
  191. #pragma multi_compile_instancing
  192. #pragma instancing_options renderinglayer
  193. #pragma multi_compile _ LOD_FADE_CROSSFADE
  194. #pragma multi_compile_fog
  195. #define ASE_FOG 1
  196. #define _NORMALMAP 1
  197. #define ASE_VERSION 19701
  198. #define ASE_SRP_VERSION 170003
  199. #ifdef UNITY_COLORSPACE_GAMMA//ASE Color Space Def
  200. #define unity_ColorSpaceDouble half4(2.0, 2.0, 2.0, 2.0)//ASE Color Space Def
  201. #else // Linear values//ASE Color Space Def
  202. #define unity_ColorSpaceDouble half4(4.59479380, 4.59479380, 4.59479380, 2.0)//ASE Color Space Def
  203. #endif//ASE Color Space Def
  204. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
  205. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  206. #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
  207. #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
  208. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
  209. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
  210. #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
  211. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  212. #pragma multi_compile _ _LIGHT_LAYERS
  213. #pragma multi_compile_fragment _ _LIGHT_COOKIES
  214. #pragma multi_compile _ _FORWARD_PLUS
  215. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  216. #pragma multi_compile _ SHADOWS_SHADOWMASK
  217. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  218. #pragma multi_compile _ LIGHTMAP_ON
  219. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  220. #pragma multi_compile _ USE_LEGACY_LIGHTMAPS
  221. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  222. #pragma vertex vert
  223. #pragma fragment frag
  224. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  225. #define _SPECULAR_COLOR 1
  226. #endif
  227. #define SHADERPASS SHADERPASS_FORWARD
  228. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  229. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  230. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  231. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  232. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  233. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  234. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  235. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  236. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  237. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  238. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  239. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  240. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  241. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  242. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  243. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  244. #if defined(LOD_FADE_CROSSFADE)
  245. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  246. #endif
  247. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  248. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  249. #endif
  250. #define ASE_NEEDS_VERT_NORMAL
  251. #define ASE_NEEDS_VERT_TANGENT
  252. #define ASE_NEEDS_FRAG_WORLD_POSITION
  253. #define ASE_NEEDS_FRAG_WORLD_NORMAL
  254. #define ASE_NEEDS_FRAG_WORLD_TANGENT
  255. #define ASE_NEEDS_FRAG_WORLD_BITANGENT
  256. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  257. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  258. #pragma shader_feature_local _EDGESLOPE_ON
  259. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  260. #define ASE_SV_DEPTH SV_DepthLessEqual
  261. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  262. #else
  263. #define ASE_SV_DEPTH SV_Depth
  264. #define ASE_SV_POSITION_QUALIFIERS
  265. #endif
  266. struct Attributes
  267. {
  268. float4 positionOS : POSITION;
  269. float3 normalOS : NORMAL;
  270. float4 tangentOS : TANGENT;
  271. float4 texcoord : TEXCOORD0;
  272. float4 texcoord1 : TEXCOORD1;
  273. float4 texcoord2 : TEXCOORD2;
  274. UNITY_VERTEX_INPUT_INSTANCE_ID
  275. };
  276. struct PackedVaryings
  277. {
  278. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  279. float4 clipPosV : TEXCOORD0;
  280. float4 lightmapUVOrVertexSH : TEXCOORD1;
  281. half4 fogFactorAndVertexLight : TEXCOORD2;
  282. float4 tSpace0 : TEXCOORD3;
  283. float4 tSpace1 : TEXCOORD4;
  284. float4 tSpace2 : TEXCOORD5;
  285. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  286. float4 shadowCoord : TEXCOORD6;
  287. #endif
  288. #if defined(DYNAMICLIGHTMAP_ON)
  289. float2 dynamicLightmapUV : TEXCOORD7;
  290. #endif
  291. #if defined(USE_APV_PROBE_OCCLUSION)
  292. float4 probeOcclusion : TEXCOORD8;
  293. #endif
  294. float4 ase_texcoord9 : TEXCOORD9;
  295. UNITY_VERTEX_INPUT_INSTANCE_ID
  296. UNITY_VERTEX_OUTPUT_STEREO
  297. };
  298. CBUFFER_START(UnityPerMaterial)
  299. float4 _Healthycolor1;
  300. float4 _Drycolor1;
  301. float2 _TilingCoverage;
  302. float2 _TilingDetail;
  303. float2 _Offset;
  304. float2 _Tiling;
  305. float2 _OffsetDetail;
  306. float _DisplacementAmount;
  307. float _Float6;
  308. float _Float4;
  309. float _NormalBlur;
  310. float _DetailNormalIntensity;
  311. float _NormalIntensity;
  312. float _DryColorOffset;
  313. float _SlopeMin;
  314. float _DryColorScale;
  315. float _CoverageAmount;
  316. float _MossColor;
  317. float _Float5;
  318. float _TSSlopeMax;
  319. float _TSSlopeMin;
  320. float _SlopeMax;
  321. float _CoverageFalloff;
  322. float _Float7;
  323. #ifdef ASE_TRANSMISSION
  324. float _TransmissionShadow;
  325. #endif
  326. #ifdef ASE_TRANSLUCENCY
  327. float _TransStrength;
  328. float _TransNormal;
  329. float _TransScattering;
  330. float _TransDirect;
  331. float _TransAmbient;
  332. float _TransShadow;
  333. #endif
  334. #ifdef ASE_TESSELLATION
  335. float _TessPhongStrength;
  336. float _TessValue;
  337. float _TessMin;
  338. float _TessMax;
  339. float _TessEdgeLength;
  340. float _TessMaxDisp;
  341. #endif
  342. CBUFFER_END
  343. #ifdef SCENEPICKINGPASS
  344. float4 _SelectionID;
  345. #endif
  346. #ifdef SCENESELECTIONPASS
  347. int _ObjectId;
  348. int _PassValue;
  349. #endif
  350. sampler2D _CoverageHeight;
  351. sampler2D _AlbedoMap;
  352. sampler2D _DetailAlbedo;
  353. sampler2D _DetailMask;
  354. sampler2D _CoverageAlbedo;
  355. sampler2D _NormalMap;
  356. sampler2D _CoverageNormal;
  357. sampler2D _DetailNormal;
  358. sampler2D _MaskMapRGBA;
  359. sampler2D _CoverageMask;
  360. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  361. {
  362. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  363. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  364. float3 nsign = sign( worldNormal );
  365. half4 xNorm; half4 yNorm; half4 zNorm;
  366. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  367. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  368. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  369. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  370. }
  371. inline float4 TriplanarSampling157( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  372. {
  373. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  374. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  375. float3 nsign = sign( worldNormal );
  376. half4 xNorm; half4 yNorm; half4 zNorm;
  377. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  378. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  379. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  380. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  381. }
  382. inline float3 TriplanarSampling151( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  383. {
  384. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  385. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  386. float3 nsign = sign( worldNormal );
  387. half4 xNorm; half4 yNorm; half4 zNorm;
  388. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  389. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  390. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  391. xNorm.xyz = half3( UnpackNormalScale( xNorm , 1.0 ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;
  392. yNorm.xyz = half3( UnpackNormalScale( yNorm , 1.0 ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;
  393. zNorm.xyz = half3( UnpackNormalScale( zNorm , 1.0 ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;
  394. return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );
  395. }
  396. inline float4 TriplanarSampling289( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  397. {
  398. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  399. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  400. float3 nsign = sign( worldNormal );
  401. half4 xNorm; half4 yNorm; half4 zNorm;
  402. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  403. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  404. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  405. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  406. }
  407. PackedVaryings VertexFunction( Attributes input )
  408. {
  409. PackedVaryings output = (PackedVaryings)0;
  410. UNITY_SETUP_INSTANCE_ID(input);
  411. UNITY_TRANSFER_INSTANCE_ID(input, output);
  412. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  413. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  414. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  415. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  416. float4 TriplanarHeight355 = triplanar339;
  417. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  418. float3 _Tangent = float3(0,1,0);
  419. float3 ase_worldTangent = TransformObjectToWorldDir(input.tangentOS.xyz);
  420. float ase_vertexTangentSign = input.tangentOS.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  421. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  422. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  423. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  424. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  425. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  426. float3 temp_output_371_0 = abs( ase_worldNormal );
  427. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  428. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  429. float staticSwitch382 = saturate( lerpResult273 );
  430. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  431. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  432. #else
  433. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  434. #endif
  435. float Slope275 = staticSwitch382;
  436. #ifdef _EDGESLOPETESSELLATION_ON
  437. float staticSwitch365 = Slope275;
  438. #else
  439. float staticSwitch365 = 1.0;
  440. #endif
  441. output.ase_texcoord9.xy = input.texcoord.xy;
  442. //setting value to unused interpolator channels and avoid initialization warnings
  443. output.ase_texcoord9.zw = 0;
  444. #ifdef ASE_ABSOLUTE_VERTEX_POS
  445. float3 defaultVertexValue = input.positionOS.xyz;
  446. #else
  447. float3 defaultVertexValue = float3(0, 0, 0);
  448. #endif
  449. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  450. #ifdef ASE_ABSOLUTE_VERTEX_POS
  451. input.positionOS.xyz = vertexValue;
  452. #else
  453. input.positionOS.xyz += vertexValue;
  454. #endif
  455. input.normalOS = input.normalOS;
  456. input.tangentOS = input.tangentOS;
  457. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  458. VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS );
  459. output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x );
  460. output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y );
  461. output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z );
  462. #if defined(LIGHTMAP_ON)
  463. OUTPUT_LIGHTMAP_UV( input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy );
  464. #endif
  465. #if defined(DYNAMICLIGHTMAP_ON)
  466. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  467. #endif
  468. OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion );
  469. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  470. output.lightmapUVOrVertexSH.zw = input.texcoord.xy;
  471. output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  472. #endif
  473. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  474. #ifdef ASE_FOG
  475. half fogFactor = ComputeFogFactor( vertexInput.positionCS.z );
  476. #else
  477. half fogFactor = 0;
  478. #endif
  479. output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
  480. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  481. output.shadowCoord = GetShadowCoord( vertexInput );
  482. #endif
  483. output.positionCS = vertexInput.positionCS;
  484. output.clipPosV = vertexInput.positionCS;
  485. return output;
  486. }
  487. #if defined(ASE_TESSELLATION)
  488. struct VertexControl
  489. {
  490. float4 vertex : INTERNALTESSPOS;
  491. float3 normalOS : NORMAL;
  492. float4 tangentOS : TANGENT;
  493. float4 texcoord : TEXCOORD0;
  494. float4 texcoord1 : TEXCOORD1;
  495. float4 texcoord2 : TEXCOORD2;
  496. UNITY_VERTEX_INPUT_INSTANCE_ID
  497. };
  498. struct TessellationFactors
  499. {
  500. float edge[3] : SV_TessFactor;
  501. float inside : SV_InsideTessFactor;
  502. };
  503. VertexControl vert ( Attributes input )
  504. {
  505. VertexControl output;
  506. UNITY_SETUP_INSTANCE_ID(input);
  507. UNITY_TRANSFER_INSTANCE_ID(input, output);
  508. output.vertex = input.positionOS;
  509. output.normalOS = input.normalOS;
  510. output.tangentOS = input.tangentOS;
  511. output.texcoord = input.texcoord;
  512. output.texcoord1 = input.texcoord1;
  513. output.texcoord2 = input.texcoord2;
  514. return output;
  515. }
  516. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  517. {
  518. TessellationFactors output;
  519. float4 tf = 1;
  520. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  521. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  522. #if defined(ASE_FIXED_TESSELLATION)
  523. tf = FixedTess( tessValue );
  524. #elif defined(ASE_DISTANCE_TESSELLATION)
  525. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  526. #elif defined(ASE_LENGTH_TESSELLATION)
  527. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  528. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  529. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  530. #endif
  531. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  532. return output;
  533. }
  534. [domain("tri")]
  535. [partitioning("fractional_odd")]
  536. [outputtopology("triangle_cw")]
  537. [patchconstantfunc("TessellationFunction")]
  538. [outputcontrolpoints(3)]
  539. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  540. {
  541. return patch[id];
  542. }
  543. [domain("tri")]
  544. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  545. {
  546. Attributes output = (Attributes) 0;
  547. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  548. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  549. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  550. output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  551. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  552. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  553. #if defined(ASE_PHONG_TESSELLATION)
  554. float3 pp[3];
  555. for (int i = 0; i < 3; ++i)
  556. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  557. float phongStrength = _TessPhongStrength;
  558. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  559. #endif
  560. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  561. return VertexFunction(output);
  562. }
  563. #else
  564. PackedVaryings vert ( Attributes input )
  565. {
  566. return VertexFunction( input );
  567. }
  568. #endif
  569. half4 frag ( PackedVaryings input
  570. #ifdef ASE_DEPTH_WRITE_ON
  571. ,out float outputDepth : ASE_SV_DEPTH
  572. #endif
  573. #ifdef _WRITE_RENDERING_LAYERS
  574. , out float4 outRenderingLayers : SV_Target1
  575. #endif
  576. ) : SV_Target
  577. {
  578. UNITY_SETUP_INSTANCE_ID(input);
  579. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  580. #if defined(LOD_FADE_CROSSFADE)
  581. LODFadeCrossFade( input.positionCS );
  582. #endif
  583. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  584. float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  585. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  586. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  587. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  588. #else
  589. float3 WorldNormal = normalize( input.tSpace0.xyz );
  590. float3 WorldTangent = input.tSpace1.xyz;
  591. float3 WorldBiTangent = input.tSpace2.xyz;
  592. #endif
  593. float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w);
  594. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  595. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  596. float4 ClipPos = input.clipPosV;
  597. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  598. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  599. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  600. ShadowCoords = input.shadowCoord;
  601. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  602. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  603. #endif
  604. WorldViewDirection = SafeNormalize( WorldViewDirection );
  605. float2 texCoord147 = input.ase_texcoord9.xy * _Tiling + _Offset;
  606. float2 TileUVs232 = texCoord147;
  607. float4 AlbedoMapMain250 = tex2D( _AlbedoMap, TileUVs232 );
  608. float2 texCoord110 = input.ase_texcoord9.xy * _TilingDetail + _OffsetDetail;
  609. float2 TileUVs2231 = texCoord110;
  610. float2 uv_DetailMask221 = input.ase_texcoord9.xy;
  611. float4 tex2DNode221 = tex2D( _DetailMask, uv_DetailMask221 );
  612. float4 DetailAlbedoMap251 = ( AlbedoMapMain250 * ( ( ( tex2D( _DetailAlbedo, TileUVs2231 ) * unity_ColorSpaceDouble ) * tex2DNode221.a ) + ( 1.0 - tex2DNode221.a ) ) );
  613. float4 triplanar157 = TriplanarSampling157( _CoverageAlbedo, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  614. float4 TriplanarAlbedo258 = triplanar157;
  615. float4 lerpResult324 = lerp( ( TriplanarAlbedo258 * _Drycolor1 ) , ( ( TriplanarAlbedo258 * _Healthycolor1 ) * unity_ColorSpaceDouble ) , saturate( (WorldNormal.y*_DryColorScale + _DryColorOffset) ));
  616. float4 TriplanarMossColor_Output327 = lerpResult324;
  617. float3 unpack150 = UnpackNormalScale( tex2D( _NormalMap, TileUVs232 ), _NormalIntensity );
  618. unpack150.z = lerp( 1, unpack150.z, saturate(_NormalIntensity) );
  619. float3 NormalMapMain249 = unpack150;
  620. float3x3 ase_worldToTangent = float3x3(WorldTangent,WorldBiTangent,WorldNormal);
  621. float3 triplanar151 = TriplanarSampling151( _CoverageNormal, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  622. float3 tanTriplanarNormal151 = mul( ase_worldToTangent, triplanar151 );
  623. float3 TriplanarNormal259 = tanTriplanarNormal151;
  624. float temp_output_149_0 = saturate( ( WorldNormal.y * _CoverageAmount ) );
  625. float3 lerpResult152 = lerp( NormalMapMain249 , TriplanarNormal259 , temp_output_149_0);
  626. float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x );
  627. float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y );
  628. float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z );
  629. float3 tanNormal154 = lerpResult152;
  630. float3 worldNormal154 = float3(dot(tanToWorld0,tanNormal154), dot(tanToWorld1,tanNormal154), dot(tanToWorld2,tanNormal154));
  631. float temp_output_174_0 = saturate( ( worldNormal154.y * _CoverageAmount ) );
  632. float3 _Tangent = float3(0,1,0);
  633. float3x3 ase_tangentToWorldFast = float3x3(WorldTangent.x,WorldBiTangent.x,WorldNormal.x,WorldTangent.y,WorldBiTangent.y,WorldNormal.y,WorldTangent.z,WorldBiTangent.z,WorldNormal.z);
  634. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  635. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  636. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  637. float3 temp_output_371_0 = abs( WorldNormal );
  638. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  639. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  640. float staticSwitch382 = saturate( lerpResult273 );
  641. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  642. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  643. #else
  644. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  645. #endif
  646. float Slope275 = staticSwitch382;
  647. #ifdef _EDGESLOPE_ON
  648. float staticSwitch276 = ( temp_output_174_0 * Slope275 );
  649. #else
  650. float staticSwitch276 = temp_output_174_0;
  651. #endif
  652. float4 lerpResult182 = lerp( DetailAlbedoMap251 , (( _MossColor )?( TriplanarMossColor_Output327 ):( TriplanarAlbedo258 )) , staticSwitch276);
  653. float3 unpack192 = UnpackNormalScale( tex2D( _DetailNormal, TileUVs2231 ), _DetailNormalIntensity );
  654. unpack192.z = lerp( 1, unpack192.z, saturate(_DetailNormalIntensity) );
  655. float3 lerpResult246 = lerp( NormalMapMain249 , unpack192 , tex2DNode221.a);
  656. float3 DetailNormalMap248 = lerpResult246;
  657. float3 lerpResult196 = lerp( BlendNormal( DetailNormalMap248 , NormalMapMain249 ) , BlendNormal( (( _NormalBlur )?( float3(0,0,1) ):( NormalMapMain249 )) , TriplanarNormal259 ) , staticSwitch276);
  658. float4 tex2DNode156 = tex2D( _MaskMapRGBA, TileUVs232 );
  659. float4 triplanar289 = TriplanarSampling289( _CoverageMask, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  660. float lerpResult180 = lerp( ( tex2DNode156.a * _Float4 ) , ( triplanar289.w * _Float6 ) , staticSwitch276);
  661. float lerpResult293 = lerp( pow( abs( tex2DNode156.g ) , _Float5 ) , pow( abs( triplanar289.g ) , _Float7 ) , staticSwitch276);
  662. float3 BaseColor = lerpResult182.xyz;
  663. float3 Normal = lerpResult196;
  664. float3 Emission = 0;
  665. float3 Specular = 0.5;
  666. float Metallic = 0;
  667. float Smoothness = lerpResult180;
  668. float Occlusion = lerpResult293;
  669. float Alpha = 1;
  670. float AlphaClipThreshold = 0.5;
  671. float AlphaClipThresholdShadow = 0.5;
  672. float3 BakedGI = 0;
  673. float3 RefractionColor = 1;
  674. float RefractionIndex = 1;
  675. float3 Transmission = 1;
  676. float3 Translucency = 1;
  677. #ifdef ASE_DEPTH_WRITE_ON
  678. float DepthValue = input.positionCS.z;
  679. #endif
  680. #ifdef _CLEARCOAT
  681. float CoatMask = 0;
  682. float CoatSmoothness = 0;
  683. #endif
  684. #ifdef _ALPHATEST_ON
  685. clip(Alpha - AlphaClipThreshold);
  686. #endif
  687. InputData inputData = (InputData)0;
  688. inputData.positionWS = WorldPosition;
  689. inputData.positionCS = input.positionCS;
  690. inputData.viewDirectionWS = WorldViewDirection;
  691. #ifdef _NORMALMAP
  692. #if _NORMAL_DROPOFF_TS
  693. inputData.normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent, WorldBiTangent, WorldNormal));
  694. #elif _NORMAL_DROPOFF_OS
  695. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  696. #elif _NORMAL_DROPOFF_WS
  697. inputData.normalWS = Normal;
  698. #endif
  699. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  700. #else
  701. inputData.normalWS = WorldNormal;
  702. #endif
  703. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  704. inputData.shadowCoord = ShadowCoords;
  705. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  706. inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
  707. #else
  708. inputData.shadowCoord = float4(0, 0, 0, 0);
  709. #endif
  710. #ifdef ASE_FOG
  711. inputData.fogCoord = input.fogFactorAndVertexLight.x;
  712. #endif
  713. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  714. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  715. float3 SH = SampleSH(inputData.normalWS.xyz);
  716. #else
  717. float3 SH = input.lightmapUVOrVertexSH.xyz;
  718. #endif
  719. #if defined(DYNAMICLIGHTMAP_ON)
  720. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS);
  721. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  722. #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
  723. inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS),
  724. inputData.normalWS,
  725. inputData.viewDirectionWS,
  726. input.positionCS.xy,
  727. input.probeOcclusion,
  728. inputData.shadowMask );
  729. #else
  730. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
  731. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  732. #endif
  733. #ifdef ASE_BAKEDGI
  734. inputData.bakedGI = BakedGI;
  735. #endif
  736. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  737. #if defined(DEBUG_DISPLAY)
  738. #if defined(DYNAMICLIGHTMAP_ON)
  739. inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
  740. #endif
  741. #if defined(LIGHTMAP_ON)
  742. inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy;
  743. #else
  744. inputData.vertexSH = SH;
  745. #endif
  746. #if defined(USE_APV_PROBE_OCCLUSION)
  747. inputData.probeOcclusion = input.probeOcclusion;
  748. #endif
  749. #endif
  750. SurfaceData surfaceData;
  751. surfaceData.albedo = BaseColor;
  752. surfaceData.metallic = saturate(Metallic);
  753. surfaceData.specular = Specular;
  754. surfaceData.smoothness = saturate(Smoothness),
  755. surfaceData.occlusion = Occlusion,
  756. surfaceData.emission = Emission,
  757. surfaceData.alpha = saturate(Alpha);
  758. surfaceData.normalTS = Normal;
  759. surfaceData.clearCoatMask = 0;
  760. surfaceData.clearCoatSmoothness = 1;
  761. #ifdef _CLEARCOAT
  762. surfaceData.clearCoatMask = saturate(CoatMask);
  763. surfaceData.clearCoatSmoothness = saturate(CoatSmoothness);
  764. #endif
  765. #ifdef _DBUFFER
  766. ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
  767. #endif
  768. #ifdef _ASE_LIGHTING_SIMPLE
  769. half4 color = UniversalFragmentBlinnPhong( inputData, surfaceData);
  770. #else
  771. half4 color = UniversalFragmentPBR( inputData, surfaceData);
  772. #endif
  773. #ifdef ASE_TRANSMISSION
  774. {
  775. float shadow = _TransmissionShadow;
  776. #define SUM_LIGHT_TRANSMISSION(Light)\
  777. float3 atten = Light.color * Light.distanceAttenuation;\
  778. atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\
  779. half3 transmission = max( 0, -dot( inputData.normalWS, Light.direction ) ) * atten * Transmission;\
  780. color.rgb += BaseColor * transmission;
  781. SUM_LIGHT_TRANSMISSION( GetMainLight( inputData.shadowCoord ) );
  782. #if defined(_ADDITIONAL_LIGHTS)
  783. uint meshRenderingLayers = GetMeshRenderingLayer();
  784. uint pixelLightCount = GetAdditionalLightsCount();
  785. #if USE_FORWARD_PLUS
  786. [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
  787. {
  788. FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
  789. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  790. #ifdef _LIGHT_LAYERS
  791. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  792. #endif
  793. {
  794. SUM_LIGHT_TRANSMISSION( light );
  795. }
  796. }
  797. #endif
  798. LIGHT_LOOP_BEGIN( pixelLightCount )
  799. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  800. #ifdef _LIGHT_LAYERS
  801. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  802. #endif
  803. {
  804. SUM_LIGHT_TRANSMISSION( light );
  805. }
  806. LIGHT_LOOP_END
  807. #endif
  808. }
  809. #endif
  810. #ifdef ASE_TRANSLUCENCY
  811. {
  812. float shadow = _TransShadow;
  813. float normal = _TransNormal;
  814. float scattering = _TransScattering;
  815. float direct = _TransDirect;
  816. float ambient = _TransAmbient;
  817. float strength = _TransStrength;
  818. #define SUM_LIGHT_TRANSLUCENCY(Light)\
  819. float3 atten = Light.color * Light.distanceAttenuation;\
  820. atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\
  821. half3 lightDir = Light.direction + inputData.normalWS * normal;\
  822. half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );\
  823. half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;\
  824. color.rgb += BaseColor * translucency * strength;
  825. SUM_LIGHT_TRANSLUCENCY( GetMainLight( inputData.shadowCoord ) );
  826. #if defined(_ADDITIONAL_LIGHTS)
  827. uint meshRenderingLayers = GetMeshRenderingLayer();
  828. uint pixelLightCount = GetAdditionalLightsCount();
  829. #if USE_FORWARD_PLUS
  830. [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
  831. {
  832. FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
  833. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  834. #ifdef _LIGHT_LAYERS
  835. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  836. #endif
  837. {
  838. SUM_LIGHT_TRANSLUCENCY( light );
  839. }
  840. }
  841. #endif
  842. LIGHT_LOOP_BEGIN( pixelLightCount )
  843. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  844. #ifdef _LIGHT_LAYERS
  845. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  846. #endif
  847. {
  848. SUM_LIGHT_TRANSLUCENCY( light );
  849. }
  850. LIGHT_LOOP_END
  851. #endif
  852. }
  853. #endif
  854. #ifdef ASE_REFRACTION
  855. float4 projScreenPos = ScreenPos / ScreenPos.w;
  856. float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) );
  857. projScreenPos.xy += refractionOffset.xy;
  858. float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor;
  859. color.rgb = lerp( refraction, color.rgb, color.a );
  860. color.a = 1;
  861. #endif
  862. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  863. color.rgb *= color.a;
  864. #endif
  865. #ifdef ASE_FOG
  866. #ifdef TERRAIN_SPLAT_ADDPASS
  867. color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), input.fogFactorAndVertexLight.x );
  868. #else
  869. color.rgb = MixFog(color.rgb, input.fogFactorAndVertexLight.x);
  870. #endif
  871. #endif
  872. #ifdef ASE_DEPTH_WRITE_ON
  873. outputDepth = DepthValue;
  874. #endif
  875. #ifdef _WRITE_RENDERING_LAYERS
  876. uint renderingLayers = GetMeshRenderingLayer();
  877. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  878. #endif
  879. return color;
  880. }
  881. ENDHLSL
  882. }
  883. Pass
  884. {
  885. Name "ShadowCaster"
  886. Tags { "LightMode"="ShadowCaster" }
  887. ZWrite On
  888. ZTest LEqual
  889. AlphaToMask Off
  890. ColorMask 0
  891. HLSLPROGRAM
  892. #pragma multi_compile_local_fragment _ALPHATEST_ON
  893. #define _NORMAL_DROPOFF_TS 1
  894. #pragma multi_compile_instancing
  895. #pragma multi_compile _ LOD_FADE_CROSSFADE
  896. #define ASE_FOG 1
  897. #define _NORMALMAP 1
  898. #define ASE_VERSION 19701
  899. #define ASE_SRP_VERSION 170003
  900. #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
  901. #pragma vertex vert
  902. #pragma fragment frag
  903. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  904. #define _SPECULAR_COLOR 1
  905. #endif
  906. #define SHADERPASS SHADERPASS_SHADOWCASTER
  907. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  908. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  909. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  910. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  911. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  912. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  913. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  914. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  915. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  916. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  917. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  918. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  919. #if defined(LOD_FADE_CROSSFADE)
  920. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  921. #endif
  922. #define ASE_NEEDS_VERT_NORMAL
  923. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  924. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  925. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  926. #define ASE_SV_DEPTH SV_DepthLessEqual
  927. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  928. #else
  929. #define ASE_SV_DEPTH SV_Depth
  930. #define ASE_SV_POSITION_QUALIFIERS
  931. #endif
  932. struct Attributes
  933. {
  934. float4 positionOS : POSITION;
  935. float3 normalOS : NORMAL;
  936. float4 ase_tangent : TANGENT;
  937. UNITY_VERTEX_INPUT_INSTANCE_ID
  938. };
  939. struct PackedVaryings
  940. {
  941. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  942. float4 clipPosV : TEXCOORD0;
  943. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  944. float3 positionWS : TEXCOORD1;
  945. #endif
  946. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  947. float4 shadowCoord : TEXCOORD2;
  948. #endif
  949. UNITY_VERTEX_INPUT_INSTANCE_ID
  950. UNITY_VERTEX_OUTPUT_STEREO
  951. };
  952. CBUFFER_START(UnityPerMaterial)
  953. float4 _Healthycolor1;
  954. float4 _Drycolor1;
  955. float2 _TilingCoverage;
  956. float2 _TilingDetail;
  957. float2 _Offset;
  958. float2 _Tiling;
  959. float2 _OffsetDetail;
  960. float _DisplacementAmount;
  961. float _Float6;
  962. float _Float4;
  963. float _NormalBlur;
  964. float _DetailNormalIntensity;
  965. float _NormalIntensity;
  966. float _DryColorOffset;
  967. float _SlopeMin;
  968. float _DryColorScale;
  969. float _CoverageAmount;
  970. float _MossColor;
  971. float _Float5;
  972. float _TSSlopeMax;
  973. float _TSSlopeMin;
  974. float _SlopeMax;
  975. float _CoverageFalloff;
  976. float _Float7;
  977. #ifdef ASE_TRANSMISSION
  978. float _TransmissionShadow;
  979. #endif
  980. #ifdef ASE_TRANSLUCENCY
  981. float _TransStrength;
  982. float _TransNormal;
  983. float _TransScattering;
  984. float _TransDirect;
  985. float _TransAmbient;
  986. float _TransShadow;
  987. #endif
  988. #ifdef ASE_TESSELLATION
  989. float _TessPhongStrength;
  990. float _TessValue;
  991. float _TessMin;
  992. float _TessMax;
  993. float _TessEdgeLength;
  994. float _TessMaxDisp;
  995. #endif
  996. CBUFFER_END
  997. #ifdef SCENEPICKINGPASS
  998. float4 _SelectionID;
  999. #endif
  1000. #ifdef SCENESELECTIONPASS
  1001. int _ObjectId;
  1002. int _PassValue;
  1003. #endif
  1004. sampler2D _CoverageHeight;
  1005. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  1006. {
  1007. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  1008. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  1009. float3 nsign = sign( worldNormal );
  1010. half4 xNorm; half4 yNorm; half4 zNorm;
  1011. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  1012. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  1013. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  1014. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  1015. }
  1016. float3 _LightDirection;
  1017. float3 _LightPosition;
  1018. PackedVaryings VertexFunction( Attributes input )
  1019. {
  1020. PackedVaryings output;
  1021. UNITY_SETUP_INSTANCE_ID(input);
  1022. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1023. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
  1024. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1025. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  1026. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  1027. float4 TriplanarHeight355 = triplanar339;
  1028. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  1029. float3 _Tangent = float3(0,1,0);
  1030. float3 ase_worldTangent = TransformObjectToWorldDir(input.ase_tangent.xyz);
  1031. float ase_vertexTangentSign = input.ase_tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  1032. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  1033. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  1034. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  1035. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  1036. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  1037. float3 temp_output_371_0 = abs( ase_worldNormal );
  1038. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  1039. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  1040. float staticSwitch382 = saturate( lerpResult273 );
  1041. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  1042. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1043. #else
  1044. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1045. #endif
  1046. float Slope275 = staticSwitch382;
  1047. #ifdef _EDGESLOPETESSELLATION_ON
  1048. float staticSwitch365 = Slope275;
  1049. #else
  1050. float staticSwitch365 = 1.0;
  1051. #endif
  1052. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1053. float3 defaultVertexValue = input.positionOS.xyz;
  1054. #else
  1055. float3 defaultVertexValue = float3(0, 0, 0);
  1056. #endif
  1057. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  1058. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1059. input.positionOS.xyz = vertexValue;
  1060. #else
  1061. input.positionOS.xyz += vertexValue;
  1062. #endif
  1063. input.normalOS = input.normalOS;
  1064. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  1065. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1066. output.positionWS = positionWS;
  1067. #endif
  1068. float3 normalWS = TransformObjectToWorldDir(input.normalOS);
  1069. #if _CASTING_PUNCTUAL_LIGHT_SHADOW
  1070. float3 lightDirectionWS = normalize(_LightPosition - positionWS);
  1071. #else
  1072. float3 lightDirectionWS = _LightDirection;
  1073. #endif
  1074. float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
  1075. //code for UNITY_REVERSED_Z is moved into Shadows.hlsl from 6000.0.22 and or higher
  1076. positionCS = ApplyShadowClamping(positionCS);
  1077. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1078. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1079. vertexInput.positionWS = positionWS;
  1080. vertexInput.positionCS = positionCS;
  1081. output.shadowCoord = GetShadowCoord( vertexInput );
  1082. #endif
  1083. output.positionCS = positionCS;
  1084. output.clipPosV = positionCS;
  1085. return output;
  1086. }
  1087. #if defined(ASE_TESSELLATION)
  1088. struct VertexControl
  1089. {
  1090. float4 vertex : INTERNALTESSPOS;
  1091. float3 normalOS : NORMAL;
  1092. float4 ase_tangent : TANGENT;
  1093. UNITY_VERTEX_INPUT_INSTANCE_ID
  1094. };
  1095. struct TessellationFactors
  1096. {
  1097. float edge[3] : SV_TessFactor;
  1098. float inside : SV_InsideTessFactor;
  1099. };
  1100. VertexControl vert ( Attributes input )
  1101. {
  1102. VertexControl output;
  1103. UNITY_SETUP_INSTANCE_ID(input);
  1104. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1105. output.vertex = input.positionOS;
  1106. output.normalOS = input.normalOS;
  1107. output.ase_tangent = input.ase_tangent;
  1108. return output;
  1109. }
  1110. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1111. {
  1112. TessellationFactors output;
  1113. float4 tf = 1;
  1114. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1115. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1116. #if defined(ASE_FIXED_TESSELLATION)
  1117. tf = FixedTess( tessValue );
  1118. #elif defined(ASE_DISTANCE_TESSELLATION)
  1119. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1120. #elif defined(ASE_LENGTH_TESSELLATION)
  1121. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1122. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1123. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1124. #endif
  1125. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1126. return output;
  1127. }
  1128. [domain("tri")]
  1129. [partitioning("fractional_odd")]
  1130. [outputtopology("triangle_cw")]
  1131. [patchconstantfunc("TessellationFunction")]
  1132. [outputcontrolpoints(3)]
  1133. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1134. {
  1135. return patch[id];
  1136. }
  1137. [domain("tri")]
  1138. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1139. {
  1140. Attributes output = (Attributes) 0;
  1141. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1142. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1143. output.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  1144. #if defined(ASE_PHONG_TESSELLATION)
  1145. float3 pp[3];
  1146. for (int i = 0; i < 3; ++i)
  1147. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1148. float phongStrength = _TessPhongStrength;
  1149. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1150. #endif
  1151. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1152. return VertexFunction(output);
  1153. }
  1154. #else
  1155. PackedVaryings vert ( Attributes input )
  1156. {
  1157. return VertexFunction( input );
  1158. }
  1159. #endif
  1160. half4 frag( PackedVaryings input
  1161. #ifdef ASE_DEPTH_WRITE_ON
  1162. ,out float outputDepth : ASE_SV_DEPTH
  1163. #endif
  1164. ) : SV_TARGET
  1165. {
  1166. UNITY_SETUP_INSTANCE_ID( input );
  1167. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1168. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1169. float3 WorldPosition = input.positionWS;
  1170. #endif
  1171. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1172. float4 ClipPos = input.clipPosV;
  1173. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  1174. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1175. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1176. ShadowCoords = input.shadowCoord;
  1177. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1178. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1179. #endif
  1180. #endif
  1181. float Alpha = 1;
  1182. float AlphaClipThreshold = 0.5;
  1183. float AlphaClipThresholdShadow = 0.5;
  1184. #ifdef ASE_DEPTH_WRITE_ON
  1185. float DepthValue = input.positionCS.z;
  1186. #endif
  1187. #ifdef _ALPHATEST_ON
  1188. #ifdef _ALPHATEST_SHADOW_ON
  1189. clip(Alpha - AlphaClipThresholdShadow);
  1190. #else
  1191. clip(Alpha - AlphaClipThreshold);
  1192. #endif
  1193. #endif
  1194. #if defined(LOD_FADE_CROSSFADE)
  1195. LODFadeCrossFade( input.positionCS );
  1196. #endif
  1197. #ifdef ASE_DEPTH_WRITE_ON
  1198. outputDepth = DepthValue;
  1199. #endif
  1200. return 0;
  1201. }
  1202. ENDHLSL
  1203. }
  1204. Pass
  1205. {
  1206. Name "DepthOnly"
  1207. Tags { "LightMode"="DepthOnly" }
  1208. ZWrite On
  1209. ColorMask 0
  1210. AlphaToMask Off
  1211. HLSLPROGRAM
  1212. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1213. #define _NORMAL_DROPOFF_TS 1
  1214. #pragma multi_compile_instancing
  1215. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1216. #define ASE_FOG 1
  1217. #define _NORMALMAP 1
  1218. #define ASE_VERSION 19701
  1219. #define ASE_SRP_VERSION 170003
  1220. #pragma vertex vert
  1221. #pragma fragment frag
  1222. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1223. #define _SPECULAR_COLOR 1
  1224. #endif
  1225. #define SHADERPASS SHADERPASS_DEPTHONLY
  1226. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  1227. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1228. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1229. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1230. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1231. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1232. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1233. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1234. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1235. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1236. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1237. #if defined(LOD_FADE_CROSSFADE)
  1238. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  1239. #endif
  1240. #define ASE_NEEDS_VERT_NORMAL
  1241. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  1242. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  1243. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  1244. #define ASE_SV_DEPTH SV_DepthLessEqual
  1245. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  1246. #else
  1247. #define ASE_SV_DEPTH SV_Depth
  1248. #define ASE_SV_POSITION_QUALIFIERS
  1249. #endif
  1250. struct Attributes
  1251. {
  1252. float4 positionOS : POSITION;
  1253. float3 normalOS : NORMAL;
  1254. float4 ase_tangent : TANGENT;
  1255. UNITY_VERTEX_INPUT_INSTANCE_ID
  1256. };
  1257. struct PackedVaryings
  1258. {
  1259. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  1260. float4 clipPosV : TEXCOORD0;
  1261. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1262. float3 positionWS : TEXCOORD1;
  1263. #endif
  1264. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1265. float4 shadowCoord : TEXCOORD2;
  1266. #endif
  1267. UNITY_VERTEX_INPUT_INSTANCE_ID
  1268. UNITY_VERTEX_OUTPUT_STEREO
  1269. };
  1270. CBUFFER_START(UnityPerMaterial)
  1271. float4 _Healthycolor1;
  1272. float4 _Drycolor1;
  1273. float2 _TilingCoverage;
  1274. float2 _TilingDetail;
  1275. float2 _Offset;
  1276. float2 _Tiling;
  1277. float2 _OffsetDetail;
  1278. float _DisplacementAmount;
  1279. float _Float6;
  1280. float _Float4;
  1281. float _NormalBlur;
  1282. float _DetailNormalIntensity;
  1283. float _NormalIntensity;
  1284. float _DryColorOffset;
  1285. float _SlopeMin;
  1286. float _DryColorScale;
  1287. float _CoverageAmount;
  1288. float _MossColor;
  1289. float _Float5;
  1290. float _TSSlopeMax;
  1291. float _TSSlopeMin;
  1292. float _SlopeMax;
  1293. float _CoverageFalloff;
  1294. float _Float7;
  1295. #ifdef ASE_TRANSMISSION
  1296. float _TransmissionShadow;
  1297. #endif
  1298. #ifdef ASE_TRANSLUCENCY
  1299. float _TransStrength;
  1300. float _TransNormal;
  1301. float _TransScattering;
  1302. float _TransDirect;
  1303. float _TransAmbient;
  1304. float _TransShadow;
  1305. #endif
  1306. #ifdef ASE_TESSELLATION
  1307. float _TessPhongStrength;
  1308. float _TessValue;
  1309. float _TessMin;
  1310. float _TessMax;
  1311. float _TessEdgeLength;
  1312. float _TessMaxDisp;
  1313. #endif
  1314. CBUFFER_END
  1315. #ifdef SCENEPICKINGPASS
  1316. float4 _SelectionID;
  1317. #endif
  1318. #ifdef SCENESELECTIONPASS
  1319. int _ObjectId;
  1320. int _PassValue;
  1321. #endif
  1322. sampler2D _CoverageHeight;
  1323. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  1324. {
  1325. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  1326. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  1327. float3 nsign = sign( worldNormal );
  1328. half4 xNorm; half4 yNorm; half4 zNorm;
  1329. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  1330. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  1331. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  1332. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  1333. }
  1334. PackedVaryings VertexFunction( Attributes input )
  1335. {
  1336. PackedVaryings output = (PackedVaryings)0;
  1337. UNITY_SETUP_INSTANCE_ID(input);
  1338. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1339. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1340. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1341. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  1342. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  1343. float4 TriplanarHeight355 = triplanar339;
  1344. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  1345. float3 _Tangent = float3(0,1,0);
  1346. float3 ase_worldTangent = TransformObjectToWorldDir(input.ase_tangent.xyz);
  1347. float ase_vertexTangentSign = input.ase_tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  1348. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  1349. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  1350. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  1351. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  1352. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  1353. float3 temp_output_371_0 = abs( ase_worldNormal );
  1354. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  1355. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  1356. float staticSwitch382 = saturate( lerpResult273 );
  1357. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  1358. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1359. #else
  1360. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1361. #endif
  1362. float Slope275 = staticSwitch382;
  1363. #ifdef _EDGESLOPETESSELLATION_ON
  1364. float staticSwitch365 = Slope275;
  1365. #else
  1366. float staticSwitch365 = 1.0;
  1367. #endif
  1368. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1369. float3 defaultVertexValue = input.positionOS.xyz;
  1370. #else
  1371. float3 defaultVertexValue = float3(0, 0, 0);
  1372. #endif
  1373. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  1374. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1375. input.positionOS.xyz = vertexValue;
  1376. #else
  1377. input.positionOS.xyz += vertexValue;
  1378. #endif
  1379. input.normalOS = input.normalOS;
  1380. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1381. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1382. output.positionWS = vertexInput.positionWS;
  1383. #endif
  1384. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1385. output.shadowCoord = GetShadowCoord( vertexInput );
  1386. #endif
  1387. output.positionCS = vertexInput.positionCS;
  1388. output.clipPosV = vertexInput.positionCS;
  1389. return output;
  1390. }
  1391. #if defined(ASE_TESSELLATION)
  1392. struct VertexControl
  1393. {
  1394. float4 vertex : INTERNALTESSPOS;
  1395. float3 normalOS : NORMAL;
  1396. float4 ase_tangent : TANGENT;
  1397. UNITY_VERTEX_INPUT_INSTANCE_ID
  1398. };
  1399. struct TessellationFactors
  1400. {
  1401. float edge[3] : SV_TessFactor;
  1402. float inside : SV_InsideTessFactor;
  1403. };
  1404. VertexControl vert ( Attributes input )
  1405. {
  1406. VertexControl output;
  1407. UNITY_SETUP_INSTANCE_ID(input);
  1408. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1409. output.vertex = input.positionOS;
  1410. output.normalOS = input.normalOS;
  1411. output.ase_tangent = input.ase_tangent;
  1412. return output;
  1413. }
  1414. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1415. {
  1416. TessellationFactors output;
  1417. float4 tf = 1;
  1418. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1419. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1420. #if defined(ASE_FIXED_TESSELLATION)
  1421. tf = FixedTess( tessValue );
  1422. #elif defined(ASE_DISTANCE_TESSELLATION)
  1423. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1424. #elif defined(ASE_LENGTH_TESSELLATION)
  1425. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1426. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1427. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1428. #endif
  1429. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1430. return output;
  1431. }
  1432. [domain("tri")]
  1433. [partitioning("fractional_odd")]
  1434. [outputtopology("triangle_cw")]
  1435. [patchconstantfunc("TessellationFunction")]
  1436. [outputcontrolpoints(3)]
  1437. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1438. {
  1439. return patch[id];
  1440. }
  1441. [domain("tri")]
  1442. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1443. {
  1444. Attributes output = (Attributes) 0;
  1445. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1446. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1447. output.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  1448. #if defined(ASE_PHONG_TESSELLATION)
  1449. float3 pp[3];
  1450. for (int i = 0; i < 3; ++i)
  1451. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1452. float phongStrength = _TessPhongStrength;
  1453. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1454. #endif
  1455. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1456. return VertexFunction(output);
  1457. }
  1458. #else
  1459. PackedVaryings vert ( Attributes input )
  1460. {
  1461. return VertexFunction( input );
  1462. }
  1463. #endif
  1464. half4 frag( PackedVaryings input
  1465. #ifdef ASE_DEPTH_WRITE_ON
  1466. ,out float outputDepth : ASE_SV_DEPTH
  1467. #endif
  1468. ) : SV_TARGET
  1469. {
  1470. UNITY_SETUP_INSTANCE_ID(input);
  1471. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1472. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1473. float3 WorldPosition = input.positionWS;
  1474. #endif
  1475. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1476. float4 ClipPos = input.clipPosV;
  1477. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  1478. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1479. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1480. ShadowCoords = input.shadowCoord;
  1481. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1482. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1483. #endif
  1484. #endif
  1485. float Alpha = 1;
  1486. float AlphaClipThreshold = 0.5;
  1487. #ifdef ASE_DEPTH_WRITE_ON
  1488. float DepthValue = input.positionCS.z;
  1489. #endif
  1490. #ifdef _ALPHATEST_ON
  1491. clip(Alpha - AlphaClipThreshold);
  1492. #endif
  1493. #if defined(LOD_FADE_CROSSFADE)
  1494. LODFadeCrossFade( input.positionCS );
  1495. #endif
  1496. #ifdef ASE_DEPTH_WRITE_ON
  1497. outputDepth = DepthValue;
  1498. #endif
  1499. return 0;
  1500. }
  1501. ENDHLSL
  1502. }
  1503. Pass
  1504. {
  1505. Name "Meta"
  1506. Tags { "LightMode"="Meta" }
  1507. Cull Off
  1508. HLSLPROGRAM
  1509. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1510. #define _NORMAL_DROPOFF_TS 1
  1511. #define ASE_FOG 1
  1512. #define _NORMALMAP 1
  1513. #define ASE_VERSION 19701
  1514. #define ASE_SRP_VERSION 170003
  1515. #ifdef UNITY_COLORSPACE_GAMMA//ASE Color Space Def
  1516. #define unity_ColorSpaceDouble half4(2.0, 2.0, 2.0, 2.0)//ASE Color Space Def
  1517. #else // Linear values//ASE Color Space Def
  1518. #define unity_ColorSpaceDouble half4(4.59479380, 4.59479380, 4.59479380, 2.0)//ASE Color Space Def
  1519. #endif//ASE Color Space Def
  1520. #pragma shader_feature EDITOR_VISUALIZATION
  1521. #pragma vertex vert
  1522. #pragma fragment frag
  1523. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1524. #define _SPECULAR_COLOR 1
  1525. #endif
  1526. #define SHADERPASS SHADERPASS_META
  1527. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1528. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1529. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1530. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1531. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1532. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1533. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1534. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1535. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1536. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1537. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
  1538. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1539. #define ASE_NEEDS_VERT_NORMAL
  1540. #define ASE_NEEDS_FRAG_WORLD_POSITION
  1541. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  1542. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  1543. #pragma shader_feature_local _EDGESLOPE_ON
  1544. struct Attributes
  1545. {
  1546. float4 positionOS : POSITION;
  1547. float3 normalOS : NORMAL;
  1548. float4 texcoord0 : TEXCOORD0;
  1549. float4 texcoord1 : TEXCOORD1;
  1550. float4 texcoord2 : TEXCOORD2;
  1551. float4 ase_tangent : TANGENT;
  1552. UNITY_VERTEX_INPUT_INSTANCE_ID
  1553. };
  1554. struct PackedVaryings
  1555. {
  1556. float4 positionCS : SV_POSITION;
  1557. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1558. float3 positionWS : TEXCOORD0;
  1559. #endif
  1560. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1561. float4 shadowCoord : TEXCOORD1;
  1562. #endif
  1563. #ifdef EDITOR_VISUALIZATION
  1564. float4 VizUV : TEXCOORD2;
  1565. float4 LightCoord : TEXCOORD3;
  1566. #endif
  1567. float4 ase_texcoord4 : TEXCOORD4;
  1568. float4 ase_texcoord5 : TEXCOORD5;
  1569. float4 ase_texcoord6 : TEXCOORD6;
  1570. float4 ase_texcoord7 : TEXCOORD7;
  1571. UNITY_VERTEX_INPUT_INSTANCE_ID
  1572. UNITY_VERTEX_OUTPUT_STEREO
  1573. };
  1574. CBUFFER_START(UnityPerMaterial)
  1575. float4 _Healthycolor1;
  1576. float4 _Drycolor1;
  1577. float2 _TilingCoverage;
  1578. float2 _TilingDetail;
  1579. float2 _Offset;
  1580. float2 _Tiling;
  1581. float2 _OffsetDetail;
  1582. float _DisplacementAmount;
  1583. float _Float6;
  1584. float _Float4;
  1585. float _NormalBlur;
  1586. float _DetailNormalIntensity;
  1587. float _NormalIntensity;
  1588. float _DryColorOffset;
  1589. float _SlopeMin;
  1590. float _DryColorScale;
  1591. float _CoverageAmount;
  1592. float _MossColor;
  1593. float _Float5;
  1594. float _TSSlopeMax;
  1595. float _TSSlopeMin;
  1596. float _SlopeMax;
  1597. float _CoverageFalloff;
  1598. float _Float7;
  1599. #ifdef ASE_TRANSMISSION
  1600. float _TransmissionShadow;
  1601. #endif
  1602. #ifdef ASE_TRANSLUCENCY
  1603. float _TransStrength;
  1604. float _TransNormal;
  1605. float _TransScattering;
  1606. float _TransDirect;
  1607. float _TransAmbient;
  1608. float _TransShadow;
  1609. #endif
  1610. #ifdef ASE_TESSELLATION
  1611. float _TessPhongStrength;
  1612. float _TessValue;
  1613. float _TessMin;
  1614. float _TessMax;
  1615. float _TessEdgeLength;
  1616. float _TessMaxDisp;
  1617. #endif
  1618. CBUFFER_END
  1619. #ifdef SCENEPICKINGPASS
  1620. float4 _SelectionID;
  1621. #endif
  1622. #ifdef SCENESELECTIONPASS
  1623. int _ObjectId;
  1624. int _PassValue;
  1625. #endif
  1626. sampler2D _CoverageHeight;
  1627. sampler2D _AlbedoMap;
  1628. sampler2D _DetailAlbedo;
  1629. sampler2D _DetailMask;
  1630. sampler2D _CoverageAlbedo;
  1631. sampler2D _NormalMap;
  1632. sampler2D _CoverageNormal;
  1633. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  1634. {
  1635. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  1636. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  1637. float3 nsign = sign( worldNormal );
  1638. half4 xNorm; half4 yNorm; half4 zNorm;
  1639. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  1640. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  1641. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  1642. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  1643. }
  1644. inline float4 TriplanarSampling157( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  1645. {
  1646. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  1647. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  1648. float3 nsign = sign( worldNormal );
  1649. half4 xNorm; half4 yNorm; half4 zNorm;
  1650. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  1651. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  1652. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  1653. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  1654. }
  1655. inline float3 TriplanarSampling151( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  1656. {
  1657. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  1658. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  1659. float3 nsign = sign( worldNormal );
  1660. half4 xNorm; half4 yNorm; half4 zNorm;
  1661. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  1662. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  1663. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  1664. xNorm.xyz = half3( UnpackNormalScale( xNorm , 1.0 ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;
  1665. yNorm.xyz = half3( UnpackNormalScale( yNorm , 1.0 ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;
  1666. zNorm.xyz = half3( UnpackNormalScale( zNorm , 1.0 ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;
  1667. return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );
  1668. }
  1669. PackedVaryings VertexFunction( Attributes input )
  1670. {
  1671. PackedVaryings output = (PackedVaryings)0;
  1672. UNITY_SETUP_INSTANCE_ID(input);
  1673. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1674. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1675. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1676. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  1677. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  1678. float4 TriplanarHeight355 = triplanar339;
  1679. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  1680. float3 _Tangent = float3(0,1,0);
  1681. float3 ase_worldTangent = TransformObjectToWorldDir(input.ase_tangent.xyz);
  1682. float ase_vertexTangentSign = input.ase_tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  1683. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  1684. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  1685. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  1686. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  1687. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  1688. float3 temp_output_371_0 = abs( ase_worldNormal );
  1689. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  1690. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  1691. float staticSwitch382 = saturate( lerpResult273 );
  1692. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  1693. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1694. #else
  1695. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1696. #endif
  1697. float Slope275 = staticSwitch382;
  1698. #ifdef _EDGESLOPETESSELLATION_ON
  1699. float staticSwitch365 = Slope275;
  1700. #else
  1701. float staticSwitch365 = 1.0;
  1702. #endif
  1703. output.ase_texcoord5.xyz = ase_worldNormal;
  1704. output.ase_texcoord6.xyz = ase_worldTangent;
  1705. output.ase_texcoord7.xyz = ase_worldBitangent;
  1706. output.ase_texcoord4.xy = input.texcoord0.xy;
  1707. //setting value to unused interpolator channels and avoid initialization warnings
  1708. output.ase_texcoord4.zw = 0;
  1709. output.ase_texcoord5.w = 0;
  1710. output.ase_texcoord6.w = 0;
  1711. output.ase_texcoord7.w = 0;
  1712. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1713. float3 defaultVertexValue = input.positionOS.xyz;
  1714. #else
  1715. float3 defaultVertexValue = float3(0, 0, 0);
  1716. #endif
  1717. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  1718. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1719. input.positionOS.xyz = vertexValue;
  1720. #else
  1721. input.positionOS.xyz += vertexValue;
  1722. #endif
  1723. input.normalOS = input.normalOS;
  1724. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  1725. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1726. output.positionWS = positionWS;
  1727. #endif
  1728. output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST );
  1729. #ifdef EDITOR_VISUALIZATION
  1730. float2 VizUV = 0;
  1731. float4 LightCoord = 0;
  1732. UnityEditorVizData(input.positionOS.xyz, input.texcoord0.xy, input.texcoord1.xy, input.texcoord2.xy, VizUV, LightCoord);
  1733. output.VizUV = float4(VizUV, 0, 0);
  1734. output.LightCoord = LightCoord;
  1735. #endif
  1736. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1737. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1738. vertexInput.positionWS = positionWS;
  1739. vertexInput.positionCS = output.positionCS;
  1740. output.shadowCoord = GetShadowCoord( vertexInput );
  1741. #endif
  1742. return output;
  1743. }
  1744. #if defined(ASE_TESSELLATION)
  1745. struct VertexControl
  1746. {
  1747. float4 vertex : INTERNALTESSPOS;
  1748. float3 normalOS : NORMAL;
  1749. float4 texcoord0 : TEXCOORD0;
  1750. float4 texcoord1 : TEXCOORD1;
  1751. float4 texcoord2 : TEXCOORD2;
  1752. float4 ase_tangent : TANGENT;
  1753. UNITY_VERTEX_INPUT_INSTANCE_ID
  1754. };
  1755. struct TessellationFactors
  1756. {
  1757. float edge[3] : SV_TessFactor;
  1758. float inside : SV_InsideTessFactor;
  1759. };
  1760. VertexControl vert ( Attributes input )
  1761. {
  1762. VertexControl output;
  1763. UNITY_SETUP_INSTANCE_ID(input);
  1764. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1765. output.vertex = input.positionOS;
  1766. output.normalOS = input.normalOS;
  1767. output.texcoord0 = input.texcoord0;
  1768. output.texcoord1 = input.texcoord1;
  1769. output.texcoord2 = input.texcoord2;
  1770. output.ase_tangent = input.ase_tangent;
  1771. return output;
  1772. }
  1773. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1774. {
  1775. TessellationFactors output;
  1776. float4 tf = 1;
  1777. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1778. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1779. #if defined(ASE_FIXED_TESSELLATION)
  1780. tf = FixedTess( tessValue );
  1781. #elif defined(ASE_DISTANCE_TESSELLATION)
  1782. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1783. #elif defined(ASE_LENGTH_TESSELLATION)
  1784. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1785. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1786. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1787. #endif
  1788. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1789. return output;
  1790. }
  1791. [domain("tri")]
  1792. [partitioning("fractional_odd")]
  1793. [outputtopology("triangle_cw")]
  1794. [patchconstantfunc("TessellationFunction")]
  1795. [outputcontrolpoints(3)]
  1796. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1797. {
  1798. return patch[id];
  1799. }
  1800. [domain("tri")]
  1801. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1802. {
  1803. Attributes output = (Attributes) 0;
  1804. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1805. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1806. output.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z;
  1807. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  1808. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  1809. output.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  1810. #if defined(ASE_PHONG_TESSELLATION)
  1811. float3 pp[3];
  1812. for (int i = 0; i < 3; ++i)
  1813. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1814. float phongStrength = _TessPhongStrength;
  1815. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1816. #endif
  1817. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1818. return VertexFunction(output);
  1819. }
  1820. #else
  1821. PackedVaryings vert ( Attributes input )
  1822. {
  1823. return VertexFunction( input );
  1824. }
  1825. #endif
  1826. half4 frag(PackedVaryings input ) : SV_TARGET
  1827. {
  1828. UNITY_SETUP_INSTANCE_ID(input);
  1829. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1830. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1831. float3 WorldPosition = input.positionWS;
  1832. #endif
  1833. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1834. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1835. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1836. ShadowCoords = input.shadowCoord;
  1837. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1838. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1839. #endif
  1840. #endif
  1841. float2 texCoord147 = input.ase_texcoord4.xy * _Tiling + _Offset;
  1842. float2 TileUVs232 = texCoord147;
  1843. float4 AlbedoMapMain250 = tex2D( _AlbedoMap, TileUVs232 );
  1844. float2 texCoord110 = input.ase_texcoord4.xy * _TilingDetail + _OffsetDetail;
  1845. float2 TileUVs2231 = texCoord110;
  1846. float2 uv_DetailMask221 = input.ase_texcoord4.xy;
  1847. float4 tex2DNode221 = tex2D( _DetailMask, uv_DetailMask221 );
  1848. float4 DetailAlbedoMap251 = ( AlbedoMapMain250 * ( ( ( tex2D( _DetailAlbedo, TileUVs2231 ) * unity_ColorSpaceDouble ) * tex2DNode221.a ) + ( 1.0 - tex2DNode221.a ) ) );
  1849. float3 ase_worldNormal = input.ase_texcoord5.xyz;
  1850. float4 triplanar157 = TriplanarSampling157( _CoverageAlbedo, WorldPosition, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  1851. float4 TriplanarAlbedo258 = triplanar157;
  1852. float4 lerpResult324 = lerp( ( TriplanarAlbedo258 * _Drycolor1 ) , ( ( TriplanarAlbedo258 * _Healthycolor1 ) * unity_ColorSpaceDouble ) , saturate( (ase_worldNormal.y*_DryColorScale + _DryColorOffset) ));
  1853. float4 TriplanarMossColor_Output327 = lerpResult324;
  1854. float3 unpack150 = UnpackNormalScale( tex2D( _NormalMap, TileUVs232 ), _NormalIntensity );
  1855. unpack150.z = lerp( 1, unpack150.z, saturate(_NormalIntensity) );
  1856. float3 NormalMapMain249 = unpack150;
  1857. float3 ase_worldTangent = input.ase_texcoord6.xyz;
  1858. float3 ase_worldBitangent = input.ase_texcoord7.xyz;
  1859. float3x3 ase_worldToTangent = float3x3(ase_worldTangent,ase_worldBitangent,ase_worldNormal);
  1860. float3 triplanar151 = TriplanarSampling151( _CoverageNormal, WorldPosition, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  1861. float3 tanTriplanarNormal151 = mul( ase_worldToTangent, triplanar151 );
  1862. float3 TriplanarNormal259 = tanTriplanarNormal151;
  1863. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  1864. float3 lerpResult152 = lerp( NormalMapMain249 , TriplanarNormal259 , temp_output_149_0);
  1865. float3 tanToWorld0 = float3( ase_worldTangent.x, ase_worldBitangent.x, ase_worldNormal.x );
  1866. float3 tanToWorld1 = float3( ase_worldTangent.y, ase_worldBitangent.y, ase_worldNormal.y );
  1867. float3 tanToWorld2 = float3( ase_worldTangent.z, ase_worldBitangent.z, ase_worldNormal.z );
  1868. float3 tanNormal154 = lerpResult152;
  1869. float3 worldNormal154 = float3(dot(tanToWorld0,tanNormal154), dot(tanToWorld1,tanNormal154), dot(tanToWorld2,tanNormal154));
  1870. float temp_output_174_0 = saturate( ( worldNormal154.y * _CoverageAmount ) );
  1871. float3 _Tangent = float3(0,1,0);
  1872. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  1873. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  1874. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  1875. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  1876. float3 temp_output_371_0 = abs( ase_worldNormal );
  1877. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  1878. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  1879. float staticSwitch382 = saturate( lerpResult273 );
  1880. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  1881. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1882. #else
  1883. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  1884. #endif
  1885. float Slope275 = staticSwitch382;
  1886. #ifdef _EDGESLOPE_ON
  1887. float staticSwitch276 = ( temp_output_174_0 * Slope275 );
  1888. #else
  1889. float staticSwitch276 = temp_output_174_0;
  1890. #endif
  1891. float4 lerpResult182 = lerp( DetailAlbedoMap251 , (( _MossColor )?( TriplanarMossColor_Output327 ):( TriplanarAlbedo258 )) , staticSwitch276);
  1892. float3 BaseColor = lerpResult182.xyz;
  1893. float3 Emission = 0;
  1894. float Alpha = 1;
  1895. float AlphaClipThreshold = 0.5;
  1896. #ifdef _ALPHATEST_ON
  1897. clip(Alpha - AlphaClipThreshold);
  1898. #endif
  1899. MetaInput metaInput = (MetaInput)0;
  1900. metaInput.Albedo = BaseColor;
  1901. metaInput.Emission = Emission;
  1902. #ifdef EDITOR_VISUALIZATION
  1903. metaInput.VizUV = input.VizUV.xy;
  1904. metaInput.LightCoord = input.LightCoord;
  1905. #endif
  1906. return UnityMetaFragment(metaInput);
  1907. }
  1908. ENDHLSL
  1909. }
  1910. Pass
  1911. {
  1912. Name "Universal2D"
  1913. Tags { "LightMode"="Universal2D" }
  1914. Blend One Zero, One Zero
  1915. ZWrite On
  1916. ZTest LEqual
  1917. Offset 0 , 0
  1918. ColorMask RGBA
  1919. HLSLPROGRAM
  1920. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1921. #define _NORMAL_DROPOFF_TS 1
  1922. #define ASE_FOG 1
  1923. #define _NORMALMAP 1
  1924. #define ASE_VERSION 19701
  1925. #define ASE_SRP_VERSION 170003
  1926. #ifdef UNITY_COLORSPACE_GAMMA//ASE Color Space Def
  1927. #define unity_ColorSpaceDouble half4(2.0, 2.0, 2.0, 2.0)//ASE Color Space Def
  1928. #else // Linear values//ASE Color Space Def
  1929. #define unity_ColorSpaceDouble half4(4.59479380, 4.59479380, 4.59479380, 2.0)//ASE Color Space Def
  1930. #endif//ASE Color Space Def
  1931. #pragma vertex vert
  1932. #pragma fragment frag
  1933. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1934. #define _SPECULAR_COLOR 1
  1935. #endif
  1936. #define SHADERPASS SHADERPASS_2D
  1937. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1938. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1939. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1940. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1941. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1942. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1943. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1944. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1945. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1946. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1947. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1948. #define ASE_NEEDS_VERT_NORMAL
  1949. #define ASE_NEEDS_FRAG_WORLD_POSITION
  1950. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  1951. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  1952. #pragma shader_feature_local _EDGESLOPE_ON
  1953. struct Attributes
  1954. {
  1955. float4 positionOS : POSITION;
  1956. float3 normalOS : NORMAL;
  1957. float4 ase_tangent : TANGENT;
  1958. float4 ase_texcoord : TEXCOORD0;
  1959. UNITY_VERTEX_INPUT_INSTANCE_ID
  1960. };
  1961. struct PackedVaryings
  1962. {
  1963. float4 positionCS : SV_POSITION;
  1964. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1965. float3 positionWS : TEXCOORD0;
  1966. #endif
  1967. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1968. float4 shadowCoord : TEXCOORD1;
  1969. #endif
  1970. float4 ase_texcoord2 : TEXCOORD2;
  1971. float4 ase_texcoord3 : TEXCOORD3;
  1972. float4 ase_texcoord4 : TEXCOORD4;
  1973. float4 ase_texcoord5 : TEXCOORD5;
  1974. UNITY_VERTEX_INPUT_INSTANCE_ID
  1975. UNITY_VERTEX_OUTPUT_STEREO
  1976. };
  1977. CBUFFER_START(UnityPerMaterial)
  1978. float4 _Healthycolor1;
  1979. float4 _Drycolor1;
  1980. float2 _TilingCoverage;
  1981. float2 _TilingDetail;
  1982. float2 _Offset;
  1983. float2 _Tiling;
  1984. float2 _OffsetDetail;
  1985. float _DisplacementAmount;
  1986. float _Float6;
  1987. float _Float4;
  1988. float _NormalBlur;
  1989. float _DetailNormalIntensity;
  1990. float _NormalIntensity;
  1991. float _DryColorOffset;
  1992. float _SlopeMin;
  1993. float _DryColorScale;
  1994. float _CoverageAmount;
  1995. float _MossColor;
  1996. float _Float5;
  1997. float _TSSlopeMax;
  1998. float _TSSlopeMin;
  1999. float _SlopeMax;
  2000. float _CoverageFalloff;
  2001. float _Float7;
  2002. #ifdef ASE_TRANSMISSION
  2003. float _TransmissionShadow;
  2004. #endif
  2005. #ifdef ASE_TRANSLUCENCY
  2006. float _TransStrength;
  2007. float _TransNormal;
  2008. float _TransScattering;
  2009. float _TransDirect;
  2010. float _TransAmbient;
  2011. float _TransShadow;
  2012. #endif
  2013. #ifdef ASE_TESSELLATION
  2014. float _TessPhongStrength;
  2015. float _TessValue;
  2016. float _TessMin;
  2017. float _TessMax;
  2018. float _TessEdgeLength;
  2019. float _TessMaxDisp;
  2020. #endif
  2021. CBUFFER_END
  2022. #ifdef SCENEPICKINGPASS
  2023. float4 _SelectionID;
  2024. #endif
  2025. #ifdef SCENESELECTIONPASS
  2026. int _ObjectId;
  2027. int _PassValue;
  2028. #endif
  2029. sampler2D _CoverageHeight;
  2030. sampler2D _AlbedoMap;
  2031. sampler2D _DetailAlbedo;
  2032. sampler2D _DetailMask;
  2033. sampler2D _CoverageAlbedo;
  2034. sampler2D _NormalMap;
  2035. sampler2D _CoverageNormal;
  2036. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2037. {
  2038. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2039. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2040. float3 nsign = sign( worldNormal );
  2041. half4 xNorm; half4 yNorm; half4 zNorm;
  2042. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  2043. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  2044. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  2045. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  2046. }
  2047. inline float4 TriplanarSampling157( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2048. {
  2049. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2050. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2051. float3 nsign = sign( worldNormal );
  2052. half4 xNorm; half4 yNorm; half4 zNorm;
  2053. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  2054. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  2055. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  2056. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  2057. }
  2058. inline float3 TriplanarSampling151( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2059. {
  2060. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2061. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2062. float3 nsign = sign( worldNormal );
  2063. half4 xNorm; half4 yNorm; half4 zNorm;
  2064. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  2065. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  2066. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  2067. xNorm.xyz = half3( UnpackNormalScale( xNorm , 1.0 ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;
  2068. yNorm.xyz = half3( UnpackNormalScale( yNorm , 1.0 ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;
  2069. zNorm.xyz = half3( UnpackNormalScale( zNorm , 1.0 ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;
  2070. return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );
  2071. }
  2072. PackedVaryings VertexFunction( Attributes input )
  2073. {
  2074. PackedVaryings output = (PackedVaryings)0;
  2075. UNITY_SETUP_INSTANCE_ID( input );
  2076. UNITY_TRANSFER_INSTANCE_ID( input, output );
  2077. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
  2078. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  2079. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  2080. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  2081. float4 TriplanarHeight355 = triplanar339;
  2082. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  2083. float3 _Tangent = float3(0,1,0);
  2084. float3 ase_worldTangent = TransformObjectToWorldDir(input.ase_tangent.xyz);
  2085. float ase_vertexTangentSign = input.ase_tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  2086. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  2087. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  2088. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  2089. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  2090. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  2091. float3 temp_output_371_0 = abs( ase_worldNormal );
  2092. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  2093. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  2094. float staticSwitch382 = saturate( lerpResult273 );
  2095. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  2096. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2097. #else
  2098. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2099. #endif
  2100. float Slope275 = staticSwitch382;
  2101. #ifdef _EDGESLOPETESSELLATION_ON
  2102. float staticSwitch365 = Slope275;
  2103. #else
  2104. float staticSwitch365 = 1.0;
  2105. #endif
  2106. output.ase_texcoord3.xyz = ase_worldNormal;
  2107. output.ase_texcoord4.xyz = ase_worldTangent;
  2108. output.ase_texcoord5.xyz = ase_worldBitangent;
  2109. output.ase_texcoord2.xy = input.ase_texcoord.xy;
  2110. //setting value to unused interpolator channels and avoid initialization warnings
  2111. output.ase_texcoord2.zw = 0;
  2112. output.ase_texcoord3.w = 0;
  2113. output.ase_texcoord4.w = 0;
  2114. output.ase_texcoord5.w = 0;
  2115. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2116. float3 defaultVertexValue = input.positionOS.xyz;
  2117. #else
  2118. float3 defaultVertexValue = float3(0, 0, 0);
  2119. #endif
  2120. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  2121. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2122. input.positionOS.xyz = vertexValue;
  2123. #else
  2124. input.positionOS.xyz += vertexValue;
  2125. #endif
  2126. input.normalOS = input.normalOS;
  2127. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  2128. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  2129. output.positionWS = vertexInput.positionWS;
  2130. #endif
  2131. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  2132. output.shadowCoord = GetShadowCoord( vertexInput );
  2133. #endif
  2134. output.positionCS = vertexInput.positionCS;
  2135. return output;
  2136. }
  2137. #if defined(ASE_TESSELLATION)
  2138. struct VertexControl
  2139. {
  2140. float4 vertex : INTERNALTESSPOS;
  2141. float3 normalOS : NORMAL;
  2142. float4 ase_tangent : TANGENT;
  2143. float4 ase_texcoord : TEXCOORD0;
  2144. UNITY_VERTEX_INPUT_INSTANCE_ID
  2145. };
  2146. struct TessellationFactors
  2147. {
  2148. float edge[3] : SV_TessFactor;
  2149. float inside : SV_InsideTessFactor;
  2150. };
  2151. VertexControl vert ( Attributes input )
  2152. {
  2153. VertexControl output;
  2154. UNITY_SETUP_INSTANCE_ID(input);
  2155. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2156. output.vertex = input.positionOS;
  2157. output.normalOS = input.normalOS;
  2158. output.ase_tangent = input.ase_tangent;
  2159. output.ase_texcoord = input.ase_texcoord;
  2160. return output;
  2161. }
  2162. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2163. {
  2164. TessellationFactors output;
  2165. float4 tf = 1;
  2166. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2167. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2168. #if defined(ASE_FIXED_TESSELLATION)
  2169. tf = FixedTess( tessValue );
  2170. #elif defined(ASE_DISTANCE_TESSELLATION)
  2171. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2172. #elif defined(ASE_LENGTH_TESSELLATION)
  2173. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2174. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2175. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2176. #endif
  2177. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2178. return output;
  2179. }
  2180. [domain("tri")]
  2181. [partitioning("fractional_odd")]
  2182. [outputtopology("triangle_cw")]
  2183. [patchconstantfunc("TessellationFunction")]
  2184. [outputcontrolpoints(3)]
  2185. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2186. {
  2187. return patch[id];
  2188. }
  2189. [domain("tri")]
  2190. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2191. {
  2192. Attributes output = (Attributes) 0;
  2193. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2194. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2195. output.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  2196. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  2197. #if defined(ASE_PHONG_TESSELLATION)
  2198. float3 pp[3];
  2199. for (int i = 0; i < 3; ++i)
  2200. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2201. float phongStrength = _TessPhongStrength;
  2202. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2203. #endif
  2204. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2205. return VertexFunction(output);
  2206. }
  2207. #else
  2208. PackedVaryings vert ( Attributes input )
  2209. {
  2210. return VertexFunction( input );
  2211. }
  2212. #endif
  2213. half4 frag(PackedVaryings input ) : SV_TARGET
  2214. {
  2215. UNITY_SETUP_INSTANCE_ID( input );
  2216. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  2217. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  2218. float3 WorldPosition = input.positionWS;
  2219. #endif
  2220. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  2221. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  2222. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2223. ShadowCoords = input.shadowCoord;
  2224. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  2225. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  2226. #endif
  2227. #endif
  2228. float2 texCoord147 = input.ase_texcoord2.xy * _Tiling + _Offset;
  2229. float2 TileUVs232 = texCoord147;
  2230. float4 AlbedoMapMain250 = tex2D( _AlbedoMap, TileUVs232 );
  2231. float2 texCoord110 = input.ase_texcoord2.xy * _TilingDetail + _OffsetDetail;
  2232. float2 TileUVs2231 = texCoord110;
  2233. float2 uv_DetailMask221 = input.ase_texcoord2.xy;
  2234. float4 tex2DNode221 = tex2D( _DetailMask, uv_DetailMask221 );
  2235. float4 DetailAlbedoMap251 = ( AlbedoMapMain250 * ( ( ( tex2D( _DetailAlbedo, TileUVs2231 ) * unity_ColorSpaceDouble ) * tex2DNode221.a ) + ( 1.0 - tex2DNode221.a ) ) );
  2236. float3 ase_worldNormal = input.ase_texcoord3.xyz;
  2237. float4 triplanar157 = TriplanarSampling157( _CoverageAlbedo, WorldPosition, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  2238. float4 TriplanarAlbedo258 = triplanar157;
  2239. float4 lerpResult324 = lerp( ( TriplanarAlbedo258 * _Drycolor1 ) , ( ( TriplanarAlbedo258 * _Healthycolor1 ) * unity_ColorSpaceDouble ) , saturate( (ase_worldNormal.y*_DryColorScale + _DryColorOffset) ));
  2240. float4 TriplanarMossColor_Output327 = lerpResult324;
  2241. float3 unpack150 = UnpackNormalScale( tex2D( _NormalMap, TileUVs232 ), _NormalIntensity );
  2242. unpack150.z = lerp( 1, unpack150.z, saturate(_NormalIntensity) );
  2243. float3 NormalMapMain249 = unpack150;
  2244. float3 ase_worldTangent = input.ase_texcoord4.xyz;
  2245. float3 ase_worldBitangent = input.ase_texcoord5.xyz;
  2246. float3x3 ase_worldToTangent = float3x3(ase_worldTangent,ase_worldBitangent,ase_worldNormal);
  2247. float3 triplanar151 = TriplanarSampling151( _CoverageNormal, WorldPosition, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  2248. float3 tanTriplanarNormal151 = mul( ase_worldToTangent, triplanar151 );
  2249. float3 TriplanarNormal259 = tanTriplanarNormal151;
  2250. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  2251. float3 lerpResult152 = lerp( NormalMapMain249 , TriplanarNormal259 , temp_output_149_0);
  2252. float3 tanToWorld0 = float3( ase_worldTangent.x, ase_worldBitangent.x, ase_worldNormal.x );
  2253. float3 tanToWorld1 = float3( ase_worldTangent.y, ase_worldBitangent.y, ase_worldNormal.y );
  2254. float3 tanToWorld2 = float3( ase_worldTangent.z, ase_worldBitangent.z, ase_worldNormal.z );
  2255. float3 tanNormal154 = lerpResult152;
  2256. float3 worldNormal154 = float3(dot(tanToWorld0,tanNormal154), dot(tanToWorld1,tanNormal154), dot(tanToWorld2,tanNormal154));
  2257. float temp_output_174_0 = saturate( ( worldNormal154.y * _CoverageAmount ) );
  2258. float3 _Tangent = float3(0,1,0);
  2259. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  2260. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  2261. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  2262. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  2263. float3 temp_output_371_0 = abs( ase_worldNormal );
  2264. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  2265. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  2266. float staticSwitch382 = saturate( lerpResult273 );
  2267. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  2268. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2269. #else
  2270. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2271. #endif
  2272. float Slope275 = staticSwitch382;
  2273. #ifdef _EDGESLOPE_ON
  2274. float staticSwitch276 = ( temp_output_174_0 * Slope275 );
  2275. #else
  2276. float staticSwitch276 = temp_output_174_0;
  2277. #endif
  2278. float4 lerpResult182 = lerp( DetailAlbedoMap251 , (( _MossColor )?( TriplanarMossColor_Output327 ):( TriplanarAlbedo258 )) , staticSwitch276);
  2279. float3 BaseColor = lerpResult182.xyz;
  2280. float Alpha = 1;
  2281. float AlphaClipThreshold = 0.5;
  2282. half4 color = half4(BaseColor, Alpha );
  2283. #ifdef _ALPHATEST_ON
  2284. clip(Alpha - AlphaClipThreshold);
  2285. #endif
  2286. return color;
  2287. }
  2288. ENDHLSL
  2289. }
  2290. Pass
  2291. {
  2292. Name "DepthNormals"
  2293. Tags { "LightMode"="DepthNormals" }
  2294. ZWrite On
  2295. Blend One Zero
  2296. ZTest LEqual
  2297. ZWrite On
  2298. HLSLPROGRAM
  2299. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2300. #define _NORMAL_DROPOFF_TS 1
  2301. #pragma multi_compile_instancing
  2302. #pragma multi_compile _ LOD_FADE_CROSSFADE
  2303. #define ASE_FOG 1
  2304. #define _NORMALMAP 1
  2305. #define ASE_VERSION 19701
  2306. #define ASE_SRP_VERSION 170003
  2307. #pragma vertex vert
  2308. #pragma fragment frag
  2309. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2310. #define _SPECULAR_COLOR 1
  2311. #endif
  2312. #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
  2313. //#define SHADERPASS SHADERPASS_DEPTHNORMALS
  2314. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2315. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  2316. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2317. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2318. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2319. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2320. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2321. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2322. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2323. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2324. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2325. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2326. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2327. #if defined(LOD_FADE_CROSSFADE)
  2328. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  2329. #endif
  2330. #define ASE_NEEDS_VERT_NORMAL
  2331. #define ASE_NEEDS_VERT_TANGENT
  2332. #define ASE_NEEDS_FRAG_WORLD_POSITION
  2333. #define ASE_NEEDS_FRAG_WORLD_NORMAL
  2334. #define ASE_NEEDS_FRAG_WORLD_TANGENT
  2335. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  2336. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  2337. #pragma shader_feature_local _EDGESLOPE_ON
  2338. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  2339. #define ASE_SV_DEPTH SV_DepthLessEqual
  2340. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  2341. #else
  2342. #define ASE_SV_DEPTH SV_Depth
  2343. #define ASE_SV_POSITION_QUALIFIERS
  2344. #endif
  2345. struct Attributes
  2346. {
  2347. float4 positionOS : POSITION;
  2348. float3 normalOS : NORMAL;
  2349. float4 tangentOS : TANGENT;
  2350. float4 ase_texcoord : TEXCOORD0;
  2351. UNITY_VERTEX_INPUT_INSTANCE_ID
  2352. };
  2353. struct PackedVaryings
  2354. {
  2355. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  2356. float4 clipPosV : TEXCOORD0;
  2357. float3 worldNormal : TEXCOORD1;
  2358. float4 worldTangent : TEXCOORD2;
  2359. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  2360. float3 positionWS : TEXCOORD3;
  2361. #endif
  2362. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  2363. float4 shadowCoord : TEXCOORD4;
  2364. #endif
  2365. float4 ase_texcoord5 : TEXCOORD5;
  2366. float4 ase_texcoord6 : TEXCOORD6;
  2367. UNITY_VERTEX_INPUT_INSTANCE_ID
  2368. UNITY_VERTEX_OUTPUT_STEREO
  2369. };
  2370. CBUFFER_START(UnityPerMaterial)
  2371. float4 _Healthycolor1;
  2372. float4 _Drycolor1;
  2373. float2 _TilingCoverage;
  2374. float2 _TilingDetail;
  2375. float2 _Offset;
  2376. float2 _Tiling;
  2377. float2 _OffsetDetail;
  2378. float _DisplacementAmount;
  2379. float _Float6;
  2380. float _Float4;
  2381. float _NormalBlur;
  2382. float _DetailNormalIntensity;
  2383. float _NormalIntensity;
  2384. float _DryColorOffset;
  2385. float _SlopeMin;
  2386. float _DryColorScale;
  2387. float _CoverageAmount;
  2388. float _MossColor;
  2389. float _Float5;
  2390. float _TSSlopeMax;
  2391. float _TSSlopeMin;
  2392. float _SlopeMax;
  2393. float _CoverageFalloff;
  2394. float _Float7;
  2395. #ifdef ASE_TRANSMISSION
  2396. float _TransmissionShadow;
  2397. #endif
  2398. #ifdef ASE_TRANSLUCENCY
  2399. float _TransStrength;
  2400. float _TransNormal;
  2401. float _TransScattering;
  2402. float _TransDirect;
  2403. float _TransAmbient;
  2404. float _TransShadow;
  2405. #endif
  2406. #ifdef ASE_TESSELLATION
  2407. float _TessPhongStrength;
  2408. float _TessValue;
  2409. float _TessMin;
  2410. float _TessMax;
  2411. float _TessEdgeLength;
  2412. float _TessMaxDisp;
  2413. #endif
  2414. CBUFFER_END
  2415. #ifdef SCENEPICKINGPASS
  2416. float4 _SelectionID;
  2417. #endif
  2418. #ifdef SCENESELECTIONPASS
  2419. int _ObjectId;
  2420. int _PassValue;
  2421. #endif
  2422. sampler2D _CoverageHeight;
  2423. sampler2D _NormalMap;
  2424. sampler2D _DetailNormal;
  2425. sampler2D _DetailMask;
  2426. sampler2D _CoverageNormal;
  2427. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2428. {
  2429. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2430. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2431. float3 nsign = sign( worldNormal );
  2432. half4 xNorm; half4 yNorm; half4 zNorm;
  2433. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  2434. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  2435. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  2436. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  2437. }
  2438. inline float3 TriplanarSampling151( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2439. {
  2440. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2441. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2442. float3 nsign = sign( worldNormal );
  2443. half4 xNorm; half4 yNorm; half4 zNorm;
  2444. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  2445. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  2446. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  2447. xNorm.xyz = half3( UnpackNormalScale( xNorm , 1.0 ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;
  2448. yNorm.xyz = half3( UnpackNormalScale( yNorm , 1.0 ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;
  2449. zNorm.xyz = half3( UnpackNormalScale( zNorm , 1.0 ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;
  2450. return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );
  2451. }
  2452. PackedVaryings VertexFunction( Attributes input )
  2453. {
  2454. PackedVaryings output = (PackedVaryings)0;
  2455. UNITY_SETUP_INSTANCE_ID(input);
  2456. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2457. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2458. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  2459. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  2460. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  2461. float4 TriplanarHeight355 = triplanar339;
  2462. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  2463. float3 _Tangent = float3(0,1,0);
  2464. float3 ase_worldTangent = TransformObjectToWorldDir(input.tangentOS.xyz);
  2465. float ase_vertexTangentSign = input.tangentOS.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  2466. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  2467. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  2468. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  2469. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  2470. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  2471. float3 temp_output_371_0 = abs( ase_worldNormal );
  2472. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  2473. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  2474. float staticSwitch382 = saturate( lerpResult273 );
  2475. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  2476. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2477. #else
  2478. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2479. #endif
  2480. float Slope275 = staticSwitch382;
  2481. #ifdef _EDGESLOPETESSELLATION_ON
  2482. float staticSwitch365 = Slope275;
  2483. #else
  2484. float staticSwitch365 = 1.0;
  2485. #endif
  2486. output.ase_texcoord6.xyz = ase_worldBitangent;
  2487. output.ase_texcoord5.xy = input.ase_texcoord.xy;
  2488. //setting value to unused interpolator channels and avoid initialization warnings
  2489. output.ase_texcoord5.zw = 0;
  2490. output.ase_texcoord6.w = 0;
  2491. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2492. float3 defaultVertexValue = input.positionOS.xyz;
  2493. #else
  2494. float3 defaultVertexValue = float3(0, 0, 0);
  2495. #endif
  2496. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  2497. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2498. input.positionOS.xyz = vertexValue;
  2499. #else
  2500. input.positionOS.xyz += vertexValue;
  2501. #endif
  2502. input.normalOS = input.normalOS;
  2503. input.tangentOS = input.tangentOS;
  2504. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  2505. float3 normalWS = TransformObjectToWorldNormal( input.normalOS );
  2506. float4 tangentWS = float4( TransformObjectToWorldDir( input.tangentOS.xyz ), input.tangentOS.w );
  2507. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  2508. output.positionWS = vertexInput.positionWS;
  2509. #endif
  2510. output.worldNormal = normalWS;
  2511. output.worldTangent = tangentWS;
  2512. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  2513. output.shadowCoord = GetShadowCoord( vertexInput );
  2514. #endif
  2515. output.positionCS = vertexInput.positionCS;
  2516. output.clipPosV = vertexInput.positionCS;
  2517. return output;
  2518. }
  2519. #if defined(ASE_TESSELLATION)
  2520. struct VertexControl
  2521. {
  2522. float4 vertex : INTERNALTESSPOS;
  2523. float3 normalOS : NORMAL;
  2524. float4 tangentOS : TANGENT;
  2525. float4 ase_texcoord : TEXCOORD0;
  2526. UNITY_VERTEX_INPUT_INSTANCE_ID
  2527. };
  2528. struct TessellationFactors
  2529. {
  2530. float edge[3] : SV_TessFactor;
  2531. float inside : SV_InsideTessFactor;
  2532. };
  2533. VertexControl vert ( Attributes input )
  2534. {
  2535. VertexControl output;
  2536. UNITY_SETUP_INSTANCE_ID(input);
  2537. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2538. output.vertex = input.positionOS;
  2539. output.normalOS = input.normalOS;
  2540. output.tangentOS = input.tangentOS;
  2541. output.ase_texcoord = input.ase_texcoord;
  2542. return output;
  2543. }
  2544. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2545. {
  2546. TessellationFactors output;
  2547. float4 tf = 1;
  2548. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2549. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2550. #if defined(ASE_FIXED_TESSELLATION)
  2551. tf = FixedTess( tessValue );
  2552. #elif defined(ASE_DISTANCE_TESSELLATION)
  2553. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2554. #elif defined(ASE_LENGTH_TESSELLATION)
  2555. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2556. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2557. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2558. #endif
  2559. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2560. return output;
  2561. }
  2562. [domain("tri")]
  2563. [partitioning("fractional_odd")]
  2564. [outputtopology("triangle_cw")]
  2565. [patchconstantfunc("TessellationFunction")]
  2566. [outputcontrolpoints(3)]
  2567. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2568. {
  2569. return patch[id];
  2570. }
  2571. [domain("tri")]
  2572. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2573. {
  2574. Attributes output = (Attributes) 0;
  2575. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2576. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2577. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  2578. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  2579. #if defined(ASE_PHONG_TESSELLATION)
  2580. float3 pp[3];
  2581. for (int i = 0; i < 3; ++i)
  2582. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2583. float phongStrength = _TessPhongStrength;
  2584. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2585. #endif
  2586. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2587. return VertexFunction(output);
  2588. }
  2589. #else
  2590. PackedVaryings vert ( Attributes input )
  2591. {
  2592. return VertexFunction( input );
  2593. }
  2594. #endif
  2595. void frag( PackedVaryings input
  2596. , out half4 outNormalWS : SV_Target0
  2597. #ifdef ASE_DEPTH_WRITE_ON
  2598. ,out float outputDepth : ASE_SV_DEPTH
  2599. #endif
  2600. #ifdef _WRITE_RENDERING_LAYERS
  2601. , out float4 outRenderingLayers : SV_Target1
  2602. #endif
  2603. )
  2604. {
  2605. UNITY_SETUP_INSTANCE_ID(input);
  2606. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  2607. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  2608. float3 WorldPosition = input.positionWS;
  2609. #endif
  2610. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  2611. float3 WorldNormal = input.worldNormal;
  2612. float4 WorldTangent = input.worldTangent;
  2613. float4 ClipPos = input.clipPosV;
  2614. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  2615. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  2616. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2617. ShadowCoords = input.shadowCoord;
  2618. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  2619. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  2620. #endif
  2621. #endif
  2622. float2 texCoord147 = input.ase_texcoord5.xy * _Tiling + _Offset;
  2623. float2 TileUVs232 = texCoord147;
  2624. float3 unpack150 = UnpackNormalScale( tex2D( _NormalMap, TileUVs232 ), _NormalIntensity );
  2625. unpack150.z = lerp( 1, unpack150.z, saturate(_NormalIntensity) );
  2626. float3 NormalMapMain249 = unpack150;
  2627. float2 texCoord110 = input.ase_texcoord5.xy * _TilingDetail + _OffsetDetail;
  2628. float2 TileUVs2231 = texCoord110;
  2629. float3 unpack192 = UnpackNormalScale( tex2D( _DetailNormal, TileUVs2231 ), _DetailNormalIntensity );
  2630. unpack192.z = lerp( 1, unpack192.z, saturate(_DetailNormalIntensity) );
  2631. float2 uv_DetailMask221 = input.ase_texcoord5.xy;
  2632. float4 tex2DNode221 = tex2D( _DetailMask, uv_DetailMask221 );
  2633. float3 lerpResult246 = lerp( NormalMapMain249 , unpack192 , tex2DNode221.a);
  2634. float3 DetailNormalMap248 = lerpResult246;
  2635. float3 ase_worldBitangent = input.ase_texcoord6.xyz;
  2636. float3x3 ase_worldToTangent = float3x3(WorldTangent.xyz,ase_worldBitangent,WorldNormal);
  2637. float3 triplanar151 = TriplanarSampling151( _CoverageNormal, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  2638. float3 tanTriplanarNormal151 = mul( ase_worldToTangent, triplanar151 );
  2639. float3 TriplanarNormal259 = tanTriplanarNormal151;
  2640. float temp_output_149_0 = saturate( ( WorldNormal.y * _CoverageAmount ) );
  2641. float3 lerpResult152 = lerp( NormalMapMain249 , TriplanarNormal259 , temp_output_149_0);
  2642. float3 tanToWorld0 = float3( WorldTangent.xyz.x, ase_worldBitangent.x, WorldNormal.x );
  2643. float3 tanToWorld1 = float3( WorldTangent.xyz.y, ase_worldBitangent.y, WorldNormal.y );
  2644. float3 tanToWorld2 = float3( WorldTangent.xyz.z, ase_worldBitangent.z, WorldNormal.z );
  2645. float3 tanNormal154 = lerpResult152;
  2646. float3 worldNormal154 = float3(dot(tanToWorld0,tanNormal154), dot(tanToWorld1,tanNormal154), dot(tanToWorld2,tanNormal154));
  2647. float temp_output_174_0 = saturate( ( worldNormal154.y * _CoverageAmount ) );
  2648. float3 _Tangent = float3(0,1,0);
  2649. float3x3 ase_tangentToWorldFast = float3x3(WorldTangent.xyz.x,ase_worldBitangent.x,WorldNormal.x,WorldTangent.xyz.y,ase_worldBitangent.y,WorldNormal.y,WorldTangent.xyz.z,ase_worldBitangent.z,WorldNormal.z);
  2650. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  2651. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  2652. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  2653. float3 temp_output_371_0 = abs( WorldNormal );
  2654. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  2655. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  2656. float staticSwitch382 = saturate( lerpResult273 );
  2657. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  2658. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2659. #else
  2660. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2661. #endif
  2662. float Slope275 = staticSwitch382;
  2663. #ifdef _EDGESLOPE_ON
  2664. float staticSwitch276 = ( temp_output_174_0 * Slope275 );
  2665. #else
  2666. float staticSwitch276 = temp_output_174_0;
  2667. #endif
  2668. float3 lerpResult196 = lerp( BlendNormal( DetailNormalMap248 , NormalMapMain249 ) , BlendNormal( (( _NormalBlur )?( float3(0,0,1) ):( NormalMapMain249 )) , TriplanarNormal259 ) , staticSwitch276);
  2669. float3 Normal = lerpResult196;
  2670. float Alpha = 1;
  2671. float AlphaClipThreshold = 0.5;
  2672. #ifdef ASE_DEPTH_WRITE_ON
  2673. float DepthValue = input.positionCS.z;
  2674. #endif
  2675. #ifdef _ALPHATEST_ON
  2676. clip(Alpha - AlphaClipThreshold);
  2677. #endif
  2678. #if defined(LOD_FADE_CROSSFADE)
  2679. LODFadeCrossFade( input.positionCS );
  2680. #endif
  2681. #ifdef ASE_DEPTH_WRITE_ON
  2682. outputDepth = DepthValue;
  2683. #endif
  2684. #if defined(_GBUFFER_NORMALS_OCT)
  2685. float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal);
  2686. float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);
  2687. half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);
  2688. outNormalWS = half4(packedNormalWS, 0.0);
  2689. #else
  2690. #if defined(_NORMALMAP)
  2691. #if _NORMAL_DROPOFF_TS
  2692. float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
  2693. float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz);
  2694. float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz));
  2695. #elif _NORMAL_DROPOFF_OS
  2696. float3 normalWS = TransformObjectToWorldNormal(Normal);
  2697. #elif _NORMAL_DROPOFF_WS
  2698. float3 normalWS = Normal;
  2699. #endif
  2700. #else
  2701. float3 normalWS = WorldNormal;
  2702. #endif
  2703. outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0);
  2704. #endif
  2705. #ifdef _WRITE_RENDERING_LAYERS
  2706. uint renderingLayers = GetMeshRenderingLayer();
  2707. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  2708. #endif
  2709. }
  2710. ENDHLSL
  2711. }
  2712. Pass
  2713. {
  2714. Name "GBuffer"
  2715. Tags { "LightMode"="UniversalGBuffer" }
  2716. Blend One Zero, One Zero
  2717. ZWrite On
  2718. ZTest LEqual
  2719. Offset 0 , 0
  2720. ColorMask RGBA
  2721. HLSLPROGRAM
  2722. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2723. #define _NORMAL_DROPOFF_TS 1
  2724. #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
  2725. #pragma multi_compile_instancing
  2726. #pragma instancing_options renderinglayer
  2727. #pragma multi_compile _ LOD_FADE_CROSSFADE
  2728. #pragma multi_compile_fog
  2729. #define ASE_FOG 1
  2730. #define _NORMALMAP 1
  2731. #define ASE_VERSION 19701
  2732. #define ASE_SRP_VERSION 170003
  2733. #ifdef UNITY_COLORSPACE_GAMMA//ASE Color Space Def
  2734. #define unity_ColorSpaceDouble half4(2.0, 2.0, 2.0, 2.0)//ASE Color Space Def
  2735. #else // Linear values//ASE Color Space Def
  2736. #define unity_ColorSpaceDouble half4(4.59479380, 4.59479380, 4.59479380, 2.0)//ASE Color Space Def
  2737. #endif//ASE Color Space Def
  2738. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
  2739. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
  2740. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
  2741. #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
  2742. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  2743. #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
  2744. #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
  2745. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  2746. #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
  2747. #pragma multi_compile _ SHADOWS_SHADOWMASK
  2748. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  2749. #pragma multi_compile _ USE_LEGACY_LIGHTMAPS
  2750. #pragma multi_compile _ LIGHTMAP_ON
  2751. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  2752. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  2753. #pragma vertex vert
  2754. #pragma fragment frag
  2755. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2756. #define _SPECULAR_COLOR 1
  2757. #endif
  2758. #define SHADERPASS SHADERPASS_GBUFFER
  2759. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2760. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  2761. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  2762. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2763. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2764. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2765. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2766. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2767. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2768. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2769. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2770. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2771. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  2772. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2773. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  2774. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2775. #if defined(LOD_FADE_CROSSFADE)
  2776. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  2777. #endif
  2778. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  2779. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  2780. #endif
  2781. #define ASE_NEEDS_VERT_NORMAL
  2782. #define ASE_NEEDS_VERT_TANGENT
  2783. #define ASE_NEEDS_FRAG_WORLD_POSITION
  2784. #define ASE_NEEDS_FRAG_WORLD_NORMAL
  2785. #define ASE_NEEDS_FRAG_WORLD_TANGENT
  2786. #define ASE_NEEDS_FRAG_WORLD_BITANGENT
  2787. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  2788. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  2789. #pragma shader_feature_local _EDGESLOPE_ON
  2790. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  2791. #define ASE_SV_DEPTH SV_DepthLessEqual
  2792. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  2793. #else
  2794. #define ASE_SV_DEPTH SV_Depth
  2795. #define ASE_SV_POSITION_QUALIFIERS
  2796. #endif
  2797. struct Attributes
  2798. {
  2799. float4 positionOS : POSITION;
  2800. float3 normalOS : NORMAL;
  2801. float4 tangentOS : TANGENT;
  2802. float4 texcoord : TEXCOORD0;
  2803. float4 texcoord1 : TEXCOORD1;
  2804. float4 texcoord2 : TEXCOORD2;
  2805. UNITY_VERTEX_INPUT_INSTANCE_ID
  2806. };
  2807. struct PackedVaryings
  2808. {
  2809. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  2810. float4 clipPosV : TEXCOORD0;
  2811. float4 lightmapUVOrVertexSH : TEXCOORD1;
  2812. half4 fogFactorAndVertexLight : TEXCOORD2;
  2813. float4 tSpace0 : TEXCOORD3;
  2814. float4 tSpace1 : TEXCOORD4;
  2815. float4 tSpace2 : TEXCOORD5;
  2816. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2817. float4 shadowCoord : TEXCOORD6;
  2818. #endif
  2819. #if defined(DYNAMICLIGHTMAP_ON)
  2820. float2 dynamicLightmapUV : TEXCOORD7;
  2821. #endif
  2822. #if defined(USE_APV_PROBE_OCCLUSION)
  2823. float4 probeOcclusion : TEXCOORD8;
  2824. #endif
  2825. float4 ase_texcoord9 : TEXCOORD9;
  2826. UNITY_VERTEX_INPUT_INSTANCE_ID
  2827. UNITY_VERTEX_OUTPUT_STEREO
  2828. };
  2829. CBUFFER_START(UnityPerMaterial)
  2830. float4 _Healthycolor1;
  2831. float4 _Drycolor1;
  2832. float2 _TilingCoverage;
  2833. float2 _TilingDetail;
  2834. float2 _Offset;
  2835. float2 _Tiling;
  2836. float2 _OffsetDetail;
  2837. float _DisplacementAmount;
  2838. float _Float6;
  2839. float _Float4;
  2840. float _NormalBlur;
  2841. float _DetailNormalIntensity;
  2842. float _NormalIntensity;
  2843. float _DryColorOffset;
  2844. float _SlopeMin;
  2845. float _DryColorScale;
  2846. float _CoverageAmount;
  2847. float _MossColor;
  2848. float _Float5;
  2849. float _TSSlopeMax;
  2850. float _TSSlopeMin;
  2851. float _SlopeMax;
  2852. float _CoverageFalloff;
  2853. float _Float7;
  2854. #ifdef ASE_TRANSMISSION
  2855. float _TransmissionShadow;
  2856. #endif
  2857. #ifdef ASE_TRANSLUCENCY
  2858. float _TransStrength;
  2859. float _TransNormal;
  2860. float _TransScattering;
  2861. float _TransDirect;
  2862. float _TransAmbient;
  2863. float _TransShadow;
  2864. #endif
  2865. #ifdef ASE_TESSELLATION
  2866. float _TessPhongStrength;
  2867. float _TessValue;
  2868. float _TessMin;
  2869. float _TessMax;
  2870. float _TessEdgeLength;
  2871. float _TessMaxDisp;
  2872. #endif
  2873. CBUFFER_END
  2874. #ifdef SCENEPICKINGPASS
  2875. float4 _SelectionID;
  2876. #endif
  2877. #ifdef SCENESELECTIONPASS
  2878. int _ObjectId;
  2879. int _PassValue;
  2880. #endif
  2881. sampler2D _CoverageHeight;
  2882. sampler2D _AlbedoMap;
  2883. sampler2D _DetailAlbedo;
  2884. sampler2D _DetailMask;
  2885. sampler2D _CoverageAlbedo;
  2886. sampler2D _NormalMap;
  2887. sampler2D _CoverageNormal;
  2888. sampler2D _DetailNormal;
  2889. sampler2D _MaskMapRGBA;
  2890. sampler2D _CoverageMask;
  2891. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
  2892. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2893. {
  2894. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2895. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2896. float3 nsign = sign( worldNormal );
  2897. half4 xNorm; half4 yNorm; half4 zNorm;
  2898. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  2899. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  2900. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  2901. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  2902. }
  2903. inline float4 TriplanarSampling157( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2904. {
  2905. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2906. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2907. float3 nsign = sign( worldNormal );
  2908. half4 xNorm; half4 yNorm; half4 zNorm;
  2909. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  2910. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  2911. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  2912. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  2913. }
  2914. inline float3 TriplanarSampling151( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2915. {
  2916. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2917. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2918. float3 nsign = sign( worldNormal );
  2919. half4 xNorm; half4 yNorm; half4 zNorm;
  2920. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  2921. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  2922. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  2923. xNorm.xyz = half3( UnpackNormalScale( xNorm , 1.0 ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;
  2924. yNorm.xyz = half3( UnpackNormalScale( yNorm , 1.0 ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;
  2925. zNorm.xyz = half3( UnpackNormalScale( zNorm , 1.0 ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;
  2926. return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );
  2927. }
  2928. inline float4 TriplanarSampling289( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  2929. {
  2930. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  2931. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  2932. float3 nsign = sign( worldNormal );
  2933. half4 xNorm; half4 yNorm; half4 zNorm;
  2934. xNorm = tex2D( topTexMap, tiling * worldPos.zy * float2( nsign.x, 1.0 ) );
  2935. yNorm = tex2D( topTexMap, tiling * worldPos.xz * float2( nsign.y, 1.0 ) );
  2936. zNorm = tex2D( topTexMap, tiling * worldPos.xy * float2( -nsign.z, 1.0 ) );
  2937. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  2938. }
  2939. PackedVaryings VertexFunction( Attributes input )
  2940. {
  2941. PackedVaryings output = (PackedVaryings)0;
  2942. UNITY_SETUP_INSTANCE_ID(input);
  2943. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2944. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2945. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  2946. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  2947. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  2948. float4 TriplanarHeight355 = triplanar339;
  2949. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  2950. float3 _Tangent = float3(0,1,0);
  2951. float3 ase_worldTangent = TransformObjectToWorldDir(input.tangentOS.xyz);
  2952. float ase_vertexTangentSign = input.tangentOS.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  2953. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  2954. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  2955. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  2956. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  2957. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  2958. float3 temp_output_371_0 = abs( ase_worldNormal );
  2959. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  2960. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  2961. float staticSwitch382 = saturate( lerpResult273 );
  2962. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  2963. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2964. #else
  2965. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  2966. #endif
  2967. float Slope275 = staticSwitch382;
  2968. #ifdef _EDGESLOPETESSELLATION_ON
  2969. float staticSwitch365 = Slope275;
  2970. #else
  2971. float staticSwitch365 = 1.0;
  2972. #endif
  2973. output.ase_texcoord9.xy = input.texcoord.xy;
  2974. //setting value to unused interpolator channels and avoid initialization warnings
  2975. output.ase_texcoord9.zw = 0;
  2976. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2977. float3 defaultVertexValue = input.positionOS.xyz;
  2978. #else
  2979. float3 defaultVertexValue = float3(0, 0, 0);
  2980. #endif
  2981. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  2982. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2983. input.positionOS.xyz = vertexValue;
  2984. #else
  2985. input.positionOS.xyz += vertexValue;
  2986. #endif
  2987. input.normalOS = input.normalOS;
  2988. input.tangentOS = input.tangentOS;
  2989. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  2990. VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS );
  2991. output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x);
  2992. output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y);
  2993. output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z);
  2994. #if defined(LIGHTMAP_ON)
  2995. OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy);
  2996. #endif
  2997. #if defined(DYNAMICLIGHTMAP_ON)
  2998. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  2999. #endif
  3000. OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion );
  3001. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  3002. output.lightmapUVOrVertexSH.zw = input.texcoord.xy;
  3003. output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  3004. #endif
  3005. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  3006. output.fogFactorAndVertexLight = half4(0, vertexLight);
  3007. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  3008. output.shadowCoord = GetShadowCoord( vertexInput );
  3009. #endif
  3010. output.positionCS = vertexInput.positionCS;
  3011. output.clipPosV = vertexInput.positionCS;
  3012. return output;
  3013. }
  3014. #if defined(ASE_TESSELLATION)
  3015. struct VertexControl
  3016. {
  3017. float4 vertex : INTERNALTESSPOS;
  3018. float3 normalOS : NORMAL;
  3019. float4 tangentOS : TANGENT;
  3020. float4 texcoord : TEXCOORD0;
  3021. float4 texcoord1 : TEXCOORD1;
  3022. float4 texcoord2 : TEXCOORD2;
  3023. UNITY_VERTEX_INPUT_INSTANCE_ID
  3024. };
  3025. struct TessellationFactors
  3026. {
  3027. float edge[3] : SV_TessFactor;
  3028. float inside : SV_InsideTessFactor;
  3029. };
  3030. VertexControl vert ( Attributes input )
  3031. {
  3032. VertexControl output;
  3033. UNITY_SETUP_INSTANCE_ID(input);
  3034. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3035. output.vertex = input.positionOS;
  3036. output.normalOS = input.normalOS;
  3037. output.tangentOS = input.tangentOS;
  3038. output.texcoord = input.texcoord;
  3039. output.texcoord1 = input.texcoord1;
  3040. output.texcoord2 = input.texcoord2;
  3041. return output;
  3042. }
  3043. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  3044. {
  3045. TessellationFactors output;
  3046. float4 tf = 1;
  3047. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  3048. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  3049. #if defined(ASE_FIXED_TESSELLATION)
  3050. tf = FixedTess( tessValue );
  3051. #elif defined(ASE_DISTANCE_TESSELLATION)
  3052. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  3053. #elif defined(ASE_LENGTH_TESSELLATION)
  3054. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  3055. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  3056. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  3057. #endif
  3058. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  3059. return output;
  3060. }
  3061. [domain("tri")]
  3062. [partitioning("fractional_odd")]
  3063. [outputtopology("triangle_cw")]
  3064. [patchconstantfunc("TessellationFunction")]
  3065. [outputcontrolpoints(3)]
  3066. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  3067. {
  3068. return patch[id];
  3069. }
  3070. [domain("tri")]
  3071. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  3072. {
  3073. Attributes output = (Attributes) 0;
  3074. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  3075. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  3076. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  3077. output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  3078. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  3079. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  3080. #if defined(ASE_PHONG_TESSELLATION)
  3081. float3 pp[3];
  3082. for (int i = 0; i < 3; ++i)
  3083. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  3084. float phongStrength = _TessPhongStrength;
  3085. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  3086. #endif
  3087. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  3088. return VertexFunction(output);
  3089. }
  3090. #else
  3091. PackedVaryings vert ( Attributes input )
  3092. {
  3093. return VertexFunction( input );
  3094. }
  3095. #endif
  3096. FragmentOutput frag ( PackedVaryings input
  3097. #ifdef ASE_DEPTH_WRITE_ON
  3098. ,out float outputDepth : ASE_SV_DEPTH
  3099. #endif
  3100. )
  3101. {
  3102. UNITY_SETUP_INSTANCE_ID(input);
  3103. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  3104. #if defined(LOD_FADE_CROSSFADE)
  3105. LODFadeCrossFade( input.positionCS );
  3106. #endif
  3107. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  3108. float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  3109. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  3110. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  3111. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  3112. #else
  3113. float3 WorldNormal = normalize( input.tSpace0.xyz );
  3114. float3 WorldTangent = input.tSpace1.xyz;
  3115. float3 WorldBiTangent = input.tSpace2.xyz;
  3116. #endif
  3117. float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w);
  3118. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  3119. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  3120. float4 ClipPos = input.clipPosV;
  3121. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  3122. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  3123. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  3124. ShadowCoords = input.shadowCoord;
  3125. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  3126. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  3127. #else
  3128. ShadowCoords = float4(0, 0, 0, 0);
  3129. #endif
  3130. WorldViewDirection = SafeNormalize( WorldViewDirection );
  3131. float2 texCoord147 = input.ase_texcoord9.xy * _Tiling + _Offset;
  3132. float2 TileUVs232 = texCoord147;
  3133. float4 AlbedoMapMain250 = tex2D( _AlbedoMap, TileUVs232 );
  3134. float2 texCoord110 = input.ase_texcoord9.xy * _TilingDetail + _OffsetDetail;
  3135. float2 TileUVs2231 = texCoord110;
  3136. float2 uv_DetailMask221 = input.ase_texcoord9.xy;
  3137. float4 tex2DNode221 = tex2D( _DetailMask, uv_DetailMask221 );
  3138. float4 DetailAlbedoMap251 = ( AlbedoMapMain250 * ( ( ( tex2D( _DetailAlbedo, TileUVs2231 ) * unity_ColorSpaceDouble ) * tex2DNode221.a ) + ( 1.0 - tex2DNode221.a ) ) );
  3139. float4 triplanar157 = TriplanarSampling157( _CoverageAlbedo, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  3140. float4 TriplanarAlbedo258 = triplanar157;
  3141. float4 lerpResult324 = lerp( ( TriplanarAlbedo258 * _Drycolor1 ) , ( ( TriplanarAlbedo258 * _Healthycolor1 ) * unity_ColorSpaceDouble ) , saturate( (WorldNormal.y*_DryColorScale + _DryColorOffset) ));
  3142. float4 TriplanarMossColor_Output327 = lerpResult324;
  3143. float3 unpack150 = UnpackNormalScale( tex2D( _NormalMap, TileUVs232 ), _NormalIntensity );
  3144. unpack150.z = lerp( 1, unpack150.z, saturate(_NormalIntensity) );
  3145. float3 NormalMapMain249 = unpack150;
  3146. float3x3 ase_worldToTangent = float3x3(WorldTangent,WorldBiTangent,WorldNormal);
  3147. float3 triplanar151 = TriplanarSampling151( _CoverageNormal, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  3148. float3 tanTriplanarNormal151 = mul( ase_worldToTangent, triplanar151 );
  3149. float3 TriplanarNormal259 = tanTriplanarNormal151;
  3150. float temp_output_149_0 = saturate( ( WorldNormal.y * _CoverageAmount ) );
  3151. float3 lerpResult152 = lerp( NormalMapMain249 , TriplanarNormal259 , temp_output_149_0);
  3152. float3 tanToWorld0 = float3( WorldTangent.x, WorldBiTangent.x, WorldNormal.x );
  3153. float3 tanToWorld1 = float3( WorldTangent.y, WorldBiTangent.y, WorldNormal.y );
  3154. float3 tanToWorld2 = float3( WorldTangent.z, WorldBiTangent.z, WorldNormal.z );
  3155. float3 tanNormal154 = lerpResult152;
  3156. float3 worldNormal154 = float3(dot(tanToWorld0,tanNormal154), dot(tanToWorld1,tanNormal154), dot(tanToWorld2,tanNormal154));
  3157. float temp_output_174_0 = saturate( ( worldNormal154.y * _CoverageAmount ) );
  3158. float3 _Tangent = float3(0,1,0);
  3159. float3x3 ase_tangentToWorldFast = float3x3(WorldTangent.x,WorldBiTangent.x,WorldNormal.x,WorldTangent.y,WorldBiTangent.y,WorldNormal.y,WorldTangent.z,WorldBiTangent.z,WorldNormal.z);
  3160. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  3161. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  3162. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  3163. float3 temp_output_371_0 = abs( WorldNormal );
  3164. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  3165. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  3166. float staticSwitch382 = saturate( lerpResult273 );
  3167. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  3168. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  3169. #else
  3170. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  3171. #endif
  3172. float Slope275 = staticSwitch382;
  3173. #ifdef _EDGESLOPE_ON
  3174. float staticSwitch276 = ( temp_output_174_0 * Slope275 );
  3175. #else
  3176. float staticSwitch276 = temp_output_174_0;
  3177. #endif
  3178. float4 lerpResult182 = lerp( DetailAlbedoMap251 , (( _MossColor )?( TriplanarMossColor_Output327 ):( TriplanarAlbedo258 )) , staticSwitch276);
  3179. float3 unpack192 = UnpackNormalScale( tex2D( _DetailNormal, TileUVs2231 ), _DetailNormalIntensity );
  3180. unpack192.z = lerp( 1, unpack192.z, saturate(_DetailNormalIntensity) );
  3181. float3 lerpResult246 = lerp( NormalMapMain249 , unpack192 , tex2DNode221.a);
  3182. float3 DetailNormalMap248 = lerpResult246;
  3183. float3 lerpResult196 = lerp( BlendNormal( DetailNormalMap248 , NormalMapMain249 ) , BlendNormal( (( _NormalBlur )?( float3(0,0,1) ):( NormalMapMain249 )) , TriplanarNormal259 ) , staticSwitch276);
  3184. float4 tex2DNode156 = tex2D( _MaskMapRGBA, TileUVs232 );
  3185. float4 triplanar289 = TriplanarSampling289( _CoverageMask, WorldPosition, WorldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  3186. float lerpResult180 = lerp( ( tex2DNode156.a * _Float4 ) , ( triplanar289.w * _Float6 ) , staticSwitch276);
  3187. float lerpResult293 = lerp( pow( abs( tex2DNode156.g ) , _Float5 ) , pow( abs( triplanar289.g ) , _Float7 ) , staticSwitch276);
  3188. float3 BaseColor = lerpResult182.xyz;
  3189. float3 Normal = lerpResult196;
  3190. float3 Emission = 0;
  3191. float3 Specular = 0.5;
  3192. float Metallic = 0;
  3193. float Smoothness = lerpResult180;
  3194. float Occlusion = lerpResult293;
  3195. float Alpha = 1;
  3196. float AlphaClipThreshold = 0.5;
  3197. float AlphaClipThresholdShadow = 0.5;
  3198. float3 BakedGI = 0;
  3199. float3 RefractionColor = 1;
  3200. float RefractionIndex = 1;
  3201. float3 Transmission = 1;
  3202. float3 Translucency = 1;
  3203. #ifdef ASE_DEPTH_WRITE_ON
  3204. float DepthValue = input.positionCS.z;
  3205. #endif
  3206. #ifdef _ALPHATEST_ON
  3207. clip(Alpha - AlphaClipThreshold);
  3208. #endif
  3209. InputData inputData = (InputData)0;
  3210. inputData.positionWS = WorldPosition;
  3211. inputData.positionCS = input.positionCS;
  3212. inputData.shadowCoord = ShadowCoords;
  3213. #ifdef _NORMALMAP
  3214. #if _NORMAL_DROPOFF_TS
  3215. inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal ));
  3216. #elif _NORMAL_DROPOFF_OS
  3217. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  3218. #elif _NORMAL_DROPOFF_WS
  3219. inputData.normalWS = Normal;
  3220. #endif
  3221. #else
  3222. inputData.normalWS = WorldNormal;
  3223. #endif
  3224. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  3225. inputData.viewDirectionWS = SafeNormalize( WorldViewDirection );
  3226. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  3227. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  3228. float3 SH = SampleSH(inputData.normalWS.xyz);
  3229. #else
  3230. float3 SH = input.lightmapUVOrVertexSH.xyz;
  3231. #endif
  3232. #if defined(DYNAMICLIGHTMAP_ON)
  3233. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS);
  3234. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  3235. #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
  3236. inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS),
  3237. inputData.normalWS,
  3238. inputData.viewDirectionWS,
  3239. input.positionCS.xy,
  3240. input.probeOcclusion,
  3241. inputData.shadowMask );
  3242. #else
  3243. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
  3244. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  3245. #endif
  3246. #ifdef ASE_BAKEDGI
  3247. inputData.bakedGI = BakedGI;
  3248. #endif
  3249. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  3250. #if defined(DEBUG_DISPLAY)
  3251. #if defined(DYNAMICLIGHTMAP_ON)
  3252. inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
  3253. #endif
  3254. #if defined(LIGHTMAP_ON)
  3255. inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy;
  3256. #else
  3257. inputData.vertexSH = SH;
  3258. #endif
  3259. #if defined(USE_APV_PROBE_OCCLUSION)
  3260. inputData.probeOcclusion = input.probeOcclusion;
  3261. #endif
  3262. #endif
  3263. #ifdef _DBUFFER
  3264. ApplyDecal(input.positionCS,
  3265. BaseColor,
  3266. Specular,
  3267. inputData.normalWS,
  3268. Metallic,
  3269. Occlusion,
  3270. Smoothness);
  3271. #endif
  3272. BRDFData brdfData;
  3273. InitializeBRDFData
  3274. (BaseColor, Metallic, Specular, Smoothness, Alpha, brdfData);
  3275. Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
  3276. half4 color;
  3277. MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask);
  3278. color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
  3279. color.a = Alpha;
  3280. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  3281. color.rgb *= color.a;
  3282. #endif
  3283. #ifdef ASE_DEPTH_WRITE_ON
  3284. outputDepth = DepthValue;
  3285. #endif
  3286. return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb, Occlusion);
  3287. }
  3288. ENDHLSL
  3289. }
  3290. Pass
  3291. {
  3292. Name "SceneSelectionPass"
  3293. Tags { "LightMode"="SceneSelectionPass" }
  3294. Cull Off
  3295. AlphaToMask Off
  3296. HLSLPROGRAM
  3297. #pragma multi_compile_local_fragment _ALPHATEST_ON
  3298. #define _NORMAL_DROPOFF_TS 1
  3299. #define ASE_FOG 1
  3300. #define _NORMALMAP 1
  3301. #define ASE_VERSION 19701
  3302. #define ASE_SRP_VERSION 170003
  3303. #pragma vertex vert
  3304. #pragma fragment frag
  3305. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  3306. #define _SPECULAR_COLOR 1
  3307. #endif
  3308. #define SCENESELECTIONPASS 1
  3309. #define ATTRIBUTES_NEED_NORMAL
  3310. #define ATTRIBUTES_NEED_TANGENT
  3311. #define SHADERPASS SHADERPASS_DEPTHONLY
  3312. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  3313. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  3314. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  3315. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  3316. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  3317. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  3318. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  3319. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  3320. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  3321. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  3322. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  3323. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  3324. #define ASE_NEEDS_VERT_NORMAL
  3325. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  3326. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  3327. struct Attributes
  3328. {
  3329. float4 positionOS : POSITION;
  3330. float3 normalOS : NORMAL;
  3331. float4 ase_tangent : TANGENT;
  3332. UNITY_VERTEX_INPUT_INSTANCE_ID
  3333. };
  3334. struct PackedVaryings
  3335. {
  3336. float4 positionCS : SV_POSITION;
  3337. UNITY_VERTEX_INPUT_INSTANCE_ID
  3338. UNITY_VERTEX_OUTPUT_STEREO
  3339. };
  3340. CBUFFER_START(UnityPerMaterial)
  3341. float4 _Healthycolor1;
  3342. float4 _Drycolor1;
  3343. float2 _TilingCoverage;
  3344. float2 _TilingDetail;
  3345. float2 _Offset;
  3346. float2 _Tiling;
  3347. float2 _OffsetDetail;
  3348. float _DisplacementAmount;
  3349. float _Float6;
  3350. float _Float4;
  3351. float _NormalBlur;
  3352. float _DetailNormalIntensity;
  3353. float _NormalIntensity;
  3354. float _DryColorOffset;
  3355. float _SlopeMin;
  3356. float _DryColorScale;
  3357. float _CoverageAmount;
  3358. float _MossColor;
  3359. float _Float5;
  3360. float _TSSlopeMax;
  3361. float _TSSlopeMin;
  3362. float _SlopeMax;
  3363. float _CoverageFalloff;
  3364. float _Float7;
  3365. #ifdef ASE_TRANSMISSION
  3366. float _TransmissionShadow;
  3367. #endif
  3368. #ifdef ASE_TRANSLUCENCY
  3369. float _TransStrength;
  3370. float _TransNormal;
  3371. float _TransScattering;
  3372. float _TransDirect;
  3373. float _TransAmbient;
  3374. float _TransShadow;
  3375. #endif
  3376. #ifdef ASE_TESSELLATION
  3377. float _TessPhongStrength;
  3378. float _TessValue;
  3379. float _TessMin;
  3380. float _TessMax;
  3381. float _TessEdgeLength;
  3382. float _TessMaxDisp;
  3383. #endif
  3384. CBUFFER_END
  3385. #ifdef SCENEPICKINGPASS
  3386. float4 _SelectionID;
  3387. #endif
  3388. #ifdef SCENESELECTIONPASS
  3389. int _ObjectId;
  3390. int _PassValue;
  3391. #endif
  3392. sampler2D _CoverageHeight;
  3393. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  3394. {
  3395. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  3396. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  3397. float3 nsign = sign( worldNormal );
  3398. half4 xNorm; half4 yNorm; half4 zNorm;
  3399. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  3400. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  3401. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  3402. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  3403. }
  3404. struct SurfaceDescription
  3405. {
  3406. float Alpha;
  3407. float AlphaClipThreshold;
  3408. };
  3409. PackedVaryings VertexFunction(Attributes input )
  3410. {
  3411. PackedVaryings output;
  3412. ZERO_INITIALIZE(PackedVaryings, output);
  3413. UNITY_SETUP_INSTANCE_ID(input);
  3414. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3415. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  3416. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  3417. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  3418. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  3419. float4 TriplanarHeight355 = triplanar339;
  3420. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  3421. float3 _Tangent = float3(0,1,0);
  3422. float3 ase_worldTangent = TransformObjectToWorldDir(input.ase_tangent.xyz);
  3423. float ase_vertexTangentSign = input.ase_tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  3424. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  3425. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  3426. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  3427. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  3428. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  3429. float3 temp_output_371_0 = abs( ase_worldNormal );
  3430. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  3431. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  3432. float staticSwitch382 = saturate( lerpResult273 );
  3433. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  3434. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  3435. #else
  3436. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  3437. #endif
  3438. float Slope275 = staticSwitch382;
  3439. #ifdef _EDGESLOPETESSELLATION_ON
  3440. float staticSwitch365 = Slope275;
  3441. #else
  3442. float staticSwitch365 = 1.0;
  3443. #endif
  3444. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3445. float3 defaultVertexValue = input.positionOS.xyz;
  3446. #else
  3447. float3 defaultVertexValue = float3(0, 0, 0);
  3448. #endif
  3449. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  3450. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3451. input.positionOS.xyz = vertexValue;
  3452. #else
  3453. input.positionOS.xyz += vertexValue;
  3454. #endif
  3455. input.normalOS = input.normalOS;
  3456. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  3457. output.positionCS = TransformWorldToHClip(positionWS);
  3458. return output;
  3459. }
  3460. #if defined(ASE_TESSELLATION)
  3461. struct VertexControl
  3462. {
  3463. float4 vertex : INTERNALTESSPOS;
  3464. float3 normalOS : NORMAL;
  3465. float4 ase_tangent : TANGENT;
  3466. UNITY_VERTEX_INPUT_INSTANCE_ID
  3467. };
  3468. struct TessellationFactors
  3469. {
  3470. float edge[3] : SV_TessFactor;
  3471. float inside : SV_InsideTessFactor;
  3472. };
  3473. VertexControl vert ( Attributes input )
  3474. {
  3475. VertexControl output;
  3476. UNITY_SETUP_INSTANCE_ID(input);
  3477. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3478. output.vertex = input.positionOS;
  3479. output.normalOS = input.normalOS;
  3480. output.ase_tangent = input.ase_tangent;
  3481. return output;
  3482. }
  3483. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  3484. {
  3485. TessellationFactors output;
  3486. float4 tf = 1;
  3487. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  3488. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  3489. #if defined(ASE_FIXED_TESSELLATION)
  3490. tf = FixedTess( tessValue );
  3491. #elif defined(ASE_DISTANCE_TESSELLATION)
  3492. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  3493. #elif defined(ASE_LENGTH_TESSELLATION)
  3494. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  3495. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  3496. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  3497. #endif
  3498. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  3499. return output;
  3500. }
  3501. [domain("tri")]
  3502. [partitioning("fractional_odd")]
  3503. [outputtopology("triangle_cw")]
  3504. [patchconstantfunc("TessellationFunction")]
  3505. [outputcontrolpoints(3)]
  3506. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  3507. {
  3508. return patch[id];
  3509. }
  3510. [domain("tri")]
  3511. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  3512. {
  3513. Attributes output = (Attributes) 0;
  3514. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  3515. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  3516. output.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  3517. #if defined(ASE_PHONG_TESSELLATION)
  3518. float3 pp[3];
  3519. for (int i = 0; i < 3; ++i)
  3520. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  3521. float phongStrength = _TessPhongStrength;
  3522. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  3523. #endif
  3524. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  3525. return VertexFunction(output);
  3526. }
  3527. #else
  3528. PackedVaryings vert ( Attributes input )
  3529. {
  3530. return VertexFunction( input );
  3531. }
  3532. #endif
  3533. half4 frag(PackedVaryings input ) : SV_TARGET
  3534. {
  3535. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  3536. surfaceDescription.Alpha = 1;
  3537. surfaceDescription.AlphaClipThreshold = 0.5;
  3538. #if _ALPHATEST_ON
  3539. float alphaClipThreshold = 0.01f;
  3540. #if ALPHA_CLIP_THRESHOLD
  3541. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  3542. #endif
  3543. clip(surfaceDescription.Alpha - alphaClipThreshold);
  3544. #endif
  3545. half4 outColor = 0;
  3546. #ifdef SCENESELECTIONPASS
  3547. outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  3548. #elif defined(SCENEPICKINGPASS)
  3549. outColor = _SelectionID;
  3550. #endif
  3551. return outColor;
  3552. }
  3553. ENDHLSL
  3554. }
  3555. Pass
  3556. {
  3557. Name "ScenePickingPass"
  3558. Tags { "LightMode"="Picking" }
  3559. AlphaToMask Off
  3560. HLSLPROGRAM
  3561. #pragma multi_compile_local_fragment _ALPHATEST_ON
  3562. #define _NORMAL_DROPOFF_TS 1
  3563. #define ASE_FOG 1
  3564. #define _NORMALMAP 1
  3565. #define ASE_VERSION 19701
  3566. #define ASE_SRP_VERSION 170003
  3567. #pragma vertex vert
  3568. #pragma fragment frag
  3569. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  3570. #define _SPECULAR_COLOR 1
  3571. #endif
  3572. #define SCENEPICKINGPASS 1
  3573. #define ATTRIBUTES_NEED_NORMAL
  3574. #define ATTRIBUTES_NEED_TANGENT
  3575. #define SHADERPASS SHADERPASS_DEPTHONLY
  3576. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  3577. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  3578. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  3579. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  3580. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  3581. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  3582. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  3583. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  3584. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  3585. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  3586. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  3587. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  3588. #define ASE_NEEDS_VERT_NORMAL
  3589. #pragma shader_feature_local _EDGESLOPETESSELLATION_ON
  3590. #pragma shader_feature_local _SLOPEMODE_TANGENTSLOPETS _SLOPEMODE_TOPDOWNSLOPE
  3591. struct Attributes
  3592. {
  3593. float4 positionOS : POSITION;
  3594. float3 normalOS : NORMAL;
  3595. float4 ase_tangent : TANGENT;
  3596. UNITY_VERTEX_INPUT_INSTANCE_ID
  3597. };
  3598. struct PackedVaryings
  3599. {
  3600. float4 positionCS : SV_POSITION;
  3601. UNITY_VERTEX_INPUT_INSTANCE_ID
  3602. UNITY_VERTEX_OUTPUT_STEREO
  3603. };
  3604. CBUFFER_START(UnityPerMaterial)
  3605. float4 _Healthycolor1;
  3606. float4 _Drycolor1;
  3607. float2 _TilingCoverage;
  3608. float2 _TilingDetail;
  3609. float2 _Offset;
  3610. float2 _Tiling;
  3611. float2 _OffsetDetail;
  3612. float _DisplacementAmount;
  3613. float _Float6;
  3614. float _Float4;
  3615. float _NormalBlur;
  3616. float _DetailNormalIntensity;
  3617. float _NormalIntensity;
  3618. float _DryColorOffset;
  3619. float _SlopeMin;
  3620. float _DryColorScale;
  3621. float _CoverageAmount;
  3622. float _MossColor;
  3623. float _Float5;
  3624. float _TSSlopeMax;
  3625. float _TSSlopeMin;
  3626. float _SlopeMax;
  3627. float _CoverageFalloff;
  3628. float _Float7;
  3629. #ifdef ASE_TRANSMISSION
  3630. float _TransmissionShadow;
  3631. #endif
  3632. #ifdef ASE_TRANSLUCENCY
  3633. float _TransStrength;
  3634. float _TransNormal;
  3635. float _TransScattering;
  3636. float _TransDirect;
  3637. float _TransAmbient;
  3638. float _TransShadow;
  3639. #endif
  3640. #ifdef ASE_TESSELLATION
  3641. float _TessPhongStrength;
  3642. float _TessValue;
  3643. float _TessMin;
  3644. float _TessMax;
  3645. float _TessEdgeLength;
  3646. float _TessMaxDisp;
  3647. #endif
  3648. CBUFFER_END
  3649. #ifdef SCENEPICKINGPASS
  3650. float4 _SelectionID;
  3651. #endif
  3652. #ifdef SCENESELECTIONPASS
  3653. int _ObjectId;
  3654. int _PassValue;
  3655. #endif
  3656. sampler2D _CoverageHeight;
  3657. inline float4 TriplanarSampling339( sampler2D topTexMap, float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )
  3658. {
  3659. float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
  3660. projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
  3661. float3 nsign = sign( worldNormal );
  3662. half4 xNorm; half4 yNorm; half4 zNorm;
  3663. xNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.zy * float2( nsign.x, 1.0 ), 0, 0) );
  3664. yNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xz * float2( nsign.y, 1.0 ), 0, 0) );
  3665. zNorm = tex2Dlod( topTexMap, float4(tiling * worldPos.xy * float2( -nsign.z, 1.0 ), 0, 0) );
  3666. return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;
  3667. }
  3668. struct SurfaceDescription
  3669. {
  3670. float Alpha;
  3671. float AlphaClipThreshold;
  3672. };
  3673. PackedVaryings VertexFunction(Attributes input )
  3674. {
  3675. PackedVaryings output;
  3676. ZERO_INITIALIZE(PackedVaryings, output);
  3677. UNITY_SETUP_INSTANCE_ID(input);
  3678. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3679. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  3680. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  3681. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  3682. float4 triplanar339 = TriplanarSampling339( _CoverageHeight, ase_worldPos, ase_worldNormal, _CoverageFalloff, _TilingCoverage, 1.0, 0 );
  3683. float4 TriplanarHeight355 = triplanar339;
  3684. float temp_output_149_0 = saturate( ( ase_worldNormal.y * _CoverageAmount ) );
  3685. float3 _Tangent = float3(0,1,0);
  3686. float3 ase_worldTangent = TransformObjectToWorldDir(input.ase_tangent.xyz);
  3687. float ase_vertexTangentSign = input.ase_tangent.w * ( unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0 );
  3688. float3 ase_worldBitangent = cross( ase_worldNormal, ase_worldTangent ) * ase_vertexTangentSign;
  3689. float3x3 ase_tangentToWorldFast = float3x3(ase_worldTangent.x,ase_worldBitangent.x,ase_worldNormal.x,ase_worldTangent.y,ase_worldBitangent.y,ase_worldNormal.y,ase_worldTangent.z,ase_worldBitangent.z,ase_worldNormal.z);
  3690. float3 tangentToWorldDir268 = normalize( mul( ase_tangentToWorldFast, _Tangent ) );
  3691. float dotResult269 = dot( tangentToWorldDir268 , _Tangent );
  3692. float lerpResult273 = lerp( _TSSlopeMax , _TSSlopeMin , abs( dotResult269 ));
  3693. float3 temp_output_371_0 = abs( ase_worldNormal );
  3694. float dotResult373 = dot( temp_output_371_0 , float3(1,1,1) );
  3695. #if defined( _SLOPEMODE_TANGENTSLOPETS )
  3696. float staticSwitch382 = saturate( lerpResult273 );
  3697. #elif defined( _SLOPEMODE_TOPDOWNSLOPE )
  3698. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  3699. #else
  3700. float staticSwitch382 = saturate( (( temp_output_371_0 / dotResult373 ).y*_SlopeMax + _SlopeMin) );
  3701. #endif
  3702. float Slope275 = staticSwitch382;
  3703. #ifdef _EDGESLOPETESSELLATION_ON
  3704. float staticSwitch365 = Slope275;
  3705. #else
  3706. float staticSwitch365 = 1.0;
  3707. #endif
  3708. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3709. float3 defaultVertexValue = input.positionOS.xyz;
  3710. #else
  3711. float3 defaultVertexValue = float3(0, 0, 0);
  3712. #endif
  3713. float3 vertexValue = ( ( TriplanarHeight355 * temp_output_149_0 * float4( input.normalOS , 0.0 ) * staticSwitch365 ) * _DisplacementAmount ).xyz;
  3714. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3715. input.positionOS.xyz = vertexValue;
  3716. #else
  3717. input.positionOS.xyz += vertexValue;
  3718. #endif
  3719. input.normalOS = input.normalOS;
  3720. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  3721. output.positionCS = TransformWorldToHClip(positionWS);
  3722. return output;
  3723. }
  3724. #if defined(ASE_TESSELLATION)
  3725. struct VertexControl
  3726. {
  3727. float4 vertex : INTERNALTESSPOS;
  3728. float3 normalOS : NORMAL;
  3729. float4 ase_tangent : TANGENT;
  3730. UNITY_VERTEX_INPUT_INSTANCE_ID
  3731. };
  3732. struct TessellationFactors
  3733. {
  3734. float edge[3] : SV_TessFactor;
  3735. float inside : SV_InsideTessFactor;
  3736. };
  3737. VertexControl vert ( Attributes input )
  3738. {
  3739. VertexControl output;
  3740. UNITY_SETUP_INSTANCE_ID(input);
  3741. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3742. output.vertex = input.positionOS;
  3743. output.normalOS = input.normalOS;
  3744. output.ase_tangent = input.ase_tangent;
  3745. return output;
  3746. }
  3747. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  3748. {
  3749. TessellationFactors output;
  3750. float4 tf = 1;
  3751. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  3752. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  3753. #if defined(ASE_FIXED_TESSELLATION)
  3754. tf = FixedTess( tessValue );
  3755. #elif defined(ASE_DISTANCE_TESSELLATION)
  3756. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  3757. #elif defined(ASE_LENGTH_TESSELLATION)
  3758. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  3759. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  3760. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  3761. #endif
  3762. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  3763. return output;
  3764. }
  3765. [domain("tri")]
  3766. [partitioning("fractional_odd")]
  3767. [outputtopology("triangle_cw")]
  3768. [patchconstantfunc("TessellationFunction")]
  3769. [outputcontrolpoints(3)]
  3770. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  3771. {
  3772. return patch[id];
  3773. }
  3774. [domain("tri")]
  3775. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  3776. {
  3777. Attributes output = (Attributes) 0;
  3778. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  3779. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  3780. output.ase_tangent = patch[0].ase_tangent * bary.x + patch[1].ase_tangent * bary.y + patch[2].ase_tangent * bary.z;
  3781. #if defined(ASE_PHONG_TESSELLATION)
  3782. float3 pp[3];
  3783. for (int i = 0; i < 3; ++i)
  3784. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  3785. float phongStrength = _TessPhongStrength;
  3786. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  3787. #endif
  3788. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  3789. return VertexFunction(output);
  3790. }
  3791. #else
  3792. PackedVaryings vert ( Attributes input )
  3793. {
  3794. return VertexFunction( input );
  3795. }
  3796. #endif
  3797. half4 frag(PackedVaryings input ) : SV_TARGET
  3798. {
  3799. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  3800. surfaceDescription.Alpha = 1;
  3801. surfaceDescription.AlphaClipThreshold = 0.5;
  3802. #if _ALPHATEST_ON
  3803. float alphaClipThreshold = 0.01f;
  3804. #if ALPHA_CLIP_THRESHOLD
  3805. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  3806. #endif
  3807. clip(surfaceDescription.Alpha - alphaClipThreshold);
  3808. #endif
  3809. half4 outColor = 0;
  3810. #ifdef SCENESELECTIONPASS
  3811. outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  3812. #elif defined(SCENEPICKINGPASS)
  3813. outColor = _SelectionID;
  3814. #endif
  3815. return outColor;
  3816. }
  3817. ENDHLSL
  3818. }
  3819. Pass
  3820. {
  3821. Name "MotionVectors"
  3822. Tags { "LightMode"="MotionVectors" }
  3823. ColorMask RG
  3824. HLSLPROGRAM
  3825. #pragma multi_compile_local_fragment _ALPHATEST_ON
  3826. #define _NORMAL_DROPOFF_TS 1
  3827. #pragma multi_compile_instancing
  3828. #pragma multi_compile _ LOD_FADE_CROSSFADE
  3829. #define ASE_FOG 1
  3830. #define _NORMALMAP 1
  3831. #define ASE_VERSION 19701
  3832. #define ASE_SRP_VERSION 170003
  3833. #pragma vertex vert
  3834. #pragma fragment frag
  3835. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  3836. #define _SPECULAR_COLOR 1
  3837. #endif
  3838. #define SHADERPASS SHADERPASS_MOTION_VECTORS
  3839. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  3840. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  3841. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  3842. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  3843. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  3844. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  3845. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  3846. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  3847. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  3848. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  3849. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  3850. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  3851. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  3852. #if defined(LOD_FADE_CROSSFADE)
  3853. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  3854. #endif
  3855. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl"
  3856. struct Attributes
  3857. {
  3858. float4 positionOS : POSITION;
  3859. float3 positionOld : TEXCOORD4;
  3860. #if _ADD_PRECOMPUTED_VELOCITY
  3861. float3 alembicMotionVector : TEXCOORD5;
  3862. #endif
  3863. UNITY_VERTEX_INPUT_INSTANCE_ID
  3864. };
  3865. struct PackedVaryings
  3866. {
  3867. float4 positionCS : SV_POSITION;
  3868. float4 positionCSNoJitter : TEXCOORD0;
  3869. float4 previousPositionCSNoJitter : TEXCOORD1;
  3870. UNITY_VERTEX_INPUT_INSTANCE_ID
  3871. UNITY_VERTEX_OUTPUT_STEREO
  3872. };
  3873. CBUFFER_START(UnityPerMaterial)
  3874. float4 _Healthycolor1;
  3875. float4 _Drycolor1;
  3876. float2 _TilingCoverage;
  3877. float2 _TilingDetail;
  3878. float2 _Offset;
  3879. float2 _Tiling;
  3880. float2 _OffsetDetail;
  3881. float _DisplacementAmount;
  3882. float _Float6;
  3883. float _Float4;
  3884. float _NormalBlur;
  3885. float _DetailNormalIntensity;
  3886. float _NormalIntensity;
  3887. float _DryColorOffset;
  3888. float _SlopeMin;
  3889. float _DryColorScale;
  3890. float _CoverageAmount;
  3891. float _MossColor;
  3892. float _Float5;
  3893. float _TSSlopeMax;
  3894. float _TSSlopeMin;
  3895. float _SlopeMax;
  3896. float _CoverageFalloff;
  3897. float _Float7;
  3898. #ifdef ASE_TRANSMISSION
  3899. float _TransmissionShadow;
  3900. #endif
  3901. #ifdef ASE_TRANSLUCENCY
  3902. float _TransStrength;
  3903. float _TransNormal;
  3904. float _TransScattering;
  3905. float _TransDirect;
  3906. float _TransAmbient;
  3907. float _TransShadow;
  3908. #endif
  3909. #ifdef ASE_TESSELLATION
  3910. float _TessPhongStrength;
  3911. float _TessValue;
  3912. float _TessMin;
  3913. float _TessMax;
  3914. float _TessEdgeLength;
  3915. float _TessMaxDisp;
  3916. #endif
  3917. CBUFFER_END
  3918. #ifdef SCENEPICKINGPASS
  3919. float4 _SelectionID;
  3920. #endif
  3921. #ifdef SCENESELECTIONPASS
  3922. int _ObjectId;
  3923. int _PassValue;
  3924. #endif
  3925. PackedVaryings VertexFunction( Attributes input )
  3926. {
  3927. PackedVaryings output = (PackedVaryings)0;
  3928. UNITY_SETUP_INSTANCE_ID(input);
  3929. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3930. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  3931. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3932. float3 defaultVertexValue = input.positionOS.xyz;
  3933. #else
  3934. float3 defaultVertexValue = float3(0, 0, 0);
  3935. #endif
  3936. float3 vertexValue = defaultVertexValue;
  3937. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3938. input.positionOS.xyz = vertexValue;
  3939. #else
  3940. input.positionOS.xyz += vertexValue;
  3941. #endif
  3942. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  3943. #if defined(APLICATION_SPACE_WARP_MOTION)
  3944. // We do not need jittered position in ASW
  3945. output.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, mul(UNITY_MATRIX_M, input.positionOS));;
  3946. output.positionCS = output.positionCSNoJitter;
  3947. #else
  3948. // Jittered. Match the frame.
  3949. output.positionCS = vertexInput.positionCS;
  3950. output.positionCSNoJitter = mul( _NonJitteredViewProjMatrix, mul( UNITY_MATRIX_M, input.positionOS));
  3951. #endif
  3952. float4 prevPos = ( unity_MotionVectorsParams.x == 1 ) ? float4( input.positionOld, 1 ) : input.positionOS;
  3953. #if _ADD_PRECOMPUTED_VELOCITY
  3954. prevPos = prevPos - float4(input.alembicMotionVector, 0);
  3955. #endif
  3956. output.previousPositionCSNoJitter = mul( _PrevViewProjMatrix, mul( UNITY_PREV_MATRIX_M, prevPos ) );
  3957. // removed in ObjectMotionVectors.hlsl found in unity 6000.0.23 and higher
  3958. //ApplyMotionVectorZBias( output.positionCS );
  3959. return output;
  3960. }
  3961. PackedVaryings vert ( Attributes input )
  3962. {
  3963. return VertexFunction( input );
  3964. }
  3965. half4 frag( PackedVaryings input ) : SV_Target
  3966. {
  3967. UNITY_SETUP_INSTANCE_ID(input);
  3968. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  3969. float Alpha = 1;
  3970. float AlphaClipThreshold = 0.5;
  3971. #ifdef _ALPHATEST_ON
  3972. clip(Alpha - AlphaClipThreshold);
  3973. #endif
  3974. #if defined(LOD_FADE_CROSSFADE)
  3975. LODFadeCrossFade( input.positionCS );
  3976. #endif
  3977. #if defined(APLICATION_SPACE_WARP_MOTION)
  3978. return float4( CalcAswNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 1 );
  3979. #else
  3980. return float4( CalcNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 0, 0 );
  3981. #endif
  3982. }
  3983. ENDHLSL
  3984. }
  3985. }
  3986. CustomEditor "UnityEditor.ShaderGraphLitGUI"
  3987. FallBack "Hidden/Shader Graph/FallbackError"
  3988. Fallback Off
  3989. }
  3990. /*ASEBEGIN
  3991. Version=19701
  3992. Node;AmplifyShaderEditor.CommentaryNode;369;-3104,2624;Inherit;False;1462.355;514.8571;;9;379;378;375;374;373;372;371;370;270;Slope Function v2;0.5490196,0.2196078,0,1;0;0
  3993. Node;AmplifyShaderEditor.CommentaryNode;266;-3056,2080;Inherit;False;1386.182;442.4717;;8;274;273;271;269;268;267;376;377;Slope Function;0.5471698,0.2180016,0,1;0;0
  3994. Node;AmplifyShaderEditor.CommentaryNode;136;-3056,688;Inherit;False;1136.195;1225.845;Comment;18;339;338;296;295;245;244;289;292;258;157;259;155;151;143;146;142;355;394;Triplanar Setup;1,1,1,1;0;0
  3995. Node;AmplifyShaderEditor.CommentaryNode;277;-480,992;Inherit;False;260;163;;1;278;Add Slope;0.5490196,0.2196078,0,1;0;0
  3996. Node;AmplifyShaderEditor.CommentaryNode;347;128,1632;Inherit;False;780.4406;408.0309;;5;351;350;349;348;353;Tessellation_Output;1,1,1,1;0;0
  3997. Node;AmplifyShaderEditor.CommentaryNode;364;-256,1648;Inherit;False;330.8824;193.9432;Turn On/Off Slope;1;365;Slope (Tessellation);1,1,1,1;0;0
  3998. Node;AmplifyShaderEditor.CommentaryNode;135;-2832,256;Inherit;False;698.2522;375.7902;;4;232;147;139;137;Tile UVs;1,1,1,1;0;0
  3999. Node;AmplifyShaderEditor.CommentaryNode;107;-3264,-192;Inherit;False;716.6788;367.6506;;4;231;110;108;109;Tile UVs 2;1,1,1,1;0;0
  4000. Node;AmplifyShaderEditor.CommentaryNode;224;-2512,-736;Inherit;False;1904.817;937.9072;;16;251;248;216;246;252;215;192;211;253;213;212;197;220;218;221;233;Detail Albedo;1,1,1,1;0;0
  4001. Node;AmplifyShaderEditor.CommentaryNode;148;-928,640;Inherit;False;234;206;Main Merged Normal;1;152;;1,1,1,1;0;0
  4002. Node;AmplifyShaderEditor.CommentaryNode;328;-3248,3392;Inherit;False;1588;1122.082;;14;323;320;368;367;327;324;321;316;314;318;317;326;315;312;Moss Color;1,1,1,1;0;0
  4003. Node;AmplifyShaderEditor.CommentaryNode;283;-48,768;Inherit;False;292;187;Turn On/Off Slope;1;276;Slope;1,1,1,1;0;0
  4004. Node;AmplifyShaderEditor.CommentaryNode;176;592,880;Inherit;False;234;206;Smoothness Output;1;180;;1,1,1,1;0;0
  4005. Node;AmplifyShaderEditor.CommentaryNode;177;586.6612,387.9555;Inherit;False;234;206;Albedo Output;1;182;;1,1,1,1;0;0
  4006. Node;AmplifyShaderEditor.CommentaryNode;163;608,1120;Inherit;False;230;183;AO Output;1;293;;1,1,1,1;0;0
  4007. Node;AmplifyShaderEditor.CommentaryNode;255;592,640;Inherit;False;234;206;Normal Map Output;1;196;;1,1,1,1;0;0
  4008. Node;AmplifyShaderEditor.WorldNormalVector;370;-3072,2704;Inherit;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4009. Node;AmplifyShaderEditor.AbsOpNode;371;-2880,2704;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  4010. Node;AmplifyShaderEditor.Vector3Node;372;-3040,2864;Float;False;Constant;_Vector1;Vector 0;-1;0;Create;True;0;0;0;False;0;False;1,1,1;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4011. Node;AmplifyShaderEditor.Vector3Node;267;-3024,2352;Inherit;False;Constant;_Tangent;Tangent;33;0;Create;True;0;0;0;False;0;False;0,1,0;0,1,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4012. Node;AmplifyShaderEditor.DotProductOpNode;373;-2752,2832;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0
  4013. Node;AmplifyShaderEditor.TransformDirectionNode;268;-2832,2208;Inherit;False;Tangent;World;True;Fast;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4014. Node;AmplifyShaderEditor.SimpleDivideOpNode;374;-2624,2720;Inherit;True;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
  4015. Node;AmplifyShaderEditor.DotProductOpNode;269;-2560,2320;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0
  4016. Node;AmplifyShaderEditor.BreakToComponentsNode;375;-2416,2720;Inherit;False;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15
  4017. Node;AmplifyShaderEditor.AbsOpNode;271;-2432,2320;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4018. Node;AmplifyShaderEditor.RangedFloatNode;272;-2576,2944;Inherit;False;Property;_SlopeMax;Slope Max;25;0;Create;True;0;0;0;False;0;False;8;8;0;0;0;1;FLOAT;0
  4019. Node;AmplifyShaderEditor.RangedFloatNode;270;-2560,3024;Inherit;False;Property;_SlopeMin;Slope Min;24;1;[Header];Create;True;1;(Edge Slope);0;0;False;0;False;-1;-8.63;0;0;0;1;FLOAT;0
  4020. Node;AmplifyShaderEditor.RangedFloatNode;377;-2512,2224;Inherit;False;Property;_TSSlopeMin;TS Slope Min;22;1;[Header];Create;True;1;(TS Edge Slope);0;0;False;0;False;-1;-8.63;0;0;0;1;FLOAT;0
  4021. Node;AmplifyShaderEditor.RangedFloatNode;376;-2512,2144;Inherit;False;Property;_TSSlopeMax;TS Slope Max;23;0;Create;True;0;0;0;False;0;False;8;8;0;0;0;1;FLOAT;0
  4022. Node;AmplifyShaderEditor.ScaleAndOffsetNode;378;-2288,2880;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;4;False;2;FLOAT;-1;False;1;FLOAT;0
  4023. Node;AmplifyShaderEditor.LerpOp;273;-2272,2272;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  4024. Node;AmplifyShaderEditor.SaturateNode;379;-2048,2880;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4025. Node;AmplifyShaderEditor.SaturateNode;274;-2096,2352;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4026. Node;AmplifyShaderEditor.RangedFloatNode;143;-3040,1296;Float;False;Property;_CoverageFalloff;Coverage Falloff;36;0;Create;True;0;0;0;False;0;False;20;10;1;20;0;1;FLOAT;0
  4027. Node;AmplifyShaderEditor.Vector2Node;146;-3008,1152;Inherit;False;Property;_TilingCoverage;Tiling Coverage;18;0;Create;True;0;0;0;False;0;False;1,1;0.2,0.2;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
  4028. Node;AmplifyShaderEditor.StaticSwitch;382;-1744,2560;Inherit;False;Property;_SlopeMode;Slope Mode;26;0;Create;True;0;0;0;False;0;False;0;1;1;True;;KeywordEnum;2;TangentSlopeTS;TopDownSlope;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0
  4029. Node;AmplifyShaderEditor.TexturePropertyNode;338;-3008,1600;Float;True;Property;_CoverageHeight;Coverage Height;17;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;None;6a31e0803cb92bb4b838da2b7c50e304;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  4030. Node;AmplifyShaderEditor.WorldNormalVector;140;-1712,624;Inherit;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4031. Node;AmplifyShaderEditor.RangedFloatNode;138;-1792,800;Float;False;Property;_CoverageAmount;Coverage Amount;35;0;Create;True;0;0;0;False;0;False;1;5;0;5;0;1;FLOAT;0
  4032. Node;AmplifyShaderEditor.RegisterLocalVarNode;275;-1424,2560;Inherit;False;Slope;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
  4033. Node;AmplifyShaderEditor.TriplanarNode;339;-2656,1696;Inherit;True;Spherical;World;False;Top Texture 3;_TopTexture3;white;-1;None;Mid Texture 3;_MidTexture3;white;0;None;Bot Texture 3;_BotTexture3;white;1;None;Triplanar Sampler;Tangent;10;0;SAMPLER2D;;False;5;FLOAT;1;False;1;SAMPLER2D;;False;6;FLOAT;0;False;2;SAMPLER2D;;False;7;FLOAT;0;False;9;FLOAT3;0,0,0;False;8;FLOAT;1;False;3;FLOAT2;1,1;False;4;FLOAT;2;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4034. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;145;-1504,704;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  4035. Node;AmplifyShaderEditor.GetLocalVarNode;278;-432,1056;Inherit;False;275;Slope;1;0;OBJECT;;False;1;FLOAT;0
  4036. Node;AmplifyShaderEditor.RegisterLocalVarNode;355;-2240,1696;Inherit;False;TriplanarHeight;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  4037. Node;AmplifyShaderEditor.RangedFloatNode;366;-432,1712;Inherit;False;Constant;_Float1;Float 1;30;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0
  4038. Node;AmplifyShaderEditor.SaturateNode;149;-1328,704;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4039. Node;AmplifyShaderEditor.GetLocalVarNode;353;144,1728;Inherit;False;355;TriplanarHeight;1;0;OBJECT;;False;1;FLOAT4;0
  4040. Node;AmplifyShaderEditor.NormalVertexDataNode;348;160,1824;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4041. Node;AmplifyShaderEditor.StaticSwitch;365;-240,1712;Inherit;False;Property;_EdgeSlopeTessellation;Edge Slope (Tessellation);28;0;Create;True;0;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0
  4042. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;350;432,1744;Inherit;False;4;4;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;1;FLOAT4;0
  4043. Node;AmplifyShaderEditor.RangedFloatNode;349;368,1904;Float;False;Property;_DisplacementAmount;Displacement Amount;34;1;[Header];Create;True;3;_____________________________________________________;Tessellation Settings;(Displacement);0;0;False;0;False;1;0.3;0;1;0;1;FLOAT;0
  4044. Node;AmplifyShaderEditor.Vector2Node;139;-2816,480;Float;False;Property;_Offset;Offset;4;0;Create;True;0;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
  4045. Node;AmplifyShaderEditor.Vector2Node;137;-2800,304;Float;False;Property;_Tiling;Tiling;3;0;Create;True;0;0;0;False;0;False;1,1;0.8,0.4;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
  4046. Node;AmplifyShaderEditor.TextureCoordinatesNode;147;-2608,416;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
  4047. Node;AmplifyShaderEditor.RegisterLocalVarNode;232;-2352,448;Inherit;False;TileUVs;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0
  4048. Node;AmplifyShaderEditor.Vector2Node;108;-3216,32;Float;False;Property;_OffsetDetail;Offset Detail;12;0;Create;True;0;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
  4049. Node;AmplifyShaderEditor.GetLocalVarNode;235;-2096,432;Inherit;False;232;TileUVs;1;0;OBJECT;;False;1;FLOAT2;0
  4050. Node;AmplifyShaderEditor.TexturePropertyNode;142;-2992,928;Float;True;Property;_CoverageNormal;Coverage Normal;15;2;[NoScaleOffset];[Normal];Create;True;0;0;0;False;0;False;None;2ee2a9a8555e7a049a1d43f04e73d779;True;bump;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  4051. Node;AmplifyShaderEditor.Vector2Node;109;-3216,-144;Float;False;Property;_TilingDetail;Tiling Detail;11;0;Create;True;0;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
  4052. Node;AmplifyShaderEditor.TextureCoordinatesNode;110;-3024,-32;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
  4053. Node;AmplifyShaderEditor.TriplanarNode;151;-2672,1104;Inherit;True;Spherical;World;True;Top Texture 1;_TopTexture1;white;-1;None;Mid Texture 1;_MidTexture1;white;-1;None;Bot Texture 1;_BotTexture1;white;-1;None;Triplanar Sampler;Tangent;10;0;SAMPLER2D;;False;5;FLOAT;1;False;1;SAMPLER2D;;False;6;FLOAT;0;False;2;SAMPLER2D;;False;7;FLOAT;0;False;9;FLOAT3;0,0,0;False;8;FLOAT;1;False;3;FLOAT2;1,1;False;4;FLOAT;2;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4054. Node;AmplifyShaderEditor.SamplerNode;150;-1792,432;Inherit;True;Property;_NormalMap;Normal Map;1;2;[NoScaleOffset];[Normal];Create;True;0;0;0;False;0;False;-1;None;8f6c6db1546c4644bbb4771c28b168e7;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
  4055. Node;AmplifyShaderEditor.TexturePropertyNode;155;-2992,736;Float;True;Property;_CoverageAlbedo;Coverage Albedo;14;2;[Header];[NoScaleOffset];Create;True;2;_____________________________________________________;Coverage Texture Maps;0;0;False;0;False;None;a037dc9b503dfcc49a75aef8552932d4;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  4056. Node;AmplifyShaderEditor.RegisterLocalVarNode;231;-2784,32;Inherit;False;TileUVs2;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0
  4057. Node;AmplifyShaderEditor.RegisterLocalVarNode;249;-1456,384;Inherit;False;NormalMapMain;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  4058. Node;AmplifyShaderEditor.RegisterLocalVarNode;259;-2192,1120;Inherit;False;TriplanarNormal;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  4059. Node;AmplifyShaderEditor.TriplanarNode;157;-2704,752;Inherit;True;Spherical;World;False;Top Texture 0;_TopTexture0;white;-1;None;Mid Texture 0;_MidTexture0;white;0;None;Bot Texture 0;_BotTexture0;white;1;None;Triplanar Sampler;Tangent;10;0;SAMPLER2D;;False;5;FLOAT;1;False;1;SAMPLER2D;;False;6;FLOAT;0;False;2;SAMPLER2D;;False;7;FLOAT;0;False;9;FLOAT3;0,0,0;False;8;FLOAT;1;False;3;FLOAT2;1,1;False;4;FLOAT;2;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4060. Node;AmplifyShaderEditor.GetLocalVarNode;233;-2464,-224;Inherit;False;231;TileUVs2;1;0;OBJECT;;False;1;FLOAT2;0
  4061. Node;AmplifyShaderEditor.GetLocalVarNode;254;-1264,576;Inherit;False;249;NormalMapMain;1;0;OBJECT;;False;1;FLOAT3;0
  4062. Node;AmplifyShaderEditor.GetLocalVarNode;263;-1264,464;Inherit;False;259;TriplanarNormal;1;0;OBJECT;;False;1;FLOAT3;0
  4063. Node;AmplifyShaderEditor.RegisterLocalVarNode;258;-2256,752;Inherit;False;TriplanarAlbedo;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  4064. Node;AmplifyShaderEditor.LerpOp;152;-896,688;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
  4065. Node;AmplifyShaderEditor.ColorSpaceDouble;218;-2224,-464;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4066. Node;AmplifyShaderEditor.SamplerNode;220;-2240,-672;Inherit;True;Property;_DetailAlbedo;Detail Albedo;8;2;[Header];[NoScaleOffset];Create;True;2;_____________________________________________________;Detail Texture Maps;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
  4067. Node;AmplifyShaderEditor.RangedFloatNode;197;-2304,64;Inherit;False;Property;_DetailNormalIntensity;Detail Normal Intensity;13;1;[Header];Create;True;2;Detail Texture Settings;(Detail Normal);0;0;False;0;False;1;1;-3;3;0;1;FLOAT;0
  4068. Node;AmplifyShaderEditor.WorldNormalVector;312;-2896,4144;Inherit;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4069. Node;AmplifyShaderEditor.ColorNode;315;-3200,3680;Inherit;False;Property;_Healthycolor1;Healthy color;33;0;Create;True;0;0;0;False;0;False;0.75,0.5608132,0.1544118,0;1,0.7882353,0.6078432,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  4070. Node;AmplifyShaderEditor.GetLocalVarNode;326;-3184,3888;Inherit;False;258;TriplanarAlbedo;1;0;OBJECT;;False;1;FLOAT4;0
  4071. Node;AmplifyShaderEditor.RangedFloatNode;367;-2960,4400;Inherit;False;Property;_DryColorOffset;Dry Color Offset;30;0;Create;True;0;0;0;False;0;False;0;-0.5;0;0;0;1;FLOAT;0
  4072. Node;AmplifyShaderEditor.RangedFloatNode;368;-2944,4320;Inherit;False;Property;_DryColorScale;Dry Color Scale;29;1;[Header];Create;True;1;(Moss Color);0;0;False;0;False;1;1;0;0;0;1;FLOAT;0
  4073. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;212;-1920,-560;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  4074. Node;AmplifyShaderEditor.WireNode;265;-1888,672;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0
  4075. Node;AmplifyShaderEditor.GetLocalVarNode;253;-1952,-112;Inherit;False;249;NormalMapMain;1;0;OBJECT;;False;1;FLOAT3;0
  4076. Node;AmplifyShaderEditor.WorldNormalVector;154;-656,736;Inherit;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4077. Node;AmplifyShaderEditor.SamplerNode;221;-2016,-320;Inherit;True;Property;_DetailMask;Detail Mask;10;1;[NoScaleOffset];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
  4078. Node;AmplifyShaderEditor.SamplerNode;192;-2016,-16;Inherit;True;Property;_DetailNormal;Detail Normal;9;2;[NoScaleOffset];[Normal];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
  4079. Node;AmplifyShaderEditor.SamplerNode;223;-1792,224;Inherit;True;Property;_AlbedoMap;Albedo Map;0;2;[Header];[NoScaleOffset];Create;True;3;______(TFS) Detail Map Coverage (Tessellation)______;_____________________________________________________;Texture Maps;0;0;False;0;False;-1;None;f2144558a11d0ad41b7848feed7df804;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
  4080. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;317;-2896,3712;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0
  4081. Node;AmplifyShaderEditor.ColorSpaceDouble;318;-2912,3936;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4082. Node;AmplifyShaderEditor.ColorNode;314;-3200,3504;Inherit;False;Property;_Drycolor1;Dry color;32;0;Create;True;0;0;0;False;0;False;0.4196078,0.4392157,0.2352941,0;1,1,1,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  4083. Node;AmplifyShaderEditor.ScaleAndOffsetNode;320;-2688,4336;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;1;False;2;FLOAT;-0.5;False;1;FLOAT;0
  4084. Node;AmplifyShaderEditor.OneMinusNode;213;-1664,-224;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4085. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;211;-1664,-416;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  4086. Node;AmplifyShaderEditor.RegisterLocalVarNode;250;-1472,240;Inherit;False;AlbedoMapMain;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0
  4087. Node;AmplifyShaderEditor.WireNode;264;-1888,912;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0
  4088. Node;AmplifyShaderEditor.LerpOp;246;-1680,-96;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
  4089. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;160;-480,832;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  4090. Node;AmplifyShaderEditor.TexturePropertyNode;292;-3008,1392;Float;True;Property;_CoverageMask;Coverage Mask;16;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;None;646bffc65eebeb84a912b553ae3c4a55;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  4091. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;316;-2896,3440;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0
  4092. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;321;-2656,3808;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0
  4093. Node;AmplifyShaderEditor.SaturateNode;323;-2448,4336;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4094. Node;AmplifyShaderEditor.GetLocalVarNode;252;-1264,-96;Inherit;False;250;AlbedoMapMain;1;0;OBJECT;;False;1;COLOR;0
  4095. Node;AmplifyShaderEditor.SimpleAddOpNode;215;-1504,-320;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  4096. Node;AmplifyShaderEditor.TriplanarNode;289;-2656,1328;Inherit;True;Spherical;World;False;Top Texture 2;_TopTexture2;white;-1;None;Mid Texture 2;_MidTexture2;white;-1;None;Bot Texture 2;_BotTexture2;white;-1;None;Triplanar Sampler;Tangent;10;0;SAMPLER2D;;False;5;FLOAT;1;False;1;SAMPLER2D;;False;6;FLOAT;0;False;2;SAMPLER2D;;False;7;FLOAT;0;False;9;FLOAT3;0,0,0;False;8;FLOAT;1;False;3;FLOAT2;1,1;False;4;FLOAT;2;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  4097. Node;AmplifyShaderEditor.SaturateNode;174;-320,848;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4098. Node;AmplifyShaderEditor.SamplerNode;156;-1776,896;Inherit;True;Property;_MaskMapRGBA;Mask Map *RGB(A);2;1;[NoScaleOffset];Create;True;0;0;0;False;0;False;-1;None;6769dcf67ae0e6d479647b0609d231ec;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
  4099. Node;AmplifyShaderEditor.RegisterLocalVarNode;248;-1504,-96;Inherit;False;DetailNormalMap;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  4100. Node;AmplifyShaderEditor.RangedFloatNode;244;-2608,960;Float;False;Property;_Float6;Coverage Smoothness ;19;1;[Header];Create;False;2;Coverage Texture Settings;(Coverage Smoothness);0;0;False;0;False;1;0;0;1;0;1;FLOAT;0
  4101. Node;AmplifyShaderEditor.LerpOp;324;-2224,3776;Inherit;True;3;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT;0;False;1;FLOAT4;0
  4102. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;216;-1024,-224;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  4103. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;245;-2304,928;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  4104. Node;AmplifyShaderEditor.GetLocalVarNode;261;-1248,368;Inherit;False;248;DetailNormalMap;1;0;OBJECT;;False;1;FLOAT3;0
  4105. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;280;-176,976;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  4106. Node;AmplifyShaderEditor.RangedFloatNode;159;-1760,1088;Float;False;Property;_Float4;Smoothness;6;1;[Header];Create;False;1;(Smoothness);0;0;False;0;False;1;1;0;1;0;1;FLOAT;0
  4107. Node;AmplifyShaderEditor.Vector3Node;297;-1216,992;Inherit;False;Constant;_Vector0;Vector 0;28;1;[Header];Create;True;0;0;0;False;0;False;0,0,1;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  4108. Node;AmplifyShaderEditor.RegisterLocalVarNode;327;-1968,3776;Inherit;False;TriplanarMossColor_Output;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  4109. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;179;-1440,1088;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  4110. Node;AmplifyShaderEditor.WireNode;285;-1824,1216;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4111. Node;AmplifyShaderEditor.GetLocalVarNode;262;0,480;Inherit;False;327;TriplanarMossColor_Output;1;0;OBJECT;;False;1;FLOAT4;0
  4112. Node;AmplifyShaderEditor.GetLocalVarNode;329;64,576;Inherit;False;258;TriplanarAlbedo;1;0;OBJECT;;False;1;FLOAT4;0
  4113. Node;AmplifyShaderEditor.BlendNormalsNode;194;-672,224;Inherit;True;0;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0
  4114. Node;AmplifyShaderEditor.StaticSwitch;276;16,816;Inherit;False;Property;_EdgeSlope;Edge Slope;27;0;Create;True;0;0;0;False;0;False;0;0;0;True;;Toggle;2;Key0;Key1;Create;True;True;All;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0
  4115. Node;AmplifyShaderEditor.RangedFloatNode;158;-32,1456;Float;False;Property;_Float5;Ambient Occlusion;7;1;[Header];Create;False;1;(Ambient Occlusion);0;0;False;0;False;1;1;0;1;0;1;FLOAT;0
  4116. Node;AmplifyShaderEditor.RegisterLocalVarNode;251;-848,-224;Inherit;False;DetailAlbedoMap;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0
  4117. Node;AmplifyShaderEditor.ToggleSwitchNode;298;-992,960;Inherit;False;Property;_NormalBlur;Normal Blur;21;0;Create;True;0;0;0;False;0;False;1;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
  4118. Node;AmplifyShaderEditor.RangedFloatNode;295;-2576,1552;Float;False;Property;_Float7;Coverage Ao ;20;1;[Header];Create;False;1;(Coverage Ao);0;0;False;0;False;1;1;0;1;0;1;FLOAT;0
  4119. Node;AmplifyShaderEditor.WireNode;281;-368,1200;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4120. Node;AmplifyShaderEditor.WireNode;282;-384,1248;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4121. Node;AmplifyShaderEditor.WireNode;284;256,672;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4122. Node;AmplifyShaderEditor.PowerNode;178;336,1328;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0
  4123. Node;AmplifyShaderEditor.BlendNormalsNode;168;-656,464;Inherit;True;0;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0
  4124. Node;AmplifyShaderEditor.GetLocalVarNode;256;303.1814,394.8387;Inherit;False;251;DetailAlbedoMap;1;0;OBJECT;;False;1;COLOR;0
  4125. Node;AmplifyShaderEditor.ToggleSwitchNode;330;288,224;Inherit;False;Property;_MossColor;Moss Color;31;0;Create;True;0;0;0;False;0;False;1;True;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  4126. Node;AmplifyShaderEditor.WireNode;300;128,352;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  4127. Node;AmplifyShaderEditor.LerpOp;182;636.6612,437.9536;Inherit;False;3;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT;0;False;1;FLOAT4;0
  4128. Node;AmplifyShaderEditor.LerpOp;293;656,1168;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  4129. Node;AmplifyShaderEditor.LerpOp;196;640,704;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
  4130. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;351;688,1744;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0
  4131. Node;AmplifyShaderEditor.LerpOp;180;656,928;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  4132. Node;AmplifyShaderEditor.AbsOpNode;393;-1440,1440;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4133. Node;AmplifyShaderEditor.AbsOpNode;394;-2256,1392;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  4134. Node;AmplifyShaderEditor.PowerNode;296;-2112,1520;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0
  4135. Node;AmplifyShaderEditor.RangedFloatNode;144;-2096,560;Inherit;False;Property;_NormalIntensity;Normal Intensity;5;1;[Header];Create;True;2;Texture Settings;(Normal);0;0;False;0;False;0.99;0.99;0;0.99;0;1;FLOAT;0
  4136. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;383;926.938,702.4413;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;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;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;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;0;False;False;0;;0;0;Standard;0;False;0
  4137. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;384;926.938,702.4413;Float;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;12;Tobyfredson/Detail Map Coverage (Tessellation);94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;21;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;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;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;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;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;1;0;Alpha Clipping;1;0; Use Shadow Threshold;0;0;Fragment Normal Space,InvertActionOnDeselection;0;0;Forward Only;0;0;Transmission;0;0; Transmission Shadow;0.5,False,;0;Translucency;0;0; Translucency Strength;1,False,;0; Normal Distortion;0.5,False,;0; Scattering;2,False,;0; Direct;0.9,False,;0; Ambient;0.1,False,;0; Shadow;0.5,False,;0;Cast Shadows;1;0;Receive Shadows;1;0;Receive SSAO;1;0;Motion Vectors;1;0; Add Precomputed Velocity;0;0;GPU Instancing;1;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;638537112730726395; Phong;0;0; Strength;0.5,False,;0; Type;1;638537112780881905; 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
  4138. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;385;926.938,702.4413;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;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;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;;0;0;Standard;0;False;0
  4139. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;386;926.938,702.4413;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;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;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;;0;0;Standard;0;False;0
  4140. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;387;926.938,702.4413;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;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;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;;0;0;Standard;0;False;0
  4141. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;388;926.938,702.4413;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;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;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;;0;0;Standard;0;False;0
  4142. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;389;926.938,702.4413;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;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;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;;0;0;Standard;0;False;0
  4143. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;390;926.938,702.4413;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;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;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;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;1;LightMode=UniversalGBuffer;False;False;0;;0;0;Standard;0;False;0
  4144. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;391;926.938,702.4413;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;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;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;;0;0;Standard;0;False;0
  4145. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;392;926.938,702.4413;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;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;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;;0;0;Standard;0;False;0
  4146. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;395;926.938,802.4413;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
  4147. WireConnection;371;0;370;0
  4148. WireConnection;373;0;371;0
  4149. WireConnection;373;1;372;0
  4150. WireConnection;268;0;267;0
  4151. WireConnection;374;0;371;0
  4152. WireConnection;374;1;373;0
  4153. WireConnection;269;0;268;0
  4154. WireConnection;269;1;267;0
  4155. WireConnection;375;0;374;0
  4156. WireConnection;271;0;269;0
  4157. WireConnection;378;0;375;1
  4158. WireConnection;378;1;272;0
  4159. WireConnection;378;2;270;0
  4160. WireConnection;273;0;376;0
  4161. WireConnection;273;1;377;0
  4162. WireConnection;273;2;271;0
  4163. WireConnection;379;0;378;0
  4164. WireConnection;274;0;273;0
  4165. WireConnection;382;1;274;0
  4166. WireConnection;382;0;379;0
  4167. WireConnection;275;0;382;0
  4168. WireConnection;339;0;338;0
  4169. WireConnection;339;3;146;0
  4170. WireConnection;339;4;143;0
  4171. WireConnection;145;0;140;2
  4172. WireConnection;145;1;138;0
  4173. WireConnection;355;0;339;0
  4174. WireConnection;149;0;145;0
  4175. WireConnection;365;1;366;0
  4176. WireConnection;365;0;278;0
  4177. WireConnection;350;0;353;0
  4178. WireConnection;350;1;149;0
  4179. WireConnection;350;2;348;0
  4180. WireConnection;350;3;365;0
  4181. WireConnection;147;0;137;0
  4182. WireConnection;147;1;139;0
  4183. WireConnection;232;0;147;0
  4184. WireConnection;110;0;109;0
  4185. WireConnection;110;1;108;0
  4186. WireConnection;151;0;142;0
  4187. WireConnection;151;3;146;0
  4188. WireConnection;151;4;143;0
  4189. WireConnection;150;1;235;0
  4190. WireConnection;150;5;144;0
  4191. WireConnection;231;0;110;0
  4192. WireConnection;249;0;150;0
  4193. WireConnection;259;0;151;0
  4194. WireConnection;157;0;155;0
  4195. WireConnection;157;3;146;0
  4196. WireConnection;157;4;143;0
  4197. WireConnection;258;0;157;0
  4198. WireConnection;152;0;254;0
  4199. WireConnection;152;1;263;0
  4200. WireConnection;152;2;149;0
  4201. WireConnection;220;1;233;0
  4202. WireConnection;212;0;220;0
  4203. WireConnection;212;1;218;0
  4204. WireConnection;265;0;235;0
  4205. WireConnection;154;0;152;0
  4206. WireConnection;192;1;233;0
  4207. WireConnection;192;5;197;0
  4208. WireConnection;223;1;235;0
  4209. WireConnection;317;0;326;0
  4210. WireConnection;317;1;315;0
  4211. WireConnection;320;0;312;2
  4212. WireConnection;320;1;368;0
  4213. WireConnection;320;2;367;0
  4214. WireConnection;213;0;221;4
  4215. WireConnection;211;0;212;0
  4216. WireConnection;211;1;221;4
  4217. WireConnection;250;0;223;0
  4218. WireConnection;264;0;265;0
  4219. WireConnection;246;0;253;0
  4220. WireConnection;246;1;192;0
  4221. WireConnection;246;2;221;4
  4222. WireConnection;160;0;154;2
  4223. WireConnection;160;1;138;0
  4224. WireConnection;316;0;326;0
  4225. WireConnection;316;1;314;0
  4226. WireConnection;321;0;317;0
  4227. WireConnection;321;1;318;0
  4228. WireConnection;323;0;320;0
  4229. WireConnection;215;0;211;0
  4230. WireConnection;215;1;213;0
  4231. WireConnection;289;0;292;0
  4232. WireConnection;289;3;146;0
  4233. WireConnection;289;4;143;0
  4234. WireConnection;174;0;160;0
  4235. WireConnection;156;1;264;0
  4236. WireConnection;248;0;246;0
  4237. WireConnection;324;0;316;0
  4238. WireConnection;324;1;321;0
  4239. WireConnection;324;2;323;0
  4240. WireConnection;216;0;252;0
  4241. WireConnection;216;1;215;0
  4242. WireConnection;245;0;289;4
  4243. WireConnection;245;1;244;0
  4244. WireConnection;280;0;174;0
  4245. WireConnection;280;1;278;0
  4246. WireConnection;327;0;324;0
  4247. WireConnection;179;0;156;4
  4248. WireConnection;179;1;159;0
  4249. WireConnection;285;0;245;0
  4250. WireConnection;194;0;261;0
  4251. WireConnection;194;1;254;0
  4252. WireConnection;276;1;174;0
  4253. WireConnection;276;0;280;0
  4254. WireConnection;251;0;216;0
  4255. WireConnection;298;0;254;0
  4256. WireConnection;298;1;297;0
  4257. WireConnection;281;0;179;0
  4258. WireConnection;282;0;285;0
  4259. WireConnection;284;0;276;0
  4260. WireConnection;178;0;393;0
  4261. WireConnection;178;1;158;0
  4262. WireConnection;168;0;298;0
  4263. WireConnection;168;1;263;0
  4264. WireConnection;330;0;329;0
  4265. WireConnection;330;1;262;0
  4266. WireConnection;300;0;194;0
  4267. WireConnection;182;0;256;0
  4268. WireConnection;182;1;330;0
  4269. WireConnection;182;2;284;0
  4270. WireConnection;293;0;178;0
  4271. WireConnection;293;1;296;0
  4272. WireConnection;293;2;276;0
  4273. WireConnection;196;0;300;0
  4274. WireConnection;196;1;168;0
  4275. WireConnection;196;2;276;0
  4276. WireConnection;351;0;350;0
  4277. WireConnection;351;1;349;0
  4278. WireConnection;180;0;281;0
  4279. WireConnection;180;1;282;0
  4280. WireConnection;180;2;276;0
  4281. WireConnection;393;0;156;2
  4282. WireConnection;394;0;289;2
  4283. WireConnection;296;0;394;0
  4284. WireConnection;296;1;295;0
  4285. WireConnection;384;0;182;0
  4286. WireConnection;384;1;196;0
  4287. WireConnection;384;4;180;0
  4288. WireConnection;384;5;293;0
  4289. WireConnection;384;8;351;0
  4290. ASEEND*/
  4291. //CHKSM=9CA38FC90387605BD61CA6ADBC48C3BFA56088A4