Detail Map Coverage.shader 223 KB

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