Snow Coverage.shader 183 KB

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