PT_Water_Shader.shader 205 KB

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