Tree Billboard.shader 184 KB

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