Grass Foliage.shader 220 KB

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