WavingDoublePassEdit.shader 153 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994
  1. // Made with Amplify Shader Editor v1.9.7.1
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Hidden/TerrainEngine/Details/WavingDoublePass"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] _AlphaCutoff("Alpha Cutoff ", Range(0, 1)) = 0.5
  8. [HideInInspector] _EmissionColor("Emission Color", Color) = (1,1,1,1)
  9. [HideInInspector][PerRendererData][NoScaleOffset][SingleLineTexture]_MainTex("MainTex", 2D) = "gray" {}
  10. _WavingTint("WavingTint", Color) = (1,1,1,0)
  11. _Gloss("Gloss", Float) = 3
  12. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  13. //_TransmissionShadow( "Transmission Shadow", Range( 0, 1 ) ) = 0.5
  14. //_TransStrength( "Trans Strength", Range( 0, 50 ) ) = 1
  15. //_TransNormal( "Trans Normal Distortion", Range( 0, 1 ) ) = 0.5
  16. //_TransScattering( "Trans Scattering", Range( 1, 50 ) ) = 2
  17. //_TransDirect( "Trans Direct", Range( 0, 1 ) ) = 0.9
  18. //_TransAmbient( "Trans Ambient", Range( 0, 1 ) ) = 0.1
  19. //_TransShadow( "Trans Shadow", Range( 0, 1 ) ) = 0.5
  20. //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
  21. //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
  22. //_TessMin( "Tess Min Distance", Float ) = 10
  23. //_TessMax( "Tess Max Distance", Float ) = 25
  24. //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
  25. //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
  26. [HideInInspector][ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1
  27. [HideInInspector][ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1
  28. [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0
  29. [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0
  30. [HideInInspector] _QueueControl("_QueueControl", Float) = -1
  31. [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
  32. [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
  33. [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
  34. //[HideInInspector][ToggleUI] _AddPrecomputedVelocity("Add Precomputed Velocity", Float) = 1
  35. }
  36. SubShader
  37. {
  38. LOD 0
  39. Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" "UniversalMaterialType"="Lit" }
  40. Cull Off
  41. ZWrite On
  42. ZTest LEqual
  43. Offset 0 , 0
  44. AlphaToMask Off
  45. HLSLINCLUDE
  46. #pragma target 4.5
  47. #pragma prefer_hlslcc gles
  48. // ensure rendering platforms toggle list is visible
  49. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  50. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
  51. #ifndef ASE_TESS_FUNCS
  52. #define ASE_TESS_FUNCS
  53. float4 FixedTess( float tessValue )
  54. {
  55. return tessValue;
  56. }
  57. float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
  58. {
  59. float3 wpos = mul(o2w,vertex).xyz;
  60. float dist = distance (wpos, cameraPos);
  61. float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
  62. return f;
  63. }
  64. float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
  65. {
  66. float4 tess;
  67. tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
  68. tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
  69. tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
  70. tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
  71. return tess;
  72. }
  73. float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
  74. {
  75. float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
  76. float len = distance(wpos0, wpos1);
  77. float f = max(len * scParams.y / (edgeLen * dist), 1.0);
  78. return f;
  79. }
  80. float DistanceFromPlane (float3 pos, float4 plane)
  81. {
  82. float d = dot (float4(pos,1.0f), plane);
  83. return d;
  84. }
  85. bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
  86. {
  87. float4 planeTest;
  88. planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  89. (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  90. (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
  91. planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  92. (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  93. (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
  94. planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  95. (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  96. (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
  97. planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  98. (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  99. (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
  100. return !all (planeTest);
  101. }
  102. float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
  103. {
  104. float3 f;
  105. f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
  106. f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
  107. f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
  108. return CalcTriEdgeTessFactors (f);
  109. }
  110. float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
  111. {
  112. float3 pos0 = mul(o2w,v0).xyz;
  113. float3 pos1 = mul(o2w,v1).xyz;
  114. float3 pos2 = mul(o2w,v2).xyz;
  115. float4 tess;
  116. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  117. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  118. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  119. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  120. return tess;
  121. }
  122. float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
  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. if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
  129. {
  130. tess = 0.0f;
  131. }
  132. else
  133. {
  134. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  135. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  136. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  137. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  138. }
  139. return tess;
  140. }
  141. #endif //ASE_TESS_FUNCS
  142. ENDHLSL
  143. Pass
  144. {
  145. Name "Forward"
  146. Tags { "LightMode"="UniversalForward" }
  147. Blend One Zero, One Zero
  148. ZWrite On
  149. ZTest LEqual
  150. Offset 0 , 0
  151. ColorMask RGBA
  152. HLSLPROGRAM
  153. #pragma multi_compile_local_fragment _ALPHATEST_ON
  154. #define _NORMAL_DROPOFF_TS 1
  155. #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
  156. #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
  157. #pragma multi_compile_instancing
  158. #pragma instancing_options renderinglayer
  159. #pragma multi_compile _ LOD_FADE_CROSSFADE
  160. #pragma multi_compile_fog
  161. #define ASE_FOG 1
  162. #define _SPECULAR_SETUP 1
  163. #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
  164. #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
  165. #define ASE_VERSION 19701
  166. #define ASE_SRP_VERSION 170003
  167. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
  168. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  169. #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
  170. #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
  171. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
  172. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
  173. #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
  174. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  175. #pragma multi_compile _ _LIGHT_LAYERS
  176. #pragma multi_compile_fragment _ _LIGHT_COOKIES
  177. #pragma multi_compile _ _FORWARD_PLUS
  178. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  179. #pragma multi_compile _ SHADOWS_SHADOWMASK
  180. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  181. #pragma multi_compile _ LIGHTMAP_ON
  182. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  183. #pragma multi_compile _ USE_LEGACY_LIGHTMAPS
  184. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  185. #pragma vertex vert
  186. #pragma fragment frag
  187. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  188. #define _SPECULAR_COLOR 1
  189. #endif
  190. #define SHADERPASS SHADERPASS_FORWARD
  191. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  192. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  193. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  194. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  195. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  196. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  197. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  198. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  199. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  200. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  201. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  202. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  203. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  204. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  205. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  206. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  207. #if defined(LOD_FADE_CROSSFADE)
  208. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  209. #endif
  210. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  211. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  212. #endif
  213. #define ASE_NEEDS_FRAG_WORLD_POSITION
  214. #define ASE_NEEDS_FRAG_WORLD_NORMAL
  215. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  216. #define ASE_SV_DEPTH SV_DepthLessEqual
  217. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  218. #else
  219. #define ASE_SV_DEPTH SV_Depth
  220. #define ASE_SV_POSITION_QUALIFIERS
  221. #endif
  222. struct Attributes
  223. {
  224. float4 positionOS : POSITION;
  225. float3 normalOS : NORMAL;
  226. float4 tangentOS : TANGENT;
  227. float4 texcoord : TEXCOORD0;
  228. float4 texcoord1 : TEXCOORD1;
  229. float4 texcoord2 : TEXCOORD2;
  230. UNITY_VERTEX_INPUT_INSTANCE_ID
  231. };
  232. struct PackedVaryings
  233. {
  234. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  235. float4 clipPosV : TEXCOORD0;
  236. float4 lightmapUVOrVertexSH : TEXCOORD1;
  237. half4 fogFactorAndVertexLight : TEXCOORD2;
  238. float4 tSpace0 : TEXCOORD3;
  239. float4 tSpace1 : TEXCOORD4;
  240. float4 tSpace2 : TEXCOORD5;
  241. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  242. float4 shadowCoord : TEXCOORD6;
  243. #endif
  244. #if defined(DYNAMICLIGHTMAP_ON)
  245. float2 dynamicLightmapUV : TEXCOORD7;
  246. #endif
  247. #if defined(USE_APV_PROBE_OCCLUSION)
  248. float4 probeOcclusion : TEXCOORD8;
  249. #endif
  250. float4 ase_texcoord9 : TEXCOORD9;
  251. UNITY_VERTEX_INPUT_INSTANCE_ID
  252. UNITY_VERTEX_OUTPUT_STEREO
  253. };
  254. CBUFFER_START(UnityPerMaterial)
  255. float4 _WavingTint;
  256. float _Gloss;
  257. #ifdef ASE_TRANSMISSION
  258. float _TransmissionShadow;
  259. #endif
  260. #ifdef ASE_TRANSLUCENCY
  261. float _TransStrength;
  262. float _TransNormal;
  263. float _TransScattering;
  264. float _TransDirect;
  265. float _TransAmbient;
  266. float _TransShadow;
  267. #endif
  268. #ifdef ASE_TESSELLATION
  269. float _TessPhongStrength;
  270. float _TessValue;
  271. float _TessMin;
  272. float _TessMax;
  273. float _TessEdgeLength;
  274. float _TessMaxDisp;
  275. #endif
  276. CBUFFER_END
  277. #ifdef SCENEPICKINGPASS
  278. float4 _SelectionID;
  279. #endif
  280. #ifdef SCENESELECTIONPASS
  281. int _ObjectId;
  282. int _PassValue;
  283. #endif
  284. sampler2D _MainTex;
  285. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  286. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  287. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  288. float snoise( float2 v )
  289. {
  290. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  291. float2 i = floor( v + dot( v, C.yy ) );
  292. float2 x0 = v - i + dot( i, C.xx );
  293. float2 i1;
  294. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  295. float4 x12 = x0.xyxy + C.xxzz;
  296. x12.xy -= i1;
  297. i = mod2D289( i );
  298. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  299. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  300. m = m * m;
  301. m = m * m;
  302. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  303. float3 h = abs( x ) - 0.5;
  304. float3 ox = floor( x + 0.5 );
  305. float3 a0 = x - ox;
  306. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  307. float3 g;
  308. g.x = a0.x * x0.x + h.x * x0.y;
  309. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  310. return 130.0 * dot( m, g );
  311. }
  312. PackedVaryings VertexFunction( Attributes input )
  313. {
  314. PackedVaryings output = (PackedVaryings)0;
  315. UNITY_SETUP_INSTANCE_ID(input);
  316. UNITY_TRANSFER_INSTANCE_ID(input, output);
  317. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  318. float2 texCoord120 = input.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  319. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  320. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  321. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  322. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  323. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  324. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  325. output.ase_texcoord9.xy = input.texcoord.xy;
  326. //setting value to unused interpolator channels and avoid initialization warnings
  327. output.ase_texcoord9.zw = 0;
  328. #ifdef ASE_ABSOLUTE_VERTEX_POS
  329. float3 defaultVertexValue = input.positionOS.xyz;
  330. #else
  331. float3 defaultVertexValue = float3(0, 0, 0);
  332. #endif
  333. float3 vertexValue = temp_cast_0;
  334. #ifdef ASE_ABSOLUTE_VERTEX_POS
  335. input.positionOS.xyz = vertexValue;
  336. #else
  337. input.positionOS.xyz += vertexValue;
  338. #endif
  339. input.normalOS = input.normalOS;
  340. input.tangentOS = input.tangentOS;
  341. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  342. VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS );
  343. output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x );
  344. output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y );
  345. output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z );
  346. #if defined(LIGHTMAP_ON)
  347. OUTPUT_LIGHTMAP_UV( input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy );
  348. #endif
  349. #if defined(DYNAMICLIGHTMAP_ON)
  350. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  351. #endif
  352. OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion );
  353. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  354. output.lightmapUVOrVertexSH.zw = input.texcoord.xy;
  355. output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  356. #endif
  357. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  358. #ifdef ASE_FOG
  359. half fogFactor = ComputeFogFactor( vertexInput.positionCS.z );
  360. #else
  361. half fogFactor = 0;
  362. #endif
  363. output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
  364. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  365. output.shadowCoord = GetShadowCoord( vertexInput );
  366. #endif
  367. output.positionCS = vertexInput.positionCS;
  368. output.clipPosV = vertexInput.positionCS;
  369. return output;
  370. }
  371. #if defined(ASE_TESSELLATION)
  372. struct VertexControl
  373. {
  374. float4 vertex : INTERNALTESSPOS;
  375. float3 normalOS : NORMAL;
  376. float4 tangentOS : TANGENT;
  377. float4 texcoord : TEXCOORD0;
  378. float4 texcoord1 : TEXCOORD1;
  379. float4 texcoord2 : TEXCOORD2;
  380. UNITY_VERTEX_INPUT_INSTANCE_ID
  381. };
  382. struct TessellationFactors
  383. {
  384. float edge[3] : SV_TessFactor;
  385. float inside : SV_InsideTessFactor;
  386. };
  387. VertexControl vert ( Attributes input )
  388. {
  389. VertexControl output;
  390. UNITY_SETUP_INSTANCE_ID(input);
  391. UNITY_TRANSFER_INSTANCE_ID(input, output);
  392. output.vertex = input.positionOS;
  393. output.normalOS = input.normalOS;
  394. output.tangentOS = input.tangentOS;
  395. output.texcoord = input.texcoord;
  396. output.texcoord1 = input.texcoord1;
  397. output.texcoord2 = input.texcoord2;
  398. return output;
  399. }
  400. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  401. {
  402. TessellationFactors output;
  403. float4 tf = 1;
  404. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  405. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  406. #if defined(ASE_FIXED_TESSELLATION)
  407. tf = FixedTess( tessValue );
  408. #elif defined(ASE_DISTANCE_TESSELLATION)
  409. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  410. #elif defined(ASE_LENGTH_TESSELLATION)
  411. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  412. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  413. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  414. #endif
  415. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  416. return output;
  417. }
  418. [domain("tri")]
  419. [partitioning("fractional_odd")]
  420. [outputtopology("triangle_cw")]
  421. [patchconstantfunc("TessellationFunction")]
  422. [outputcontrolpoints(3)]
  423. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  424. {
  425. return patch[id];
  426. }
  427. [domain("tri")]
  428. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  429. {
  430. Attributes output = (Attributes) 0;
  431. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  432. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  433. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  434. output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  435. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  436. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  437. #if defined(ASE_PHONG_TESSELLATION)
  438. float3 pp[3];
  439. for (int i = 0; i < 3; ++i)
  440. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  441. float phongStrength = _TessPhongStrength;
  442. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  443. #endif
  444. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  445. return VertexFunction(output);
  446. }
  447. #else
  448. PackedVaryings vert ( Attributes input )
  449. {
  450. return VertexFunction( input );
  451. }
  452. #endif
  453. half4 frag ( PackedVaryings input
  454. #ifdef ASE_DEPTH_WRITE_ON
  455. ,out float outputDepth : ASE_SV_DEPTH
  456. #endif
  457. #ifdef _WRITE_RENDERING_LAYERS
  458. , out float4 outRenderingLayers : SV_Target1
  459. #endif
  460. ) : SV_Target
  461. {
  462. UNITY_SETUP_INSTANCE_ID(input);
  463. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  464. #if defined(LOD_FADE_CROSSFADE)
  465. LODFadeCrossFade( input.positionCS );
  466. #endif
  467. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  468. float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  469. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  470. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  471. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  472. #else
  473. float3 WorldNormal = normalize( input.tSpace0.xyz );
  474. float3 WorldTangent = input.tSpace1.xyz;
  475. float3 WorldBiTangent = input.tSpace2.xyz;
  476. #endif
  477. float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w);
  478. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  479. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  480. float4 ClipPos = input.clipPosV;
  481. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  482. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  483. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  484. ShadowCoords = input.shadowCoord;
  485. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  486. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  487. #endif
  488. WorldViewDirection = SafeNormalize( WorldViewDirection );
  489. float2 uv_MainTex124 = input.ase_texcoord9.xy;
  490. float4 tex2DNode124 = tex2D( _MainTex, uv_MainTex124 );
  491. float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - WorldPosition );
  492. float3 ase_viewDirWS = normalize( ase_viewVectorWS );
  493. float dotResult171 = dot( ase_viewDirWS , -( _MainLightPosition.xyz + ( WorldNormal * 1.0 ) ) );
  494. float fresnelNdotV176 = dot( WorldNormal, ase_viewDirWS );
  495. float fresnelNode176 = ( 0.5 + 3.0 * pow( max( 1.0 - fresnelNdotV176 , 0.0001 ), 8.58 ) );
  496. float grayscale138 = Luminance(abs( tex2DNode124 ).rgb);
  497. float3 BaseColor = ( ( tex2DNode124 * ( saturate( dotResult171 ) * ( tex2DNode124 * fresnelNode176 ) ) ) + ( _WavingTint * tex2DNode124 ) ).rgb;
  498. float3 Normal = float3(0, 0, 1);
  499. float3 Emission = 0;
  500. float3 Specular = 0.5;
  501. float Metallic = 0;
  502. float Smoothness = ( grayscale138 * _Gloss );
  503. float Occlusion = 1;
  504. float Alpha = 1;
  505. float AlphaClipThreshold = 0.5;
  506. float AlphaClipThresholdShadow = 0.5;
  507. float3 BakedGI = 0;
  508. float3 RefractionColor = 1;
  509. float RefractionIndex = 1;
  510. float3 Transmission = 1;
  511. float3 Translucency = 1;
  512. #ifdef ASE_DEPTH_WRITE_ON
  513. float DepthValue = input.positionCS.z;
  514. #endif
  515. #ifdef _CLEARCOAT
  516. float CoatMask = 0;
  517. float CoatSmoothness = 0;
  518. #endif
  519. #ifdef _ALPHATEST_ON
  520. clip(Alpha - AlphaClipThreshold);
  521. #endif
  522. InputData inputData = (InputData)0;
  523. inputData.positionWS = WorldPosition;
  524. inputData.positionCS = input.positionCS;
  525. inputData.viewDirectionWS = WorldViewDirection;
  526. #ifdef _NORMALMAP
  527. #if _NORMAL_DROPOFF_TS
  528. inputData.normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent, WorldBiTangent, WorldNormal));
  529. #elif _NORMAL_DROPOFF_OS
  530. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  531. #elif _NORMAL_DROPOFF_WS
  532. inputData.normalWS = Normal;
  533. #endif
  534. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  535. #else
  536. inputData.normalWS = WorldNormal;
  537. #endif
  538. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  539. inputData.shadowCoord = ShadowCoords;
  540. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  541. inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
  542. #else
  543. inputData.shadowCoord = float4(0, 0, 0, 0);
  544. #endif
  545. #ifdef ASE_FOG
  546. inputData.fogCoord = input.fogFactorAndVertexLight.x;
  547. #endif
  548. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  549. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  550. float3 SH = SampleSH(inputData.normalWS.xyz);
  551. #else
  552. float3 SH = input.lightmapUVOrVertexSH.xyz;
  553. #endif
  554. #if defined(DYNAMICLIGHTMAP_ON)
  555. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS);
  556. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  557. #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
  558. inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS),
  559. inputData.normalWS,
  560. inputData.viewDirectionWS,
  561. input.positionCS.xy,
  562. input.probeOcclusion,
  563. inputData.shadowMask );
  564. #else
  565. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
  566. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  567. #endif
  568. #ifdef ASE_BAKEDGI
  569. inputData.bakedGI = BakedGI;
  570. #endif
  571. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  572. #if defined(DEBUG_DISPLAY)
  573. #if defined(DYNAMICLIGHTMAP_ON)
  574. inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
  575. #endif
  576. #if defined(LIGHTMAP_ON)
  577. inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy;
  578. #else
  579. inputData.vertexSH = SH;
  580. #endif
  581. #if defined(USE_APV_PROBE_OCCLUSION)
  582. inputData.probeOcclusion = input.probeOcclusion;
  583. #endif
  584. #endif
  585. SurfaceData surfaceData;
  586. surfaceData.albedo = BaseColor;
  587. surfaceData.metallic = saturate(Metallic);
  588. surfaceData.specular = Specular;
  589. surfaceData.smoothness = saturate(Smoothness),
  590. surfaceData.occlusion = Occlusion,
  591. surfaceData.emission = Emission,
  592. surfaceData.alpha = saturate(Alpha);
  593. surfaceData.normalTS = Normal;
  594. surfaceData.clearCoatMask = 0;
  595. surfaceData.clearCoatSmoothness = 1;
  596. #ifdef _CLEARCOAT
  597. surfaceData.clearCoatMask = saturate(CoatMask);
  598. surfaceData.clearCoatSmoothness = saturate(CoatSmoothness);
  599. #endif
  600. #ifdef _DBUFFER
  601. ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
  602. #endif
  603. #ifdef _ASE_LIGHTING_SIMPLE
  604. half4 color = UniversalFragmentBlinnPhong( inputData, surfaceData);
  605. #else
  606. half4 color = UniversalFragmentPBR( inputData, surfaceData);
  607. #endif
  608. #ifdef ASE_TRANSMISSION
  609. {
  610. float shadow = _TransmissionShadow;
  611. #define SUM_LIGHT_TRANSMISSION(Light)\
  612. float3 atten = Light.color * Light.distanceAttenuation;\
  613. atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\
  614. half3 transmission = max( 0, -dot( inputData.normalWS, Light.direction ) ) * atten * Transmission;\
  615. color.rgb += BaseColor * transmission;
  616. SUM_LIGHT_TRANSMISSION( GetMainLight( inputData.shadowCoord ) );
  617. #if defined(_ADDITIONAL_LIGHTS)
  618. uint meshRenderingLayers = GetMeshRenderingLayer();
  619. uint pixelLightCount = GetAdditionalLightsCount();
  620. #if USE_FORWARD_PLUS
  621. [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
  622. {
  623. FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
  624. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  625. #ifdef _LIGHT_LAYERS
  626. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  627. #endif
  628. {
  629. SUM_LIGHT_TRANSMISSION( light );
  630. }
  631. }
  632. #endif
  633. LIGHT_LOOP_BEGIN( pixelLightCount )
  634. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  635. #ifdef _LIGHT_LAYERS
  636. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  637. #endif
  638. {
  639. SUM_LIGHT_TRANSMISSION( light );
  640. }
  641. LIGHT_LOOP_END
  642. #endif
  643. }
  644. #endif
  645. #ifdef ASE_TRANSLUCENCY
  646. {
  647. float shadow = _TransShadow;
  648. float normal = _TransNormal;
  649. float scattering = _TransScattering;
  650. float direct = _TransDirect;
  651. float ambient = _TransAmbient;
  652. float strength = _TransStrength;
  653. #define SUM_LIGHT_TRANSLUCENCY(Light)\
  654. float3 atten = Light.color * Light.distanceAttenuation;\
  655. atten = lerp( atten, atten * Light.shadowAttenuation, shadow );\
  656. half3 lightDir = Light.direction + inputData.normalWS * normal;\
  657. half VdotL = pow( saturate( dot( inputData.viewDirectionWS, -lightDir ) ), scattering );\
  658. half3 translucency = atten * ( VdotL * direct + inputData.bakedGI * ambient ) * Translucency;\
  659. color.rgb += BaseColor * translucency * strength;
  660. SUM_LIGHT_TRANSLUCENCY( GetMainLight( inputData.shadowCoord ) );
  661. #if defined(_ADDITIONAL_LIGHTS)
  662. uint meshRenderingLayers = GetMeshRenderingLayer();
  663. uint pixelLightCount = GetAdditionalLightsCount();
  664. #if USE_FORWARD_PLUS
  665. [loop] for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
  666. {
  667. FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
  668. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  669. #ifdef _LIGHT_LAYERS
  670. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  671. #endif
  672. {
  673. SUM_LIGHT_TRANSLUCENCY( light );
  674. }
  675. }
  676. #endif
  677. LIGHT_LOOP_BEGIN( pixelLightCount )
  678. Light light = GetAdditionalLight(lightIndex, inputData.positionWS, inputData.shadowMask);
  679. #ifdef _LIGHT_LAYERS
  680. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
  681. #endif
  682. {
  683. SUM_LIGHT_TRANSLUCENCY( light );
  684. }
  685. LIGHT_LOOP_END
  686. #endif
  687. }
  688. #endif
  689. #ifdef ASE_REFRACTION
  690. float4 projScreenPos = ScreenPos / ScreenPos.w;
  691. float3 refractionOffset = ( RefractionIndex - 1.0 ) * mul( UNITY_MATRIX_V, float4( WorldNormal,0 ) ).xyz * ( 1.0 - dot( WorldNormal, WorldViewDirection ) );
  692. projScreenPos.xy += refractionOffset.xy;
  693. float3 refraction = SHADERGRAPH_SAMPLE_SCENE_COLOR( projScreenPos.xy ) * RefractionColor;
  694. color.rgb = lerp( refraction, color.rgb, color.a );
  695. color.a = 1;
  696. #endif
  697. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  698. color.rgb *= color.a;
  699. #endif
  700. #ifdef ASE_FOG
  701. #ifdef TERRAIN_SPLAT_ADDPASS
  702. color.rgb = MixFogColor(color.rgb, half3( 0, 0, 0 ), input.fogFactorAndVertexLight.x );
  703. #else
  704. color.rgb = MixFog(color.rgb, input.fogFactorAndVertexLight.x);
  705. #endif
  706. #endif
  707. #ifdef ASE_DEPTH_WRITE_ON
  708. outputDepth = DepthValue;
  709. #endif
  710. #ifdef _WRITE_RENDERING_LAYERS
  711. uint renderingLayers = GetMeshRenderingLayer();
  712. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  713. #endif
  714. return color;
  715. }
  716. ENDHLSL
  717. }
  718. Pass
  719. {
  720. Name "ShadowCaster"
  721. Tags { "LightMode"="ShadowCaster" }
  722. ZWrite On
  723. ZTest LEqual
  724. AlphaToMask Off
  725. ColorMask 0
  726. HLSLPROGRAM
  727. #pragma multi_compile_local_fragment _ALPHATEST_ON
  728. #define _NORMAL_DROPOFF_TS 1
  729. #pragma multi_compile_instancing
  730. #pragma multi_compile _ LOD_FADE_CROSSFADE
  731. #define ASE_FOG 1
  732. #define _SPECULAR_SETUP 1
  733. #define ASE_VERSION 19701
  734. #define ASE_SRP_VERSION 170003
  735. #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
  736. #pragma vertex vert
  737. #pragma fragment frag
  738. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  739. #define _SPECULAR_COLOR 1
  740. #endif
  741. #define SHADERPASS SHADERPASS_SHADOWCASTER
  742. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  743. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  744. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  745. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  746. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  747. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  748. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  749. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  750. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  751. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  752. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  753. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  754. #if defined(LOD_FADE_CROSSFADE)
  755. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  756. #endif
  757. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  758. #define ASE_SV_DEPTH SV_DepthLessEqual
  759. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  760. #else
  761. #define ASE_SV_DEPTH SV_Depth
  762. #define ASE_SV_POSITION_QUALIFIERS
  763. #endif
  764. struct Attributes
  765. {
  766. float4 positionOS : POSITION;
  767. float3 normalOS : NORMAL;
  768. float4 ase_texcoord : TEXCOORD0;
  769. UNITY_VERTEX_INPUT_INSTANCE_ID
  770. };
  771. struct PackedVaryings
  772. {
  773. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  774. float4 clipPosV : TEXCOORD0;
  775. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  776. float3 positionWS : TEXCOORD1;
  777. #endif
  778. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  779. float4 shadowCoord : TEXCOORD2;
  780. #endif
  781. UNITY_VERTEX_INPUT_INSTANCE_ID
  782. UNITY_VERTEX_OUTPUT_STEREO
  783. };
  784. CBUFFER_START(UnityPerMaterial)
  785. float4 _WavingTint;
  786. float _Gloss;
  787. #ifdef ASE_TRANSMISSION
  788. float _TransmissionShadow;
  789. #endif
  790. #ifdef ASE_TRANSLUCENCY
  791. float _TransStrength;
  792. float _TransNormal;
  793. float _TransScattering;
  794. float _TransDirect;
  795. float _TransAmbient;
  796. float _TransShadow;
  797. #endif
  798. #ifdef ASE_TESSELLATION
  799. float _TessPhongStrength;
  800. float _TessValue;
  801. float _TessMin;
  802. float _TessMax;
  803. float _TessEdgeLength;
  804. float _TessMaxDisp;
  805. #endif
  806. CBUFFER_END
  807. #ifdef SCENEPICKINGPASS
  808. float4 _SelectionID;
  809. #endif
  810. #ifdef SCENESELECTIONPASS
  811. int _ObjectId;
  812. int _PassValue;
  813. #endif
  814. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  815. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  816. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  817. float snoise( float2 v )
  818. {
  819. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  820. float2 i = floor( v + dot( v, C.yy ) );
  821. float2 x0 = v - i + dot( i, C.xx );
  822. float2 i1;
  823. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  824. float4 x12 = x0.xyxy + C.xxzz;
  825. x12.xy -= i1;
  826. i = mod2D289( i );
  827. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  828. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  829. m = m * m;
  830. m = m * m;
  831. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  832. float3 h = abs( x ) - 0.5;
  833. float3 ox = floor( x + 0.5 );
  834. float3 a0 = x - ox;
  835. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  836. float3 g;
  837. g.x = a0.x * x0.x + h.x * x0.y;
  838. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  839. return 130.0 * dot( m, g );
  840. }
  841. float3 _LightDirection;
  842. float3 _LightPosition;
  843. PackedVaryings VertexFunction( Attributes input )
  844. {
  845. PackedVaryings output;
  846. UNITY_SETUP_INSTANCE_ID(input);
  847. UNITY_TRANSFER_INSTANCE_ID(input, output);
  848. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
  849. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  850. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  851. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  852. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  853. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  854. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  855. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  856. #ifdef ASE_ABSOLUTE_VERTEX_POS
  857. float3 defaultVertexValue = input.positionOS.xyz;
  858. #else
  859. float3 defaultVertexValue = float3(0, 0, 0);
  860. #endif
  861. float3 vertexValue = temp_cast_0;
  862. #ifdef ASE_ABSOLUTE_VERTEX_POS
  863. input.positionOS.xyz = vertexValue;
  864. #else
  865. input.positionOS.xyz += vertexValue;
  866. #endif
  867. input.normalOS = input.normalOS;
  868. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  869. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  870. output.positionWS = positionWS;
  871. #endif
  872. float3 normalWS = TransformObjectToWorldDir(input.normalOS);
  873. #if _CASTING_PUNCTUAL_LIGHT_SHADOW
  874. float3 lightDirectionWS = normalize(_LightPosition - positionWS);
  875. #else
  876. float3 lightDirectionWS = _LightDirection;
  877. #endif
  878. float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
  879. //code for UNITY_REVERSED_Z is moved into Shadows.hlsl from 6000.0.22 and or higher
  880. positionCS = ApplyShadowClamping(positionCS);
  881. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  882. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  883. vertexInput.positionWS = positionWS;
  884. vertexInput.positionCS = positionCS;
  885. output.shadowCoord = GetShadowCoord( vertexInput );
  886. #endif
  887. output.positionCS = positionCS;
  888. output.clipPosV = positionCS;
  889. return output;
  890. }
  891. #if defined(ASE_TESSELLATION)
  892. struct VertexControl
  893. {
  894. float4 vertex : INTERNALTESSPOS;
  895. float3 normalOS : NORMAL;
  896. float4 ase_texcoord : TEXCOORD0;
  897. UNITY_VERTEX_INPUT_INSTANCE_ID
  898. };
  899. struct TessellationFactors
  900. {
  901. float edge[3] : SV_TessFactor;
  902. float inside : SV_InsideTessFactor;
  903. };
  904. VertexControl vert ( Attributes input )
  905. {
  906. VertexControl output;
  907. UNITY_SETUP_INSTANCE_ID(input);
  908. UNITY_TRANSFER_INSTANCE_ID(input, output);
  909. output.vertex = input.positionOS;
  910. output.normalOS = input.normalOS;
  911. output.ase_texcoord = input.ase_texcoord;
  912. return output;
  913. }
  914. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  915. {
  916. TessellationFactors output;
  917. float4 tf = 1;
  918. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  919. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  920. #if defined(ASE_FIXED_TESSELLATION)
  921. tf = FixedTess( tessValue );
  922. #elif defined(ASE_DISTANCE_TESSELLATION)
  923. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  924. #elif defined(ASE_LENGTH_TESSELLATION)
  925. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  926. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  927. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  928. #endif
  929. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  930. return output;
  931. }
  932. [domain("tri")]
  933. [partitioning("fractional_odd")]
  934. [outputtopology("triangle_cw")]
  935. [patchconstantfunc("TessellationFunction")]
  936. [outputcontrolpoints(3)]
  937. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  938. {
  939. return patch[id];
  940. }
  941. [domain("tri")]
  942. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  943. {
  944. Attributes output = (Attributes) 0;
  945. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  946. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  947. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  948. #if defined(ASE_PHONG_TESSELLATION)
  949. float3 pp[3];
  950. for (int i = 0; i < 3; ++i)
  951. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  952. float phongStrength = _TessPhongStrength;
  953. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  954. #endif
  955. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  956. return VertexFunction(output);
  957. }
  958. #else
  959. PackedVaryings vert ( Attributes input )
  960. {
  961. return VertexFunction( input );
  962. }
  963. #endif
  964. half4 frag( PackedVaryings input
  965. #ifdef ASE_DEPTH_WRITE_ON
  966. ,out float outputDepth : ASE_SV_DEPTH
  967. #endif
  968. ) : SV_TARGET
  969. {
  970. UNITY_SETUP_INSTANCE_ID( input );
  971. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  972. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  973. float3 WorldPosition = input.positionWS;
  974. #endif
  975. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  976. float4 ClipPos = input.clipPosV;
  977. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  978. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  979. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  980. ShadowCoords = input.shadowCoord;
  981. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  982. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  983. #endif
  984. #endif
  985. float Alpha = 1;
  986. float AlphaClipThreshold = 0.5;
  987. float AlphaClipThresholdShadow = 0.5;
  988. #ifdef ASE_DEPTH_WRITE_ON
  989. float DepthValue = input.positionCS.z;
  990. #endif
  991. #ifdef _ALPHATEST_ON
  992. #ifdef _ALPHATEST_SHADOW_ON
  993. clip(Alpha - AlphaClipThresholdShadow);
  994. #else
  995. clip(Alpha - AlphaClipThreshold);
  996. #endif
  997. #endif
  998. #if defined(LOD_FADE_CROSSFADE)
  999. LODFadeCrossFade( input.positionCS );
  1000. #endif
  1001. #ifdef ASE_DEPTH_WRITE_ON
  1002. outputDepth = DepthValue;
  1003. #endif
  1004. return 0;
  1005. }
  1006. ENDHLSL
  1007. }
  1008. Pass
  1009. {
  1010. Name "DepthOnly"
  1011. Tags { "LightMode"="DepthOnly" }
  1012. ZWrite On
  1013. ColorMask 0
  1014. AlphaToMask Off
  1015. HLSLPROGRAM
  1016. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1017. #define _NORMAL_DROPOFF_TS 1
  1018. #pragma multi_compile_instancing
  1019. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1020. #define ASE_FOG 1
  1021. #define _SPECULAR_SETUP 1
  1022. #define ASE_VERSION 19701
  1023. #define ASE_SRP_VERSION 170003
  1024. #pragma vertex vert
  1025. #pragma fragment frag
  1026. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1027. #define _SPECULAR_COLOR 1
  1028. #endif
  1029. #define SHADERPASS SHADERPASS_DEPTHONLY
  1030. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  1031. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1032. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1033. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1034. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1035. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1036. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1037. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1038. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1039. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1040. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1041. #if defined(LOD_FADE_CROSSFADE)
  1042. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  1043. #endif
  1044. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  1045. #define ASE_SV_DEPTH SV_DepthLessEqual
  1046. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  1047. #else
  1048. #define ASE_SV_DEPTH SV_Depth
  1049. #define ASE_SV_POSITION_QUALIFIERS
  1050. #endif
  1051. struct Attributes
  1052. {
  1053. float4 positionOS : POSITION;
  1054. float3 normalOS : NORMAL;
  1055. float4 ase_texcoord : TEXCOORD0;
  1056. UNITY_VERTEX_INPUT_INSTANCE_ID
  1057. };
  1058. struct PackedVaryings
  1059. {
  1060. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  1061. float4 clipPosV : TEXCOORD0;
  1062. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1063. float3 positionWS : TEXCOORD1;
  1064. #endif
  1065. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1066. float4 shadowCoord : TEXCOORD2;
  1067. #endif
  1068. UNITY_VERTEX_INPUT_INSTANCE_ID
  1069. UNITY_VERTEX_OUTPUT_STEREO
  1070. };
  1071. CBUFFER_START(UnityPerMaterial)
  1072. float4 _WavingTint;
  1073. float _Gloss;
  1074. #ifdef ASE_TRANSMISSION
  1075. float _TransmissionShadow;
  1076. #endif
  1077. #ifdef ASE_TRANSLUCENCY
  1078. float _TransStrength;
  1079. float _TransNormal;
  1080. float _TransScattering;
  1081. float _TransDirect;
  1082. float _TransAmbient;
  1083. float _TransShadow;
  1084. #endif
  1085. #ifdef ASE_TESSELLATION
  1086. float _TessPhongStrength;
  1087. float _TessValue;
  1088. float _TessMin;
  1089. float _TessMax;
  1090. float _TessEdgeLength;
  1091. float _TessMaxDisp;
  1092. #endif
  1093. CBUFFER_END
  1094. #ifdef SCENEPICKINGPASS
  1095. float4 _SelectionID;
  1096. #endif
  1097. #ifdef SCENESELECTIONPASS
  1098. int _ObjectId;
  1099. int _PassValue;
  1100. #endif
  1101. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1102. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1103. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  1104. float snoise( float2 v )
  1105. {
  1106. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  1107. float2 i = floor( v + dot( v, C.yy ) );
  1108. float2 x0 = v - i + dot( i, C.xx );
  1109. float2 i1;
  1110. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  1111. float4 x12 = x0.xyxy + C.xxzz;
  1112. x12.xy -= i1;
  1113. i = mod2D289( i );
  1114. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  1115. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  1116. m = m * m;
  1117. m = m * m;
  1118. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  1119. float3 h = abs( x ) - 0.5;
  1120. float3 ox = floor( x + 0.5 );
  1121. float3 a0 = x - ox;
  1122. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  1123. float3 g;
  1124. g.x = a0.x * x0.x + h.x * x0.y;
  1125. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  1126. return 130.0 * dot( m, g );
  1127. }
  1128. PackedVaryings VertexFunction( Attributes input )
  1129. {
  1130. PackedVaryings output = (PackedVaryings)0;
  1131. UNITY_SETUP_INSTANCE_ID(input);
  1132. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1133. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1134. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  1135. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1136. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  1137. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  1138. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  1139. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  1140. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  1141. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1142. float3 defaultVertexValue = input.positionOS.xyz;
  1143. #else
  1144. float3 defaultVertexValue = float3(0, 0, 0);
  1145. #endif
  1146. float3 vertexValue = temp_cast_0;
  1147. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1148. input.positionOS.xyz = vertexValue;
  1149. #else
  1150. input.positionOS.xyz += vertexValue;
  1151. #endif
  1152. input.normalOS = input.normalOS;
  1153. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1154. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1155. output.positionWS = vertexInput.positionWS;
  1156. #endif
  1157. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1158. output.shadowCoord = GetShadowCoord( vertexInput );
  1159. #endif
  1160. output.positionCS = vertexInput.positionCS;
  1161. output.clipPosV = vertexInput.positionCS;
  1162. return output;
  1163. }
  1164. #if defined(ASE_TESSELLATION)
  1165. struct VertexControl
  1166. {
  1167. float4 vertex : INTERNALTESSPOS;
  1168. float3 normalOS : NORMAL;
  1169. float4 ase_texcoord : TEXCOORD0;
  1170. UNITY_VERTEX_INPUT_INSTANCE_ID
  1171. };
  1172. struct TessellationFactors
  1173. {
  1174. float edge[3] : SV_TessFactor;
  1175. float inside : SV_InsideTessFactor;
  1176. };
  1177. VertexControl vert ( Attributes input )
  1178. {
  1179. VertexControl output;
  1180. UNITY_SETUP_INSTANCE_ID(input);
  1181. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1182. output.vertex = input.positionOS;
  1183. output.normalOS = input.normalOS;
  1184. output.ase_texcoord = input.ase_texcoord;
  1185. return output;
  1186. }
  1187. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1188. {
  1189. TessellationFactors output;
  1190. float4 tf = 1;
  1191. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1192. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1193. #if defined(ASE_FIXED_TESSELLATION)
  1194. tf = FixedTess( tessValue );
  1195. #elif defined(ASE_DISTANCE_TESSELLATION)
  1196. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1197. #elif defined(ASE_LENGTH_TESSELLATION)
  1198. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1199. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1200. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1201. #endif
  1202. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1203. return output;
  1204. }
  1205. [domain("tri")]
  1206. [partitioning("fractional_odd")]
  1207. [outputtopology("triangle_cw")]
  1208. [patchconstantfunc("TessellationFunction")]
  1209. [outputcontrolpoints(3)]
  1210. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1211. {
  1212. return patch[id];
  1213. }
  1214. [domain("tri")]
  1215. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1216. {
  1217. Attributes output = (Attributes) 0;
  1218. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1219. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1220. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1221. #if defined(ASE_PHONG_TESSELLATION)
  1222. float3 pp[3];
  1223. for (int i = 0; i < 3; ++i)
  1224. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1225. float phongStrength = _TessPhongStrength;
  1226. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1227. #endif
  1228. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1229. return VertexFunction(output);
  1230. }
  1231. #else
  1232. PackedVaryings vert ( Attributes input )
  1233. {
  1234. return VertexFunction( input );
  1235. }
  1236. #endif
  1237. half4 frag( PackedVaryings input
  1238. #ifdef ASE_DEPTH_WRITE_ON
  1239. ,out float outputDepth : ASE_SV_DEPTH
  1240. #endif
  1241. ) : SV_TARGET
  1242. {
  1243. UNITY_SETUP_INSTANCE_ID(input);
  1244. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1245. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1246. float3 WorldPosition = input.positionWS;
  1247. #endif
  1248. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1249. float4 ClipPos = input.clipPosV;
  1250. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  1251. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1252. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1253. ShadowCoords = input.shadowCoord;
  1254. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1255. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1256. #endif
  1257. #endif
  1258. float Alpha = 1;
  1259. float AlphaClipThreshold = 0.5;
  1260. #ifdef ASE_DEPTH_WRITE_ON
  1261. float DepthValue = input.positionCS.z;
  1262. #endif
  1263. #ifdef _ALPHATEST_ON
  1264. clip(Alpha - AlphaClipThreshold);
  1265. #endif
  1266. #if defined(LOD_FADE_CROSSFADE)
  1267. LODFadeCrossFade( input.positionCS );
  1268. #endif
  1269. #ifdef ASE_DEPTH_WRITE_ON
  1270. outputDepth = DepthValue;
  1271. #endif
  1272. return 0;
  1273. }
  1274. ENDHLSL
  1275. }
  1276. Pass
  1277. {
  1278. Name "Meta"
  1279. Tags { "LightMode"="Meta" }
  1280. Cull Off
  1281. HLSLPROGRAM
  1282. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1283. #define _NORMAL_DROPOFF_TS 1
  1284. #define ASE_FOG 1
  1285. #define _SPECULAR_SETUP 1
  1286. #define ASE_VERSION 19701
  1287. #define ASE_SRP_VERSION 170003
  1288. #pragma shader_feature EDITOR_VISUALIZATION
  1289. #pragma vertex vert
  1290. #pragma fragment frag
  1291. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1292. #define _SPECULAR_COLOR 1
  1293. #endif
  1294. #define SHADERPASS SHADERPASS_META
  1295. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1296. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1297. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1298. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1299. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1300. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1301. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1302. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1303. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1304. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1305. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
  1306. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1307. #define ASE_NEEDS_FRAG_WORLD_POSITION
  1308. #define ASE_NEEDS_VERT_NORMAL
  1309. struct Attributes
  1310. {
  1311. float4 positionOS : POSITION;
  1312. float3 normalOS : NORMAL;
  1313. float4 texcoord0 : TEXCOORD0;
  1314. float4 texcoord1 : TEXCOORD1;
  1315. float4 texcoord2 : TEXCOORD2;
  1316. UNITY_VERTEX_INPUT_INSTANCE_ID
  1317. };
  1318. struct PackedVaryings
  1319. {
  1320. float4 positionCS : SV_POSITION;
  1321. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1322. float3 positionWS : TEXCOORD0;
  1323. #endif
  1324. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1325. float4 shadowCoord : TEXCOORD1;
  1326. #endif
  1327. #ifdef EDITOR_VISUALIZATION
  1328. float4 VizUV : TEXCOORD2;
  1329. float4 LightCoord : TEXCOORD3;
  1330. #endif
  1331. float4 ase_texcoord4 : TEXCOORD4;
  1332. float4 ase_texcoord5 : TEXCOORD5;
  1333. UNITY_VERTEX_INPUT_INSTANCE_ID
  1334. UNITY_VERTEX_OUTPUT_STEREO
  1335. };
  1336. CBUFFER_START(UnityPerMaterial)
  1337. float4 _WavingTint;
  1338. float _Gloss;
  1339. #ifdef ASE_TRANSMISSION
  1340. float _TransmissionShadow;
  1341. #endif
  1342. #ifdef ASE_TRANSLUCENCY
  1343. float _TransStrength;
  1344. float _TransNormal;
  1345. float _TransScattering;
  1346. float _TransDirect;
  1347. float _TransAmbient;
  1348. float _TransShadow;
  1349. #endif
  1350. #ifdef ASE_TESSELLATION
  1351. float _TessPhongStrength;
  1352. float _TessValue;
  1353. float _TessMin;
  1354. float _TessMax;
  1355. float _TessEdgeLength;
  1356. float _TessMaxDisp;
  1357. #endif
  1358. CBUFFER_END
  1359. #ifdef SCENEPICKINGPASS
  1360. float4 _SelectionID;
  1361. #endif
  1362. #ifdef SCENESELECTIONPASS
  1363. int _ObjectId;
  1364. int _PassValue;
  1365. #endif
  1366. sampler2D _MainTex;
  1367. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1368. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1369. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  1370. float snoise( float2 v )
  1371. {
  1372. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  1373. float2 i = floor( v + dot( v, C.yy ) );
  1374. float2 x0 = v - i + dot( i, C.xx );
  1375. float2 i1;
  1376. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  1377. float4 x12 = x0.xyxy + C.xxzz;
  1378. x12.xy -= i1;
  1379. i = mod2D289( i );
  1380. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  1381. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  1382. m = m * m;
  1383. m = m * m;
  1384. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  1385. float3 h = abs( x ) - 0.5;
  1386. float3 ox = floor( x + 0.5 );
  1387. float3 a0 = x - ox;
  1388. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  1389. float3 g;
  1390. g.x = a0.x * x0.x + h.x * x0.y;
  1391. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  1392. return 130.0 * dot( m, g );
  1393. }
  1394. PackedVaryings VertexFunction( Attributes input )
  1395. {
  1396. PackedVaryings output = (PackedVaryings)0;
  1397. UNITY_SETUP_INSTANCE_ID(input);
  1398. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1399. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1400. float2 texCoord120 = input.texcoord0.xy * float2( 1,1 ) + float2( 0,0 );
  1401. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1402. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  1403. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  1404. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  1405. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  1406. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  1407. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  1408. output.ase_texcoord5.xyz = ase_worldNormal;
  1409. output.ase_texcoord4.xy = input.texcoord0.xy;
  1410. //setting value to unused interpolator channels and avoid initialization warnings
  1411. output.ase_texcoord4.zw = 0;
  1412. output.ase_texcoord5.w = 0;
  1413. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1414. float3 defaultVertexValue = input.positionOS.xyz;
  1415. #else
  1416. float3 defaultVertexValue = float3(0, 0, 0);
  1417. #endif
  1418. float3 vertexValue = temp_cast_0;
  1419. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1420. input.positionOS.xyz = vertexValue;
  1421. #else
  1422. input.positionOS.xyz += vertexValue;
  1423. #endif
  1424. input.normalOS = input.normalOS;
  1425. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  1426. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1427. output.positionWS = positionWS;
  1428. #endif
  1429. output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST );
  1430. #ifdef EDITOR_VISUALIZATION
  1431. float2 VizUV = 0;
  1432. float4 LightCoord = 0;
  1433. UnityEditorVizData(input.positionOS.xyz, input.texcoord0.xy, input.texcoord1.xy, input.texcoord2.xy, VizUV, LightCoord);
  1434. output.VizUV = float4(VizUV, 0, 0);
  1435. output.LightCoord = LightCoord;
  1436. #endif
  1437. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1438. VertexPositionInputs vertexInput = (VertexPositionInputs)0;
  1439. vertexInput.positionWS = positionWS;
  1440. vertexInput.positionCS = output.positionCS;
  1441. output.shadowCoord = GetShadowCoord( vertexInput );
  1442. #endif
  1443. return output;
  1444. }
  1445. #if defined(ASE_TESSELLATION)
  1446. struct VertexControl
  1447. {
  1448. float4 vertex : INTERNALTESSPOS;
  1449. float3 normalOS : NORMAL;
  1450. float4 texcoord0 : TEXCOORD0;
  1451. float4 texcoord1 : TEXCOORD1;
  1452. float4 texcoord2 : TEXCOORD2;
  1453. UNITY_VERTEX_INPUT_INSTANCE_ID
  1454. };
  1455. struct TessellationFactors
  1456. {
  1457. float edge[3] : SV_TessFactor;
  1458. float inside : SV_InsideTessFactor;
  1459. };
  1460. VertexControl vert ( Attributes input )
  1461. {
  1462. VertexControl output;
  1463. UNITY_SETUP_INSTANCE_ID(input);
  1464. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1465. output.vertex = input.positionOS;
  1466. output.normalOS = input.normalOS;
  1467. output.texcoord0 = input.texcoord0;
  1468. output.texcoord1 = input.texcoord1;
  1469. output.texcoord2 = input.texcoord2;
  1470. return output;
  1471. }
  1472. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1473. {
  1474. TessellationFactors output;
  1475. float4 tf = 1;
  1476. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1477. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1478. #if defined(ASE_FIXED_TESSELLATION)
  1479. tf = FixedTess( tessValue );
  1480. #elif defined(ASE_DISTANCE_TESSELLATION)
  1481. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1482. #elif defined(ASE_LENGTH_TESSELLATION)
  1483. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1484. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1485. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1486. #endif
  1487. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1488. return output;
  1489. }
  1490. [domain("tri")]
  1491. [partitioning("fractional_odd")]
  1492. [outputtopology("triangle_cw")]
  1493. [patchconstantfunc("TessellationFunction")]
  1494. [outputcontrolpoints(3)]
  1495. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1496. {
  1497. return patch[id];
  1498. }
  1499. [domain("tri")]
  1500. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1501. {
  1502. Attributes output = (Attributes) 0;
  1503. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1504. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1505. output.texcoord0 = patch[0].texcoord0 * bary.x + patch[1].texcoord0 * bary.y + patch[2].texcoord0 * bary.z;
  1506. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  1507. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  1508. #if defined(ASE_PHONG_TESSELLATION)
  1509. float3 pp[3];
  1510. for (int i = 0; i < 3; ++i)
  1511. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1512. float phongStrength = _TessPhongStrength;
  1513. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1514. #endif
  1515. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1516. return VertexFunction(output);
  1517. }
  1518. #else
  1519. PackedVaryings vert ( Attributes input )
  1520. {
  1521. return VertexFunction( input );
  1522. }
  1523. #endif
  1524. half4 frag(PackedVaryings input ) : SV_TARGET
  1525. {
  1526. UNITY_SETUP_INSTANCE_ID(input);
  1527. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1528. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1529. float3 WorldPosition = input.positionWS;
  1530. #endif
  1531. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1532. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1533. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1534. ShadowCoords = input.shadowCoord;
  1535. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1536. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1537. #endif
  1538. #endif
  1539. float2 uv_MainTex124 = input.ase_texcoord4.xy;
  1540. float4 tex2DNode124 = tex2D( _MainTex, uv_MainTex124 );
  1541. float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - WorldPosition );
  1542. float3 ase_viewDirWS = normalize( ase_viewVectorWS );
  1543. float3 ase_worldNormal = input.ase_texcoord5.xyz;
  1544. float dotResult171 = dot( ase_viewDirWS , -( _MainLightPosition.xyz + ( ase_worldNormal * 1.0 ) ) );
  1545. float fresnelNdotV176 = dot( ase_worldNormal, ase_viewDirWS );
  1546. float fresnelNode176 = ( 0.5 + 3.0 * pow( max( 1.0 - fresnelNdotV176 , 0.0001 ), 8.58 ) );
  1547. float3 BaseColor = ( ( tex2DNode124 * ( saturate( dotResult171 ) * ( tex2DNode124 * fresnelNode176 ) ) ) + ( _WavingTint * tex2DNode124 ) ).rgb;
  1548. float3 Emission = 0;
  1549. float Alpha = 1;
  1550. float AlphaClipThreshold = 0.5;
  1551. #ifdef _ALPHATEST_ON
  1552. clip(Alpha - AlphaClipThreshold);
  1553. #endif
  1554. MetaInput metaInput = (MetaInput)0;
  1555. metaInput.Albedo = BaseColor;
  1556. metaInput.Emission = Emission;
  1557. #ifdef EDITOR_VISUALIZATION
  1558. metaInput.VizUV = input.VizUV.xy;
  1559. metaInput.LightCoord = input.LightCoord;
  1560. #endif
  1561. return UnityMetaFragment(metaInput);
  1562. }
  1563. ENDHLSL
  1564. }
  1565. Pass
  1566. {
  1567. Name "Universal2D"
  1568. Tags { "LightMode"="Universal2D" }
  1569. Blend One Zero, One Zero
  1570. ZWrite On
  1571. ZTest LEqual
  1572. Offset 0 , 0
  1573. ColorMask RGBA
  1574. HLSLPROGRAM
  1575. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1576. #define _NORMAL_DROPOFF_TS 1
  1577. #define ASE_FOG 1
  1578. #define _SPECULAR_SETUP 1
  1579. #define ASE_VERSION 19701
  1580. #define ASE_SRP_VERSION 170003
  1581. #pragma vertex vert
  1582. #pragma fragment frag
  1583. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1584. #define _SPECULAR_COLOR 1
  1585. #endif
  1586. #define SHADERPASS SHADERPASS_2D
  1587. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1588. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1589. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1590. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1591. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1592. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1593. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1594. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1595. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1596. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1597. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1598. #define ASE_NEEDS_FRAG_WORLD_POSITION
  1599. #define ASE_NEEDS_VERT_NORMAL
  1600. struct Attributes
  1601. {
  1602. float4 positionOS : POSITION;
  1603. float3 normalOS : NORMAL;
  1604. float4 ase_texcoord : TEXCOORD0;
  1605. UNITY_VERTEX_INPUT_INSTANCE_ID
  1606. };
  1607. struct PackedVaryings
  1608. {
  1609. float4 positionCS : SV_POSITION;
  1610. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1611. float3 positionWS : TEXCOORD0;
  1612. #endif
  1613. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1614. float4 shadowCoord : TEXCOORD1;
  1615. #endif
  1616. float4 ase_texcoord2 : TEXCOORD2;
  1617. float4 ase_texcoord3 : TEXCOORD3;
  1618. UNITY_VERTEX_INPUT_INSTANCE_ID
  1619. UNITY_VERTEX_OUTPUT_STEREO
  1620. };
  1621. CBUFFER_START(UnityPerMaterial)
  1622. float4 _WavingTint;
  1623. float _Gloss;
  1624. #ifdef ASE_TRANSMISSION
  1625. float _TransmissionShadow;
  1626. #endif
  1627. #ifdef ASE_TRANSLUCENCY
  1628. float _TransStrength;
  1629. float _TransNormal;
  1630. float _TransScattering;
  1631. float _TransDirect;
  1632. float _TransAmbient;
  1633. float _TransShadow;
  1634. #endif
  1635. #ifdef ASE_TESSELLATION
  1636. float _TessPhongStrength;
  1637. float _TessValue;
  1638. float _TessMin;
  1639. float _TessMax;
  1640. float _TessEdgeLength;
  1641. float _TessMaxDisp;
  1642. #endif
  1643. CBUFFER_END
  1644. #ifdef SCENEPICKINGPASS
  1645. float4 _SelectionID;
  1646. #endif
  1647. #ifdef SCENESELECTIONPASS
  1648. int _ObjectId;
  1649. int _PassValue;
  1650. #endif
  1651. sampler2D _MainTex;
  1652. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1653. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1654. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  1655. float snoise( float2 v )
  1656. {
  1657. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  1658. float2 i = floor( v + dot( v, C.yy ) );
  1659. float2 x0 = v - i + dot( i, C.xx );
  1660. float2 i1;
  1661. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  1662. float4 x12 = x0.xyxy + C.xxzz;
  1663. x12.xy -= i1;
  1664. i = mod2D289( i );
  1665. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  1666. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  1667. m = m * m;
  1668. m = m * m;
  1669. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  1670. float3 h = abs( x ) - 0.5;
  1671. float3 ox = floor( x + 0.5 );
  1672. float3 a0 = x - ox;
  1673. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  1674. float3 g;
  1675. g.x = a0.x * x0.x + h.x * x0.y;
  1676. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  1677. return 130.0 * dot( m, g );
  1678. }
  1679. PackedVaryings VertexFunction( Attributes input )
  1680. {
  1681. PackedVaryings output = (PackedVaryings)0;
  1682. UNITY_SETUP_INSTANCE_ID( input );
  1683. UNITY_TRANSFER_INSTANCE_ID( input, output );
  1684. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
  1685. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  1686. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1687. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  1688. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  1689. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  1690. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  1691. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  1692. float3 ase_worldNormal = TransformObjectToWorldNormal(input.normalOS);
  1693. output.ase_texcoord3.xyz = ase_worldNormal;
  1694. output.ase_texcoord2.xy = input.ase_texcoord.xy;
  1695. //setting value to unused interpolator channels and avoid initialization warnings
  1696. output.ase_texcoord2.zw = 0;
  1697. output.ase_texcoord3.w = 0;
  1698. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1699. float3 defaultVertexValue = input.positionOS.xyz;
  1700. #else
  1701. float3 defaultVertexValue = float3(0, 0, 0);
  1702. #endif
  1703. float3 vertexValue = temp_cast_0;
  1704. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1705. input.positionOS.xyz = vertexValue;
  1706. #else
  1707. input.positionOS.xyz += vertexValue;
  1708. #endif
  1709. input.normalOS = input.normalOS;
  1710. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1711. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1712. output.positionWS = vertexInput.positionWS;
  1713. #endif
  1714. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1715. output.shadowCoord = GetShadowCoord( vertexInput );
  1716. #endif
  1717. output.positionCS = vertexInput.positionCS;
  1718. return output;
  1719. }
  1720. #if defined(ASE_TESSELLATION)
  1721. struct VertexControl
  1722. {
  1723. float4 vertex : INTERNALTESSPOS;
  1724. float3 normalOS : NORMAL;
  1725. float4 ase_texcoord : TEXCOORD0;
  1726. UNITY_VERTEX_INPUT_INSTANCE_ID
  1727. };
  1728. struct TessellationFactors
  1729. {
  1730. float edge[3] : SV_TessFactor;
  1731. float inside : SV_InsideTessFactor;
  1732. };
  1733. VertexControl vert ( Attributes input )
  1734. {
  1735. VertexControl output;
  1736. UNITY_SETUP_INSTANCE_ID(input);
  1737. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1738. output.vertex = input.positionOS;
  1739. output.normalOS = input.normalOS;
  1740. output.ase_texcoord = input.ase_texcoord;
  1741. return output;
  1742. }
  1743. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1744. {
  1745. TessellationFactors output;
  1746. float4 tf = 1;
  1747. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1748. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1749. #if defined(ASE_FIXED_TESSELLATION)
  1750. tf = FixedTess( tessValue );
  1751. #elif defined(ASE_DISTANCE_TESSELLATION)
  1752. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1753. #elif defined(ASE_LENGTH_TESSELLATION)
  1754. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1755. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1756. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1757. #endif
  1758. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1759. return output;
  1760. }
  1761. [domain("tri")]
  1762. [partitioning("fractional_odd")]
  1763. [outputtopology("triangle_cw")]
  1764. [patchconstantfunc("TessellationFunction")]
  1765. [outputcontrolpoints(3)]
  1766. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1767. {
  1768. return patch[id];
  1769. }
  1770. [domain("tri")]
  1771. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1772. {
  1773. Attributes output = (Attributes) 0;
  1774. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  1775. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1776. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1777. #if defined(ASE_PHONG_TESSELLATION)
  1778. float3 pp[3];
  1779. for (int i = 0; i < 3; ++i)
  1780. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  1781. float phongStrength = _TessPhongStrength;
  1782. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1783. #endif
  1784. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1785. return VertexFunction(output);
  1786. }
  1787. #else
  1788. PackedVaryings vert ( Attributes input )
  1789. {
  1790. return VertexFunction( input );
  1791. }
  1792. #endif
  1793. half4 frag(PackedVaryings input ) : SV_TARGET
  1794. {
  1795. UNITY_SETUP_INSTANCE_ID( input );
  1796. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1797. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1798. float3 WorldPosition = input.positionWS;
  1799. #endif
  1800. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  1801. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1802. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  1803. ShadowCoords = input.shadowCoord;
  1804. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  1805. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  1806. #endif
  1807. #endif
  1808. float2 uv_MainTex124 = input.ase_texcoord2.xy;
  1809. float4 tex2DNode124 = tex2D( _MainTex, uv_MainTex124 );
  1810. float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - WorldPosition );
  1811. float3 ase_viewDirWS = normalize( ase_viewVectorWS );
  1812. float3 ase_worldNormal = input.ase_texcoord3.xyz;
  1813. float dotResult171 = dot( ase_viewDirWS , -( _MainLightPosition.xyz + ( ase_worldNormal * 1.0 ) ) );
  1814. float fresnelNdotV176 = dot( ase_worldNormal, ase_viewDirWS );
  1815. float fresnelNode176 = ( 0.5 + 3.0 * pow( max( 1.0 - fresnelNdotV176 , 0.0001 ), 8.58 ) );
  1816. float3 BaseColor = ( ( tex2DNode124 * ( saturate( dotResult171 ) * ( tex2DNode124 * fresnelNode176 ) ) ) + ( _WavingTint * tex2DNode124 ) ).rgb;
  1817. float Alpha = 1;
  1818. float AlphaClipThreshold = 0.5;
  1819. half4 color = half4(BaseColor, Alpha );
  1820. #ifdef _ALPHATEST_ON
  1821. clip(Alpha - AlphaClipThreshold);
  1822. #endif
  1823. return color;
  1824. }
  1825. ENDHLSL
  1826. }
  1827. Pass
  1828. {
  1829. Name "DepthNormals"
  1830. Tags { "LightMode"="DepthNormals" }
  1831. ZWrite On
  1832. Blend One Zero
  1833. ZTest LEqual
  1834. ZWrite On
  1835. HLSLPROGRAM
  1836. #pragma multi_compile_local_fragment _ALPHATEST_ON
  1837. #define _NORMAL_DROPOFF_TS 1
  1838. #pragma multi_compile_instancing
  1839. #pragma multi_compile _ LOD_FADE_CROSSFADE
  1840. #define ASE_FOG 1
  1841. #define _SPECULAR_SETUP 1
  1842. #define ASE_VERSION 19701
  1843. #define ASE_SRP_VERSION 170003
  1844. #pragma vertex vert
  1845. #pragma fragment frag
  1846. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  1847. #define _SPECULAR_COLOR 1
  1848. #endif
  1849. #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
  1850. //#define SHADERPASS SHADERPASS_DEPTHNORMALS
  1851. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  1852. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  1853. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1854. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1855. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1856. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1857. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  1858. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1859. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1860. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  1861. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  1862. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1863. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1864. #if defined(LOD_FADE_CROSSFADE)
  1865. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  1866. #endif
  1867. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  1868. #define ASE_SV_DEPTH SV_DepthLessEqual
  1869. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  1870. #else
  1871. #define ASE_SV_DEPTH SV_Depth
  1872. #define ASE_SV_POSITION_QUALIFIERS
  1873. #endif
  1874. struct Attributes
  1875. {
  1876. float4 positionOS : POSITION;
  1877. float3 normalOS : NORMAL;
  1878. float4 tangentOS : TANGENT;
  1879. float4 ase_texcoord : TEXCOORD0;
  1880. UNITY_VERTEX_INPUT_INSTANCE_ID
  1881. };
  1882. struct PackedVaryings
  1883. {
  1884. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  1885. float4 clipPosV : TEXCOORD0;
  1886. float3 worldNormal : TEXCOORD1;
  1887. float4 worldTangent : TEXCOORD2;
  1888. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1889. float3 positionWS : TEXCOORD3;
  1890. #endif
  1891. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1892. float4 shadowCoord : TEXCOORD4;
  1893. #endif
  1894. UNITY_VERTEX_INPUT_INSTANCE_ID
  1895. UNITY_VERTEX_OUTPUT_STEREO
  1896. };
  1897. CBUFFER_START(UnityPerMaterial)
  1898. float4 _WavingTint;
  1899. float _Gloss;
  1900. #ifdef ASE_TRANSMISSION
  1901. float _TransmissionShadow;
  1902. #endif
  1903. #ifdef ASE_TRANSLUCENCY
  1904. float _TransStrength;
  1905. float _TransNormal;
  1906. float _TransScattering;
  1907. float _TransDirect;
  1908. float _TransAmbient;
  1909. float _TransShadow;
  1910. #endif
  1911. #ifdef ASE_TESSELLATION
  1912. float _TessPhongStrength;
  1913. float _TessValue;
  1914. float _TessMin;
  1915. float _TessMax;
  1916. float _TessEdgeLength;
  1917. float _TessMaxDisp;
  1918. #endif
  1919. CBUFFER_END
  1920. #ifdef SCENEPICKINGPASS
  1921. float4 _SelectionID;
  1922. #endif
  1923. #ifdef SCENESELECTIONPASS
  1924. int _ObjectId;
  1925. int _PassValue;
  1926. #endif
  1927. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1928. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1929. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  1930. float snoise( float2 v )
  1931. {
  1932. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  1933. float2 i = floor( v + dot( v, C.yy ) );
  1934. float2 x0 = v - i + dot( i, C.xx );
  1935. float2 i1;
  1936. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  1937. float4 x12 = x0.xyxy + C.xxzz;
  1938. x12.xy -= i1;
  1939. i = mod2D289( i );
  1940. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  1941. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  1942. m = m * m;
  1943. m = m * m;
  1944. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  1945. float3 h = abs( x ) - 0.5;
  1946. float3 ox = floor( x + 0.5 );
  1947. float3 a0 = x - ox;
  1948. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  1949. float3 g;
  1950. g.x = a0.x * x0.x + h.x * x0.y;
  1951. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  1952. return 130.0 * dot( m, g );
  1953. }
  1954. PackedVaryings VertexFunction( Attributes input )
  1955. {
  1956. PackedVaryings output = (PackedVaryings)0;
  1957. UNITY_SETUP_INSTANCE_ID(input);
  1958. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1959. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1960. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  1961. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  1962. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  1963. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  1964. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  1965. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  1966. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  1967. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1968. float3 defaultVertexValue = input.positionOS.xyz;
  1969. #else
  1970. float3 defaultVertexValue = float3(0, 0, 0);
  1971. #endif
  1972. float3 vertexValue = temp_cast_0;
  1973. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1974. input.positionOS.xyz = vertexValue;
  1975. #else
  1976. input.positionOS.xyz += vertexValue;
  1977. #endif
  1978. input.normalOS = input.normalOS;
  1979. input.tangentOS = input.tangentOS;
  1980. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1981. float3 normalWS = TransformObjectToWorldNormal( input.normalOS );
  1982. float4 tangentWS = float4( TransformObjectToWorldDir( input.tangentOS.xyz ), input.tangentOS.w );
  1983. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  1984. output.positionWS = vertexInput.positionWS;
  1985. #endif
  1986. output.worldNormal = normalWS;
  1987. output.worldTangent = tangentWS;
  1988. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  1989. output.shadowCoord = GetShadowCoord( vertexInput );
  1990. #endif
  1991. output.positionCS = vertexInput.positionCS;
  1992. output.clipPosV = vertexInput.positionCS;
  1993. return output;
  1994. }
  1995. #if defined(ASE_TESSELLATION)
  1996. struct VertexControl
  1997. {
  1998. float4 vertex : INTERNALTESSPOS;
  1999. float3 normalOS : NORMAL;
  2000. float4 tangentOS : TANGENT;
  2001. float4 ase_texcoord : TEXCOORD0;
  2002. UNITY_VERTEX_INPUT_INSTANCE_ID
  2003. };
  2004. struct TessellationFactors
  2005. {
  2006. float edge[3] : SV_TessFactor;
  2007. float inside : SV_InsideTessFactor;
  2008. };
  2009. VertexControl vert ( Attributes input )
  2010. {
  2011. VertexControl output;
  2012. UNITY_SETUP_INSTANCE_ID(input);
  2013. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2014. output.vertex = input.positionOS;
  2015. output.normalOS = input.normalOS;
  2016. output.tangentOS = input.tangentOS;
  2017. output.ase_texcoord = input.ase_texcoord;
  2018. return output;
  2019. }
  2020. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2021. {
  2022. TessellationFactors output;
  2023. float4 tf = 1;
  2024. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2025. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2026. #if defined(ASE_FIXED_TESSELLATION)
  2027. tf = FixedTess( tessValue );
  2028. #elif defined(ASE_DISTANCE_TESSELLATION)
  2029. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2030. #elif defined(ASE_LENGTH_TESSELLATION)
  2031. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2032. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2033. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2034. #endif
  2035. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2036. return output;
  2037. }
  2038. [domain("tri")]
  2039. [partitioning("fractional_odd")]
  2040. [outputtopology("triangle_cw")]
  2041. [patchconstantfunc("TessellationFunction")]
  2042. [outputcontrolpoints(3)]
  2043. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2044. {
  2045. return patch[id];
  2046. }
  2047. [domain("tri")]
  2048. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2049. {
  2050. Attributes output = (Attributes) 0;
  2051. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2052. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2053. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  2054. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  2055. #if defined(ASE_PHONG_TESSELLATION)
  2056. float3 pp[3];
  2057. for (int i = 0; i < 3; ++i)
  2058. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2059. float phongStrength = _TessPhongStrength;
  2060. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2061. #endif
  2062. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2063. return VertexFunction(output);
  2064. }
  2065. #else
  2066. PackedVaryings vert ( Attributes input )
  2067. {
  2068. return VertexFunction( input );
  2069. }
  2070. #endif
  2071. void frag( PackedVaryings input
  2072. , out half4 outNormalWS : SV_Target0
  2073. #ifdef ASE_DEPTH_WRITE_ON
  2074. ,out float outputDepth : ASE_SV_DEPTH
  2075. #endif
  2076. #ifdef _WRITE_RENDERING_LAYERS
  2077. , out float4 outRenderingLayers : SV_Target1
  2078. #endif
  2079. )
  2080. {
  2081. UNITY_SETUP_INSTANCE_ID(input);
  2082. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  2083. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  2084. float3 WorldPosition = input.positionWS;
  2085. #endif
  2086. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  2087. float3 WorldNormal = input.worldNormal;
  2088. float4 WorldTangent = input.worldTangent;
  2089. float4 ClipPos = input.clipPosV;
  2090. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  2091. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  2092. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2093. ShadowCoords = input.shadowCoord;
  2094. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  2095. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  2096. #endif
  2097. #endif
  2098. float3 Normal = float3(0, 0, 1);
  2099. float Alpha = 1;
  2100. float AlphaClipThreshold = 0.5;
  2101. #ifdef ASE_DEPTH_WRITE_ON
  2102. float DepthValue = input.positionCS.z;
  2103. #endif
  2104. #ifdef _ALPHATEST_ON
  2105. clip(Alpha - AlphaClipThreshold);
  2106. #endif
  2107. #if defined(LOD_FADE_CROSSFADE)
  2108. LODFadeCrossFade( input.positionCS );
  2109. #endif
  2110. #ifdef ASE_DEPTH_WRITE_ON
  2111. outputDepth = DepthValue;
  2112. #endif
  2113. #if defined(_GBUFFER_NORMALS_OCT)
  2114. float2 octNormalWS = PackNormalOctQuadEncode(WorldNormal);
  2115. float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);
  2116. half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);
  2117. outNormalWS = half4(packedNormalWS, 0.0);
  2118. #else
  2119. #if defined(_NORMALMAP)
  2120. #if _NORMAL_DROPOFF_TS
  2121. float crossSign = (WorldTangent.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
  2122. float3 bitangent = crossSign * cross(WorldNormal.xyz, WorldTangent.xyz);
  2123. float3 normalWS = TransformTangentToWorld(Normal, half3x3(WorldTangent.xyz, bitangent, WorldNormal.xyz));
  2124. #elif _NORMAL_DROPOFF_OS
  2125. float3 normalWS = TransformObjectToWorldNormal(Normal);
  2126. #elif _NORMAL_DROPOFF_WS
  2127. float3 normalWS = Normal;
  2128. #endif
  2129. #else
  2130. float3 normalWS = WorldNormal;
  2131. #endif
  2132. outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0);
  2133. #endif
  2134. #ifdef _WRITE_RENDERING_LAYERS
  2135. uint renderingLayers = GetMeshRenderingLayer();
  2136. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  2137. #endif
  2138. }
  2139. ENDHLSL
  2140. }
  2141. Pass
  2142. {
  2143. Name "GBuffer"
  2144. Tags { "LightMode"="UniversalGBuffer" }
  2145. Blend One Zero, One Zero
  2146. ZWrite On
  2147. ZTest LEqual
  2148. Offset 0 , 0
  2149. ColorMask RGBA
  2150. HLSLPROGRAM
  2151. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2152. #define _NORMAL_DROPOFF_TS 1
  2153. #pragma shader_feature_local _RECEIVE_SHADOWS_OFF
  2154. #pragma multi_compile_instancing
  2155. #pragma instancing_options renderinglayer
  2156. #pragma multi_compile _ LOD_FADE_CROSSFADE
  2157. #pragma multi_compile_fog
  2158. #define ASE_FOG 1
  2159. #define _SPECULAR_SETUP 1
  2160. #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
  2161. #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
  2162. #define ASE_VERSION 19701
  2163. #define ASE_SRP_VERSION 170003
  2164. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
  2165. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
  2166. #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
  2167. #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
  2168. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  2169. #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
  2170. #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
  2171. #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
  2172. #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
  2173. #pragma multi_compile _ SHADOWS_SHADOWMASK
  2174. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  2175. #pragma multi_compile _ USE_LEGACY_LIGHTMAPS
  2176. #pragma multi_compile _ LIGHTMAP_ON
  2177. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  2178. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  2179. #pragma vertex vert
  2180. #pragma fragment frag
  2181. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2182. #define _SPECULAR_COLOR 1
  2183. #endif
  2184. #define SHADERPASS SHADERPASS_GBUFFER
  2185. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2186. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  2187. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  2188. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2189. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2190. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2191. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2192. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2193. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2194. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2195. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2196. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2197. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
  2198. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2199. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  2200. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2201. #if defined(LOD_FADE_CROSSFADE)
  2202. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  2203. #endif
  2204. #if defined(UNITY_INSTANCING_ENABLED) && defined(_TERRAIN_INSTANCED_PERPIXEL_NORMAL)
  2205. #define ENABLE_TERRAIN_PERPIXEL_NORMAL
  2206. #endif
  2207. #define ASE_NEEDS_FRAG_WORLD_POSITION
  2208. #define ASE_NEEDS_FRAG_WORLD_NORMAL
  2209. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  2210. #define ASE_SV_DEPTH SV_DepthLessEqual
  2211. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  2212. #else
  2213. #define ASE_SV_DEPTH SV_Depth
  2214. #define ASE_SV_POSITION_QUALIFIERS
  2215. #endif
  2216. struct Attributes
  2217. {
  2218. float4 positionOS : POSITION;
  2219. float3 normalOS : NORMAL;
  2220. float4 tangentOS : TANGENT;
  2221. float4 texcoord : TEXCOORD0;
  2222. float4 texcoord1 : TEXCOORD1;
  2223. float4 texcoord2 : TEXCOORD2;
  2224. UNITY_VERTEX_INPUT_INSTANCE_ID
  2225. };
  2226. struct PackedVaryings
  2227. {
  2228. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  2229. float4 clipPosV : TEXCOORD0;
  2230. float4 lightmapUVOrVertexSH : TEXCOORD1;
  2231. half4 fogFactorAndVertexLight : TEXCOORD2;
  2232. float4 tSpace0 : TEXCOORD3;
  2233. float4 tSpace1 : TEXCOORD4;
  2234. float4 tSpace2 : TEXCOORD5;
  2235. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2236. float4 shadowCoord : TEXCOORD6;
  2237. #endif
  2238. #if defined(DYNAMICLIGHTMAP_ON)
  2239. float2 dynamicLightmapUV : TEXCOORD7;
  2240. #endif
  2241. #if defined(USE_APV_PROBE_OCCLUSION)
  2242. float4 probeOcclusion : TEXCOORD8;
  2243. #endif
  2244. float4 ase_texcoord9 : TEXCOORD9;
  2245. UNITY_VERTEX_INPUT_INSTANCE_ID
  2246. UNITY_VERTEX_OUTPUT_STEREO
  2247. };
  2248. CBUFFER_START(UnityPerMaterial)
  2249. float4 _WavingTint;
  2250. float _Gloss;
  2251. #ifdef ASE_TRANSMISSION
  2252. float _TransmissionShadow;
  2253. #endif
  2254. #ifdef ASE_TRANSLUCENCY
  2255. float _TransStrength;
  2256. float _TransNormal;
  2257. float _TransScattering;
  2258. float _TransDirect;
  2259. float _TransAmbient;
  2260. float _TransShadow;
  2261. #endif
  2262. #ifdef ASE_TESSELLATION
  2263. float _TessPhongStrength;
  2264. float _TessValue;
  2265. float _TessMin;
  2266. float _TessMax;
  2267. float _TessEdgeLength;
  2268. float _TessMaxDisp;
  2269. #endif
  2270. CBUFFER_END
  2271. #ifdef SCENEPICKINGPASS
  2272. float4 _SelectionID;
  2273. #endif
  2274. #ifdef SCENESELECTIONPASS
  2275. int _ObjectId;
  2276. int _PassValue;
  2277. #endif
  2278. sampler2D _MainTex;
  2279. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
  2280. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  2281. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  2282. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  2283. float snoise( float2 v )
  2284. {
  2285. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  2286. float2 i = floor( v + dot( v, C.yy ) );
  2287. float2 x0 = v - i + dot( i, C.xx );
  2288. float2 i1;
  2289. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  2290. float4 x12 = x0.xyxy + C.xxzz;
  2291. x12.xy -= i1;
  2292. i = mod2D289( i );
  2293. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  2294. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  2295. m = m * m;
  2296. m = m * m;
  2297. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  2298. float3 h = abs( x ) - 0.5;
  2299. float3 ox = floor( x + 0.5 );
  2300. float3 a0 = x - ox;
  2301. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  2302. float3 g;
  2303. g.x = a0.x * x0.x + h.x * x0.y;
  2304. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  2305. return 130.0 * dot( m, g );
  2306. }
  2307. PackedVaryings VertexFunction( Attributes input )
  2308. {
  2309. PackedVaryings output = (PackedVaryings)0;
  2310. UNITY_SETUP_INSTANCE_ID(input);
  2311. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2312. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2313. float2 texCoord120 = input.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  2314. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  2315. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  2316. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  2317. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  2318. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  2319. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  2320. output.ase_texcoord9.xy = input.texcoord.xy;
  2321. //setting value to unused interpolator channels and avoid initialization warnings
  2322. output.ase_texcoord9.zw = 0;
  2323. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2324. float3 defaultVertexValue = input.positionOS.xyz;
  2325. #else
  2326. float3 defaultVertexValue = float3(0, 0, 0);
  2327. #endif
  2328. float3 vertexValue = temp_cast_0;
  2329. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2330. input.positionOS.xyz = vertexValue;
  2331. #else
  2332. input.positionOS.xyz += vertexValue;
  2333. #endif
  2334. input.normalOS = input.normalOS;
  2335. input.tangentOS = input.tangentOS;
  2336. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  2337. VertexNormalInputs normalInput = GetVertexNormalInputs( input.normalOS, input.tangentOS );
  2338. output.tSpace0 = float4( normalInput.normalWS, vertexInput.positionWS.x);
  2339. output.tSpace1 = float4( normalInput.tangentWS, vertexInput.positionWS.y);
  2340. output.tSpace2 = float4( normalInput.bitangentWS, vertexInput.positionWS.z);
  2341. #if defined(LIGHTMAP_ON)
  2342. OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy);
  2343. #endif
  2344. #if defined(DYNAMICLIGHTMAP_ON)
  2345. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  2346. #endif
  2347. OUTPUT_SH4( vertexInput.positionWS, normalInput.normalWS.xyz, GetWorldSpaceNormalizeViewDir( vertexInput.positionWS ), output.lightmapUVOrVertexSH.xyz, output.probeOcclusion );
  2348. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2349. output.lightmapUVOrVertexSH.zw = input.texcoord.xy;
  2350. output.lightmapUVOrVertexSH.xy = input.texcoord.xy * unity_LightmapST.xy + unity_LightmapST.zw;
  2351. #endif
  2352. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  2353. output.fogFactorAndVertexLight = half4(0, vertexLight);
  2354. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2355. output.shadowCoord = GetShadowCoord( vertexInput );
  2356. #endif
  2357. output.positionCS = vertexInput.positionCS;
  2358. output.clipPosV = vertexInput.positionCS;
  2359. return output;
  2360. }
  2361. #if defined(ASE_TESSELLATION)
  2362. struct VertexControl
  2363. {
  2364. float4 vertex : INTERNALTESSPOS;
  2365. float3 normalOS : NORMAL;
  2366. float4 tangentOS : TANGENT;
  2367. float4 texcoord : TEXCOORD0;
  2368. float4 texcoord1 : TEXCOORD1;
  2369. float4 texcoord2 : TEXCOORD2;
  2370. UNITY_VERTEX_INPUT_INSTANCE_ID
  2371. };
  2372. struct TessellationFactors
  2373. {
  2374. float edge[3] : SV_TessFactor;
  2375. float inside : SV_InsideTessFactor;
  2376. };
  2377. VertexControl vert ( Attributes input )
  2378. {
  2379. VertexControl output;
  2380. UNITY_SETUP_INSTANCE_ID(input);
  2381. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2382. output.vertex = input.positionOS;
  2383. output.normalOS = input.normalOS;
  2384. output.tangentOS = input.tangentOS;
  2385. output.texcoord = input.texcoord;
  2386. output.texcoord1 = input.texcoord1;
  2387. output.texcoord2 = input.texcoord2;
  2388. return output;
  2389. }
  2390. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2391. {
  2392. TessellationFactors output;
  2393. float4 tf = 1;
  2394. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2395. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2396. #if defined(ASE_FIXED_TESSELLATION)
  2397. tf = FixedTess( tessValue );
  2398. #elif defined(ASE_DISTANCE_TESSELLATION)
  2399. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2400. #elif defined(ASE_LENGTH_TESSELLATION)
  2401. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2402. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2403. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2404. #endif
  2405. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2406. return output;
  2407. }
  2408. [domain("tri")]
  2409. [partitioning("fractional_odd")]
  2410. [outputtopology("triangle_cw")]
  2411. [patchconstantfunc("TessellationFunction")]
  2412. [outputcontrolpoints(3)]
  2413. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2414. {
  2415. return patch[id];
  2416. }
  2417. [domain("tri")]
  2418. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2419. {
  2420. Attributes output = (Attributes) 0;
  2421. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2422. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2423. output.tangentOS = patch[0].tangentOS * bary.x + patch[1].tangentOS * bary.y + patch[2].tangentOS * bary.z;
  2424. output.texcoord = patch[0].texcoord * bary.x + patch[1].texcoord * bary.y + patch[2].texcoord * bary.z;
  2425. output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
  2426. output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
  2427. #if defined(ASE_PHONG_TESSELLATION)
  2428. float3 pp[3];
  2429. for (int i = 0; i < 3; ++i)
  2430. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2431. float phongStrength = _TessPhongStrength;
  2432. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2433. #endif
  2434. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2435. return VertexFunction(output);
  2436. }
  2437. #else
  2438. PackedVaryings vert ( Attributes input )
  2439. {
  2440. return VertexFunction( input );
  2441. }
  2442. #endif
  2443. FragmentOutput frag ( PackedVaryings input
  2444. #ifdef ASE_DEPTH_WRITE_ON
  2445. ,out float outputDepth : ASE_SV_DEPTH
  2446. #endif
  2447. )
  2448. {
  2449. UNITY_SETUP_INSTANCE_ID(input);
  2450. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  2451. #if defined(LOD_FADE_CROSSFADE)
  2452. LODFadeCrossFade( input.positionCS );
  2453. #endif
  2454. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2455. float2 sampleCoords = (input.lightmapUVOrVertexSH.zw / _TerrainHeightmapRecipSize.zw + 0.5f) * _TerrainHeightmapRecipSize.xy;
  2456. float3 WorldNormal = TransformObjectToWorldNormal(normalize(SAMPLE_TEXTURE2D(_TerrainNormalmapTexture, sampler_TerrainNormalmapTexture, sampleCoords).rgb * 2 - 1));
  2457. float3 WorldTangent = -cross(GetObjectToWorldMatrix()._13_23_33, WorldNormal);
  2458. float3 WorldBiTangent = cross(WorldNormal, -WorldTangent);
  2459. #else
  2460. float3 WorldNormal = normalize( input.tSpace0.xyz );
  2461. float3 WorldTangent = input.tSpace1.xyz;
  2462. float3 WorldBiTangent = input.tSpace2.xyz;
  2463. #endif
  2464. float3 WorldPosition = float3(input.tSpace0.w,input.tSpace1.w,input.tSpace2.w);
  2465. float3 WorldViewDirection = _WorldSpaceCameraPos.xyz - WorldPosition;
  2466. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  2467. float4 ClipPos = input.clipPosV;
  2468. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  2469. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  2470. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  2471. ShadowCoords = input.shadowCoord;
  2472. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  2473. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  2474. #else
  2475. ShadowCoords = float4(0, 0, 0, 0);
  2476. #endif
  2477. WorldViewDirection = SafeNormalize( WorldViewDirection );
  2478. float2 uv_MainTex124 = input.ase_texcoord9.xy;
  2479. float4 tex2DNode124 = tex2D( _MainTex, uv_MainTex124 );
  2480. float3 ase_viewVectorWS = ( _WorldSpaceCameraPos.xyz - WorldPosition );
  2481. float3 ase_viewDirWS = normalize( ase_viewVectorWS );
  2482. float dotResult171 = dot( ase_viewDirWS , -( _MainLightPosition.xyz + ( WorldNormal * 1.0 ) ) );
  2483. float fresnelNdotV176 = dot( WorldNormal, ase_viewDirWS );
  2484. float fresnelNode176 = ( 0.5 + 3.0 * pow( max( 1.0 - fresnelNdotV176 , 0.0001 ), 8.58 ) );
  2485. float grayscale138 = Luminance(abs( tex2DNode124 ).rgb);
  2486. float3 BaseColor = ( ( tex2DNode124 * ( saturate( dotResult171 ) * ( tex2DNode124 * fresnelNode176 ) ) ) + ( _WavingTint * tex2DNode124 ) ).rgb;
  2487. float3 Normal = float3(0, 0, 1);
  2488. float3 Emission = 0;
  2489. float3 Specular = 0.5;
  2490. float Metallic = 0;
  2491. float Smoothness = ( grayscale138 * _Gloss );
  2492. float Occlusion = 1;
  2493. float Alpha = 1;
  2494. float AlphaClipThreshold = 0.5;
  2495. float AlphaClipThresholdShadow = 0.5;
  2496. float3 BakedGI = 0;
  2497. float3 RefractionColor = 1;
  2498. float RefractionIndex = 1;
  2499. float3 Transmission = 1;
  2500. float3 Translucency = 1;
  2501. #ifdef ASE_DEPTH_WRITE_ON
  2502. float DepthValue = input.positionCS.z;
  2503. #endif
  2504. #ifdef _ALPHATEST_ON
  2505. clip(Alpha - AlphaClipThreshold);
  2506. #endif
  2507. InputData inputData = (InputData)0;
  2508. inputData.positionWS = WorldPosition;
  2509. inputData.positionCS = input.positionCS;
  2510. inputData.shadowCoord = ShadowCoords;
  2511. #ifdef _NORMALMAP
  2512. #if _NORMAL_DROPOFF_TS
  2513. inputData.normalWS = TransformTangentToWorld(Normal, half3x3( WorldTangent, WorldBiTangent, WorldNormal ));
  2514. #elif _NORMAL_DROPOFF_OS
  2515. inputData.normalWS = TransformObjectToWorldNormal(Normal);
  2516. #elif _NORMAL_DROPOFF_WS
  2517. inputData.normalWS = Normal;
  2518. #endif
  2519. #else
  2520. inputData.normalWS = WorldNormal;
  2521. #endif
  2522. inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
  2523. inputData.viewDirectionWS = SafeNormalize( WorldViewDirection );
  2524. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  2525. #if defined(ENABLE_TERRAIN_PERPIXEL_NORMAL)
  2526. float3 SH = SampleSH(inputData.normalWS.xyz);
  2527. #else
  2528. float3 SH = input.lightmapUVOrVertexSH.xyz;
  2529. #endif
  2530. #if defined(DYNAMICLIGHTMAP_ON)
  2531. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, input.dynamicLightmapUV.xy, SH, inputData.normalWS);
  2532. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  2533. #elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
  2534. inputData.bakedGI = SAMPLE_GI( SH, GetAbsolutePositionWS(inputData.positionWS),
  2535. inputData.normalWS,
  2536. inputData.viewDirectionWS,
  2537. input.positionCS.xy,
  2538. input.probeOcclusion,
  2539. inputData.shadowMask );
  2540. #else
  2541. inputData.bakedGI = SAMPLE_GI(input.lightmapUVOrVertexSH.xy, SH, inputData.normalWS);
  2542. inputData.shadowMask = SAMPLE_SHADOWMASK(input.lightmapUVOrVertexSH.xy);
  2543. #endif
  2544. #ifdef ASE_BAKEDGI
  2545. inputData.bakedGI = BakedGI;
  2546. #endif
  2547. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  2548. #if defined(DEBUG_DISPLAY)
  2549. #if defined(DYNAMICLIGHTMAP_ON)
  2550. inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
  2551. #endif
  2552. #if defined(LIGHTMAP_ON)
  2553. inputData.staticLightmapUV = input.lightmapUVOrVertexSH.xy;
  2554. #else
  2555. inputData.vertexSH = SH;
  2556. #endif
  2557. #if defined(USE_APV_PROBE_OCCLUSION)
  2558. inputData.probeOcclusion = input.probeOcclusion;
  2559. #endif
  2560. #endif
  2561. #ifdef _DBUFFER
  2562. ApplyDecal(input.positionCS,
  2563. BaseColor,
  2564. Specular,
  2565. inputData.normalWS,
  2566. Metallic,
  2567. Occlusion,
  2568. Smoothness);
  2569. #endif
  2570. BRDFData brdfData;
  2571. InitializeBRDFData
  2572. (BaseColor, Metallic, Specular, Smoothness, Alpha, brdfData);
  2573. Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
  2574. half4 color;
  2575. MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask);
  2576. color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
  2577. color.a = Alpha;
  2578. #ifdef ASE_FINAL_COLOR_ALPHA_MULTIPLY
  2579. color.rgb *= color.a;
  2580. #endif
  2581. #ifdef ASE_DEPTH_WRITE_ON
  2582. outputDepth = DepthValue;
  2583. #endif
  2584. return BRDFDataToGbuffer(brdfData, inputData, Smoothness, Emission + color.rgb, Occlusion);
  2585. }
  2586. ENDHLSL
  2587. }
  2588. Pass
  2589. {
  2590. Name "SceneSelectionPass"
  2591. Tags { "LightMode"="SceneSelectionPass" }
  2592. Cull Off
  2593. AlphaToMask Off
  2594. HLSLPROGRAM
  2595. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2596. #define _NORMAL_DROPOFF_TS 1
  2597. #define ASE_FOG 1
  2598. #define _SPECULAR_SETUP 1
  2599. #define ASE_VERSION 19701
  2600. #define ASE_SRP_VERSION 170003
  2601. #pragma vertex vert
  2602. #pragma fragment frag
  2603. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2604. #define _SPECULAR_COLOR 1
  2605. #endif
  2606. #define SCENESELECTIONPASS 1
  2607. #define ATTRIBUTES_NEED_NORMAL
  2608. #define ATTRIBUTES_NEED_TANGENT
  2609. #define SHADERPASS SHADERPASS_DEPTHONLY
  2610. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2611. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2612. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2613. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2614. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2615. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2616. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2617. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2618. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2619. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2620. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2621. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2622. struct Attributes
  2623. {
  2624. float4 positionOS : POSITION;
  2625. float3 normalOS : NORMAL;
  2626. float4 ase_texcoord : TEXCOORD0;
  2627. UNITY_VERTEX_INPUT_INSTANCE_ID
  2628. };
  2629. struct PackedVaryings
  2630. {
  2631. float4 positionCS : SV_POSITION;
  2632. UNITY_VERTEX_INPUT_INSTANCE_ID
  2633. UNITY_VERTEX_OUTPUT_STEREO
  2634. };
  2635. CBUFFER_START(UnityPerMaterial)
  2636. float4 _WavingTint;
  2637. float _Gloss;
  2638. #ifdef ASE_TRANSMISSION
  2639. float _TransmissionShadow;
  2640. #endif
  2641. #ifdef ASE_TRANSLUCENCY
  2642. float _TransStrength;
  2643. float _TransNormal;
  2644. float _TransScattering;
  2645. float _TransDirect;
  2646. float _TransAmbient;
  2647. float _TransShadow;
  2648. #endif
  2649. #ifdef ASE_TESSELLATION
  2650. float _TessPhongStrength;
  2651. float _TessValue;
  2652. float _TessMin;
  2653. float _TessMax;
  2654. float _TessEdgeLength;
  2655. float _TessMaxDisp;
  2656. #endif
  2657. CBUFFER_END
  2658. #ifdef SCENEPICKINGPASS
  2659. float4 _SelectionID;
  2660. #endif
  2661. #ifdef SCENESELECTIONPASS
  2662. int _ObjectId;
  2663. int _PassValue;
  2664. #endif
  2665. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  2666. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  2667. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  2668. float snoise( float2 v )
  2669. {
  2670. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  2671. float2 i = floor( v + dot( v, C.yy ) );
  2672. float2 x0 = v - i + dot( i, C.xx );
  2673. float2 i1;
  2674. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  2675. float4 x12 = x0.xyxy + C.xxzz;
  2676. x12.xy -= i1;
  2677. i = mod2D289( i );
  2678. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  2679. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  2680. m = m * m;
  2681. m = m * m;
  2682. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  2683. float3 h = abs( x ) - 0.5;
  2684. float3 ox = floor( x + 0.5 );
  2685. float3 a0 = x - ox;
  2686. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  2687. float3 g;
  2688. g.x = a0.x * x0.x + h.x * x0.y;
  2689. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  2690. return 130.0 * dot( m, g );
  2691. }
  2692. struct SurfaceDescription
  2693. {
  2694. float Alpha;
  2695. float AlphaClipThreshold;
  2696. };
  2697. PackedVaryings VertexFunction(Attributes input )
  2698. {
  2699. PackedVaryings output;
  2700. ZERO_INITIALIZE(PackedVaryings, output);
  2701. UNITY_SETUP_INSTANCE_ID(input);
  2702. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2703. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2704. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  2705. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  2706. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  2707. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  2708. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  2709. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  2710. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  2711. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2712. float3 defaultVertexValue = input.positionOS.xyz;
  2713. #else
  2714. float3 defaultVertexValue = float3(0, 0, 0);
  2715. #endif
  2716. float3 vertexValue = temp_cast_0;
  2717. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2718. input.positionOS.xyz = vertexValue;
  2719. #else
  2720. input.positionOS.xyz += vertexValue;
  2721. #endif
  2722. input.normalOS = input.normalOS;
  2723. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  2724. output.positionCS = TransformWorldToHClip(positionWS);
  2725. return output;
  2726. }
  2727. #if defined(ASE_TESSELLATION)
  2728. struct VertexControl
  2729. {
  2730. float4 vertex : INTERNALTESSPOS;
  2731. float3 normalOS : NORMAL;
  2732. float4 ase_texcoord : TEXCOORD0;
  2733. UNITY_VERTEX_INPUT_INSTANCE_ID
  2734. };
  2735. struct TessellationFactors
  2736. {
  2737. float edge[3] : SV_TessFactor;
  2738. float inside : SV_InsideTessFactor;
  2739. };
  2740. VertexControl vert ( Attributes input )
  2741. {
  2742. VertexControl output;
  2743. UNITY_SETUP_INSTANCE_ID(input);
  2744. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2745. output.vertex = input.positionOS;
  2746. output.normalOS = input.normalOS;
  2747. output.ase_texcoord = input.ase_texcoord;
  2748. return output;
  2749. }
  2750. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2751. {
  2752. TessellationFactors output;
  2753. float4 tf = 1;
  2754. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2755. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2756. #if defined(ASE_FIXED_TESSELLATION)
  2757. tf = FixedTess( tessValue );
  2758. #elif defined(ASE_DISTANCE_TESSELLATION)
  2759. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2760. #elif defined(ASE_LENGTH_TESSELLATION)
  2761. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2762. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2763. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2764. #endif
  2765. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2766. return output;
  2767. }
  2768. [domain("tri")]
  2769. [partitioning("fractional_odd")]
  2770. [outputtopology("triangle_cw")]
  2771. [patchconstantfunc("TessellationFunction")]
  2772. [outputcontrolpoints(3)]
  2773. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  2774. {
  2775. return patch[id];
  2776. }
  2777. [domain("tri")]
  2778. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  2779. {
  2780. Attributes output = (Attributes) 0;
  2781. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  2782. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  2783. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  2784. #if defined(ASE_PHONG_TESSELLATION)
  2785. float3 pp[3];
  2786. for (int i = 0; i < 3; ++i)
  2787. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  2788. float phongStrength = _TessPhongStrength;
  2789. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  2790. #endif
  2791. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  2792. return VertexFunction(output);
  2793. }
  2794. #else
  2795. PackedVaryings vert ( Attributes input )
  2796. {
  2797. return VertexFunction( input );
  2798. }
  2799. #endif
  2800. half4 frag(PackedVaryings input ) : SV_TARGET
  2801. {
  2802. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  2803. surfaceDescription.Alpha = 1;
  2804. surfaceDescription.AlphaClipThreshold = 0.5;
  2805. #if _ALPHATEST_ON
  2806. float alphaClipThreshold = 0.01f;
  2807. #if ALPHA_CLIP_THRESHOLD
  2808. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  2809. #endif
  2810. clip(surfaceDescription.Alpha - alphaClipThreshold);
  2811. #endif
  2812. half4 outColor = 0;
  2813. #ifdef SCENESELECTIONPASS
  2814. outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  2815. #elif defined(SCENEPICKINGPASS)
  2816. outColor = _SelectionID;
  2817. #endif
  2818. return outColor;
  2819. }
  2820. ENDHLSL
  2821. }
  2822. Pass
  2823. {
  2824. Name "ScenePickingPass"
  2825. Tags { "LightMode"="Picking" }
  2826. AlphaToMask Off
  2827. HLSLPROGRAM
  2828. #pragma multi_compile_local_fragment _ALPHATEST_ON
  2829. #define _NORMAL_DROPOFF_TS 1
  2830. #define ASE_FOG 1
  2831. #define _SPECULAR_SETUP 1
  2832. #define ASE_VERSION 19701
  2833. #define ASE_SRP_VERSION 170003
  2834. #pragma vertex vert
  2835. #pragma fragment frag
  2836. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  2837. #define _SPECULAR_COLOR 1
  2838. #endif
  2839. #define SCENEPICKINGPASS 1
  2840. #define ATTRIBUTES_NEED_NORMAL
  2841. #define ATTRIBUTES_NEED_TANGENT
  2842. #define SHADERPASS SHADERPASS_DEPTHONLY
  2843. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  2844. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  2845. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  2846. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  2847. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  2848. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  2849. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  2850. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  2851. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  2852. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  2853. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  2854. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  2855. struct Attributes
  2856. {
  2857. float4 positionOS : POSITION;
  2858. float3 normalOS : NORMAL;
  2859. float4 ase_texcoord : TEXCOORD0;
  2860. UNITY_VERTEX_INPUT_INSTANCE_ID
  2861. };
  2862. struct PackedVaryings
  2863. {
  2864. float4 positionCS : SV_POSITION;
  2865. UNITY_VERTEX_INPUT_INSTANCE_ID
  2866. UNITY_VERTEX_OUTPUT_STEREO
  2867. };
  2868. CBUFFER_START(UnityPerMaterial)
  2869. float4 _WavingTint;
  2870. float _Gloss;
  2871. #ifdef ASE_TRANSMISSION
  2872. float _TransmissionShadow;
  2873. #endif
  2874. #ifdef ASE_TRANSLUCENCY
  2875. float _TransStrength;
  2876. float _TransNormal;
  2877. float _TransScattering;
  2878. float _TransDirect;
  2879. float _TransAmbient;
  2880. float _TransShadow;
  2881. #endif
  2882. #ifdef ASE_TESSELLATION
  2883. float _TessPhongStrength;
  2884. float _TessValue;
  2885. float _TessMin;
  2886. float _TessMax;
  2887. float _TessEdgeLength;
  2888. float _TessMaxDisp;
  2889. #endif
  2890. CBUFFER_END
  2891. #ifdef SCENEPICKINGPASS
  2892. float4 _SelectionID;
  2893. #endif
  2894. #ifdef SCENESELECTIONPASS
  2895. int _ObjectId;
  2896. int _PassValue;
  2897. #endif
  2898. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  2899. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  2900. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  2901. float snoise( float2 v )
  2902. {
  2903. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  2904. float2 i = floor( v + dot( v, C.yy ) );
  2905. float2 x0 = v - i + dot( i, C.xx );
  2906. float2 i1;
  2907. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  2908. float4 x12 = x0.xyxy + C.xxzz;
  2909. x12.xy -= i1;
  2910. i = mod2D289( i );
  2911. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  2912. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  2913. m = m * m;
  2914. m = m * m;
  2915. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  2916. float3 h = abs( x ) - 0.5;
  2917. float3 ox = floor( x + 0.5 );
  2918. float3 a0 = x - ox;
  2919. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  2920. float3 g;
  2921. g.x = a0.x * x0.x + h.x * x0.y;
  2922. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  2923. return 130.0 * dot( m, g );
  2924. }
  2925. struct SurfaceDescription
  2926. {
  2927. float Alpha;
  2928. float AlphaClipThreshold;
  2929. };
  2930. PackedVaryings VertexFunction(Attributes input )
  2931. {
  2932. PackedVaryings output;
  2933. ZERO_INITIALIZE(PackedVaryings, output);
  2934. UNITY_SETUP_INSTANCE_ID(input);
  2935. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2936. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  2937. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  2938. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  2939. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  2940. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  2941. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  2942. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  2943. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  2944. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2945. float3 defaultVertexValue = input.positionOS.xyz;
  2946. #else
  2947. float3 defaultVertexValue = float3(0, 0, 0);
  2948. #endif
  2949. float3 vertexValue = temp_cast_0;
  2950. #ifdef ASE_ABSOLUTE_VERTEX_POS
  2951. input.positionOS.xyz = vertexValue;
  2952. #else
  2953. input.positionOS.xyz += vertexValue;
  2954. #endif
  2955. input.normalOS = input.normalOS;
  2956. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  2957. output.positionCS = TransformWorldToHClip(positionWS);
  2958. return output;
  2959. }
  2960. #if defined(ASE_TESSELLATION)
  2961. struct VertexControl
  2962. {
  2963. float4 vertex : INTERNALTESSPOS;
  2964. float3 normalOS : NORMAL;
  2965. float4 ase_texcoord : TEXCOORD0;
  2966. UNITY_VERTEX_INPUT_INSTANCE_ID
  2967. };
  2968. struct TessellationFactors
  2969. {
  2970. float edge[3] : SV_TessFactor;
  2971. float inside : SV_InsideTessFactor;
  2972. };
  2973. VertexControl vert ( Attributes input )
  2974. {
  2975. VertexControl output;
  2976. UNITY_SETUP_INSTANCE_ID(input);
  2977. UNITY_TRANSFER_INSTANCE_ID(input, output);
  2978. output.vertex = input.positionOS;
  2979. output.normalOS = input.normalOS;
  2980. output.ase_texcoord = input.ase_texcoord;
  2981. return output;
  2982. }
  2983. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  2984. {
  2985. TessellationFactors output;
  2986. float4 tf = 1;
  2987. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  2988. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  2989. #if defined(ASE_FIXED_TESSELLATION)
  2990. tf = FixedTess( tessValue );
  2991. #elif defined(ASE_DISTANCE_TESSELLATION)
  2992. tf = DistanceBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  2993. #elif defined(ASE_LENGTH_TESSELLATION)
  2994. tf = EdgeLengthBasedTess(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  2995. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  2996. tf = EdgeLengthBasedTessCull(input[0].vertex, input[1].vertex, input[2].vertex, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  2997. #endif
  2998. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  2999. return output;
  3000. }
  3001. [domain("tri")]
  3002. [partitioning("fractional_odd")]
  3003. [outputtopology("triangle_cw")]
  3004. [patchconstantfunc("TessellationFunction")]
  3005. [outputcontrolpoints(3)]
  3006. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  3007. {
  3008. return patch[id];
  3009. }
  3010. [domain("tri")]
  3011. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  3012. {
  3013. Attributes output = (Attributes) 0;
  3014. output.positionOS = patch[0].vertex * bary.x + patch[1].vertex * bary.y + patch[2].vertex * bary.z;
  3015. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  3016. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  3017. #if defined(ASE_PHONG_TESSELLATION)
  3018. float3 pp[3];
  3019. for (int i = 0; i < 3; ++i)
  3020. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].vertex.xyz, patch[i].normalOS));
  3021. float phongStrength = _TessPhongStrength;
  3022. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  3023. #endif
  3024. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  3025. return VertexFunction(output);
  3026. }
  3027. #else
  3028. PackedVaryings vert ( Attributes input )
  3029. {
  3030. return VertexFunction( input );
  3031. }
  3032. #endif
  3033. half4 frag(PackedVaryings input ) : SV_TARGET
  3034. {
  3035. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  3036. surfaceDescription.Alpha = 1;
  3037. surfaceDescription.AlphaClipThreshold = 0.5;
  3038. #if _ALPHATEST_ON
  3039. float alphaClipThreshold = 0.01f;
  3040. #if ALPHA_CLIP_THRESHOLD
  3041. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  3042. #endif
  3043. clip(surfaceDescription.Alpha - alphaClipThreshold);
  3044. #endif
  3045. half4 outColor = 0;
  3046. #ifdef SCENESELECTIONPASS
  3047. outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  3048. #elif defined(SCENEPICKINGPASS)
  3049. outColor = _SelectionID;
  3050. #endif
  3051. return outColor;
  3052. }
  3053. ENDHLSL
  3054. }
  3055. Pass
  3056. {
  3057. Name "MotionVectors"
  3058. Tags { "LightMode"="MotionVectors" }
  3059. ColorMask RG
  3060. HLSLPROGRAM
  3061. #pragma multi_compile_local_fragment _ALPHATEST_ON
  3062. #define _NORMAL_DROPOFF_TS 1
  3063. #pragma multi_compile_instancing
  3064. #pragma multi_compile _ LOD_FADE_CROSSFADE
  3065. #define ASE_FOG 1
  3066. #define _SPECULAR_SETUP 1
  3067. #define ASE_VERSION 19701
  3068. #define ASE_SRP_VERSION 170003
  3069. #pragma vertex vert
  3070. #pragma fragment frag
  3071. #if defined(_SPECULAR_SETUP) && defined(_ASE_LIGHTING_SIMPLE)
  3072. #define _SPECULAR_COLOR 1
  3073. #endif
  3074. #define SHADERPASS SHADERPASS_MOTION_VECTORS
  3075. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  3076. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  3077. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  3078. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  3079. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  3080. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  3081. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  3082. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  3083. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  3084. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
  3085. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl"
  3086. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  3087. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  3088. #if defined(LOD_FADE_CROSSFADE)
  3089. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  3090. #endif
  3091. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MotionVectorsCommon.hlsl"
  3092. struct Attributes
  3093. {
  3094. float4 positionOS : POSITION;
  3095. float3 positionOld : TEXCOORD4;
  3096. #if _ADD_PRECOMPUTED_VELOCITY
  3097. float3 alembicMotionVector : TEXCOORD5;
  3098. #endif
  3099. float4 ase_texcoord : TEXCOORD0;
  3100. UNITY_VERTEX_INPUT_INSTANCE_ID
  3101. };
  3102. struct PackedVaryings
  3103. {
  3104. float4 positionCS : SV_POSITION;
  3105. float4 positionCSNoJitter : TEXCOORD0;
  3106. float4 previousPositionCSNoJitter : TEXCOORD1;
  3107. UNITY_VERTEX_INPUT_INSTANCE_ID
  3108. UNITY_VERTEX_OUTPUT_STEREO
  3109. };
  3110. CBUFFER_START(UnityPerMaterial)
  3111. float4 _WavingTint;
  3112. float _Gloss;
  3113. #ifdef ASE_TRANSMISSION
  3114. float _TransmissionShadow;
  3115. #endif
  3116. #ifdef ASE_TRANSLUCENCY
  3117. float _TransStrength;
  3118. float _TransNormal;
  3119. float _TransScattering;
  3120. float _TransDirect;
  3121. float _TransAmbient;
  3122. float _TransShadow;
  3123. #endif
  3124. #ifdef ASE_TESSELLATION
  3125. float _TessPhongStrength;
  3126. float _TessValue;
  3127. float _TessMin;
  3128. float _TessMax;
  3129. float _TessEdgeLength;
  3130. float _TessMaxDisp;
  3131. #endif
  3132. CBUFFER_END
  3133. #ifdef SCENEPICKINGPASS
  3134. float4 _SelectionID;
  3135. #endif
  3136. #ifdef SCENESELECTIONPASS
  3137. int _ObjectId;
  3138. int _PassValue;
  3139. #endif
  3140. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  3141. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  3142. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  3143. float snoise( float2 v )
  3144. {
  3145. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  3146. float2 i = floor( v + dot( v, C.yy ) );
  3147. float2 x0 = v - i + dot( i, C.xx );
  3148. float2 i1;
  3149. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  3150. float4 x12 = x0.xyxy + C.xxzz;
  3151. x12.xy -= i1;
  3152. i = mod2D289( i );
  3153. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  3154. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  3155. m = m * m;
  3156. m = m * m;
  3157. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  3158. float3 h = abs( x ) - 0.5;
  3159. float3 ox = floor( x + 0.5 );
  3160. float3 a0 = x - ox;
  3161. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  3162. float3 g;
  3163. g.x = a0.x * x0.x + h.x * x0.y;
  3164. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  3165. return 130.0 * dot( m, g );
  3166. }
  3167. PackedVaryings VertexFunction( Attributes input )
  3168. {
  3169. PackedVaryings output = (PackedVaryings)0;
  3170. UNITY_SETUP_INSTANCE_ID(input);
  3171. UNITY_TRANSFER_INSTANCE_ID(input, output);
  3172. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  3173. float2 texCoord120 = input.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  3174. float3 ase_worldPos = TransformObjectToWorld( (input.positionOS).xyz );
  3175. float2 appendResult122 = (float2(ase_worldPos.x , ase_worldPos.z));
  3176. float2 appendResult123 = (float2(_TimeParameters.x , _TimeParameters.x));
  3177. float simplePerlin2D132 = snoise( ( appendResult122 + appendResult123 )*1.0 );
  3178. simplePerlin2D132 = simplePerlin2D132*0.5 + 0.5;
  3179. float3 temp_cast_0 = (( pow( ( abs( texCoord120.y ) * 0.5 ) , 2.0 ) * simplePerlin2D132 )).xxx;
  3180. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3181. float3 defaultVertexValue = input.positionOS.xyz;
  3182. #else
  3183. float3 defaultVertexValue = float3(0, 0, 0);
  3184. #endif
  3185. float3 vertexValue = temp_cast_0;
  3186. #ifdef ASE_ABSOLUTE_VERTEX_POS
  3187. input.positionOS.xyz = vertexValue;
  3188. #else
  3189. input.positionOS.xyz += vertexValue;
  3190. #endif
  3191. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  3192. #if defined(APLICATION_SPACE_WARP_MOTION)
  3193. // We do not need jittered position in ASW
  3194. output.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, mul(UNITY_MATRIX_M, input.positionOS));;
  3195. output.positionCS = output.positionCSNoJitter;
  3196. #else
  3197. // Jittered. Match the frame.
  3198. output.positionCS = vertexInput.positionCS;
  3199. output.positionCSNoJitter = mul( _NonJitteredViewProjMatrix, mul( UNITY_MATRIX_M, input.positionOS));
  3200. #endif
  3201. float4 prevPos = ( unity_MotionVectorsParams.x == 1 ) ? float4( input.positionOld, 1 ) : input.positionOS;
  3202. #if _ADD_PRECOMPUTED_VELOCITY
  3203. prevPos = prevPos - float4(input.alembicMotionVector, 0);
  3204. #endif
  3205. output.previousPositionCSNoJitter = mul( _PrevViewProjMatrix, mul( UNITY_PREV_MATRIX_M, prevPos ) );
  3206. // removed in ObjectMotionVectors.hlsl found in unity 6000.0.23 and higher
  3207. //ApplyMotionVectorZBias( output.positionCS );
  3208. return output;
  3209. }
  3210. PackedVaryings vert ( Attributes input )
  3211. {
  3212. return VertexFunction( input );
  3213. }
  3214. half4 frag( PackedVaryings input ) : SV_Target
  3215. {
  3216. UNITY_SETUP_INSTANCE_ID(input);
  3217. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  3218. float Alpha = 1;
  3219. float AlphaClipThreshold = 0.5;
  3220. #ifdef _ALPHATEST_ON
  3221. clip(Alpha - AlphaClipThreshold);
  3222. #endif
  3223. #if defined(LOD_FADE_CROSSFADE)
  3224. LODFadeCrossFade( input.positionCS );
  3225. #endif
  3226. #if defined(APLICATION_SPACE_WARP_MOTION)
  3227. return float4( CalcAswNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 1 );
  3228. #else
  3229. return float4( CalcNdcMotionVectorFromCsPositions( input.positionCSNoJitter, input.previousPositionCSNoJitter ), 0, 0 );
  3230. #endif
  3231. }
  3232. ENDHLSL
  3233. }
  3234. }
  3235. CustomEditor "UnityEditor.ShaderGraphLitGUI"
  3236. FallBack "Hidden/Shader Graph/FallbackError"
  3237. Fallback Off
  3238. }
  3239. /*ASEBEGIN
  3240. Version=19701
  3241. Node;AmplifyShaderEditor.CommentaryNode;190;-1599.498,464.2219;Inherit;False;1362.583;719.8359;Base Wind;14;121;126;130;132;131;135;120;128;117;123;122;127;115;208;;1,1,1,1;0;0
  3242. Node;AmplifyShaderEditor.WorldPosInputsNode;115;-1498.6,872.4641;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  3243. Node;AmplifyShaderEditor.SimpleTimeNode;117;-1549.498,1037.057;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
  3244. Node;AmplifyShaderEditor.TextureCoordinatesNode;120;-1616,512;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
  3245. Node;AmplifyShaderEditor.DynamicAppendNode;122;-1272.497,954.0574;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
  3246. Node;AmplifyShaderEditor.DynamicAppendNode;123;-1301.497,1051.057;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
  3247. Node;AmplifyShaderEditor.RangedFloatNode;121;-1584,688;Inherit;False;Constant;_WindGradient;Wind Gradient;9;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0
  3248. Node;AmplifyShaderEditor.AbsOpNode;208;-1344,528;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  3249. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;130;-1222.943,541.8803;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  3250. Node;AmplifyShaderEditor.RangedFloatNode;128;-1118.7,862.7329;Inherit;False;Constant;_WindScale;Wind Scale;9;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0
  3251. Node;AmplifyShaderEditor.SimpleAddOpNode;127;-1096.781,997.645;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0
  3252. Node;AmplifyShaderEditor.RangedFloatNode;126;-1232,672;Inherit;False;Constant;_WindPower;Wind Power;9;0;Create;True;0;0;0;False;0;False;2;0;0;0;0;1;FLOAT;0
  3253. Node;AmplifyShaderEditor.CommentaryNode;136;-2733.351,-235.9568;Inherit;False;1611.704;648.0309;View Dot direction;17;179;160;175;174;171;176;162;163;156;169;167;154;165;166;170;164;194;;1,1,1,1;0;0
  3254. Node;AmplifyShaderEditor.CommentaryNode;118;-2642.938,-1098.401;Inherit;False;535.4534;451.7778;Main Texture;3;181;158;124;;1,1,1,1;0;0
  3255. Node;AmplifyShaderEditor.CommentaryNode;134;-1942.748,-841.6075;Inherit;False;807.9027;481.7047;Specular and Wetness;2;138;197;;1,1,1,1;0;0
  3256. Node;AmplifyShaderEditor.CommentaryNode;191;-1024.483,-1019.55;Inherit;False;204;183;Albedo;1;189;;1,1,1,1;0;0
  3257. Node;AmplifyShaderEditor.CommentaryNode;139;-835.1442,-169.5991;Inherit;False;219;183;Gloss;1;161;;1,1,1,1;0;0
  3258. Node;AmplifyShaderEditor.NoiseGeneratorNode;132;-896,880;Inherit;True;Simplex2D;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT;0
  3259. Node;AmplifyShaderEditor.PowerNode;131;-912,528;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0
  3260. Node;AmplifyShaderEditor.WorldNormalVector;170;-2614.302,152.0811;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  3261. Node;AmplifyShaderEditor.RangedFloatNode;164;-2708.91,304.6805;Inherit;False;Constant;_SubsurfaceDistortionModifire;Subsurface Distortion Modifire;9;0;Create;True;0;0;0;False;0;False;1;0;0;1;0;1;FLOAT;0
  3262. Node;AmplifyShaderEditor.WorldSpaceLightDirHlpNode;165;-2626.518,7.849774;Inherit;False;False;1;0;FLOAT;0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  3263. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;166;-2417.56,208.6358;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
  3264. Node;AmplifyShaderEditor.SimpleAddOpNode;154;-2268.358,84.86289;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
  3265. Node;AmplifyShaderEditor.SamplerNode;124;-2592.938,-876.6215;Inherit;True;Property;_MainTex;MainTex;0;4;[HideInInspector];[PerRendererData];[NoScaleOffset];[SingleLineTexture];Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;gray;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  3266. Node;AmplifyShaderEditor.ViewDirInputsCoordNode;162;-2570.812,-148.6988;Inherit;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  3267. Node;AmplifyShaderEditor.RangedFloatNode;163;-2082.24,46.38039;Inherit;False;Constant;_FresnelBias;Fresnel Bias;9;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0
  3268. Node;AmplifyShaderEditor.RangedFloatNode;169;-2084.681,137.813;Inherit;False;Constant;_FresnelScale;Fresnel Scale;9;0;Create;True;0;0;0;False;0;False;3;0;0;0;0;1;FLOAT;0
  3269. Node;AmplifyShaderEditor.RangedFloatNode;156;-2090.672,224.5666;Inherit;False;Constant;_FresnelPower;Fresnel Power;9;0;Create;True;0;0;0;False;0;False;8.58;0;0;0;0;1;FLOAT;0
  3270. Node;AmplifyShaderEditor.WireNode;192;-2044.878,-565.3229;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
  3271. Node;AmplifyShaderEditor.DotProductOpNode;171;-1983.567,-130.6244;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0
  3272. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;175;-1562.763,44.33999;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  3273. Node;AmplifyShaderEditor.WireNode;193;-2013.168,-316.9221;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
  3274. Node;AmplifyShaderEditor.SaturateNode;174;-1854.326,-123.0989;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  3275. Node;AmplifyShaderEditor.WireNode;194;-1580.099,-116.0389;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
  3276. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;160;-1409.219,-54.58219;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  3277. Node;AmplifyShaderEditor.ColorNode;158;-2527.156,-1048.401;Inherit;False;Property;_WavingTint;WavingTint;1;0;Create;True;0;0;0;False;0;False;1,1,1,0;1,1,1,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
  3278. Node;AmplifyShaderEditor.WireNode;197;-1660.049,-571.5366;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  3279. Node;AmplifyShaderEditor.RangedFloatNode;137;-1037.685,-25.56671;Inherit;False;Property;_Gloss;Gloss;2;0;Create;True;0;0;0;False;0;False;3;3;0;0;0;1;FLOAT;0
  3280. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;181;-2276.484,-938.2457;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  3281. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;179;-1280.926,77.67693;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  3282. Node;AmplifyShaderEditor.SimpleAddOpNode;189;-974.483,-969.5505;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  3283. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;161;-785.1442,-119.5992;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  3284. Node;AmplifyShaderEditor.NegateNode;167;-2144,-32;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  3285. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;135;-528,640;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  3286. Node;AmplifyShaderEditor.AbsOpNode;209;-2080,-816;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0
  3287. Node;AmplifyShaderEditor.TFHCGrayscale;138;-1904,-752;Inherit;True;0;1;0;FLOAT3;0,0,0;False;1;FLOAT;0
  3288. Node;AmplifyShaderEditor.FresnelNode;176;-1881.894,69.32381;Inherit;True;Standard;WorldNormal;ViewDir;False;True;5;0;FLOAT3;0,0,1;False;4;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;5;False;1;FLOAT;0
  3289. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;198;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;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
  3290. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;199;0,0;Float;False;True;-1;2;UnityEditor.ShaderGraphLitGUI;0;12;Hidden/TerrainEngine/Details/WavingDoublePass;94348b07e5e8bab40bd6c8a1e3df54cd;True;Forward;0;1;Forward;21;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;2;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalForward;False;False;0;;0;0;Standard;45;Lighting Model;0;0;Workflow;0;638493901982298916;Surface;0;0; Refraction Model;0;0; Blend;0;0;Two Sided;0;638493902542055865;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
  3291. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;200;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;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
  3292. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;201;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;True;1;LightMode=DepthOnly;False;False;0;;0;0;Standard;0;False;0
  3293. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;202;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;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
  3294. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;203;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=Universal2D;False;False;0;;0;0;Standard;0;False;0
  3295. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;204;0,0;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
  3296. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;205;0,0;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;GBuffer;0;7;GBuffer;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalGBuffer;False;False;0;;0;0;Standard;0;False;0
  3297. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;206;0,0;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
  3298. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;207;0,0;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
  3299. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;210;0,100;Float;False;False;-1;2;UnityEditor.ShaderGraphLitGUI;0;1;New Amplify Shader;94348b07e5e8bab40bd6c8a1e3df54cd;True;MotionVectors;0;10;MotionVectors;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Lit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;False;False;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=MotionVectors;False;False;0;;0;0;Standard;0;False;0
  3300. WireConnection;122;0;115;1
  3301. WireConnection;122;1;115;3
  3302. WireConnection;123;0;117;0
  3303. WireConnection;123;1;117;0
  3304. WireConnection;208;0;120;2
  3305. WireConnection;130;0;208;0
  3306. WireConnection;130;1;121;0
  3307. WireConnection;127;0;122;0
  3308. WireConnection;127;1;123;0
  3309. WireConnection;132;0;127;0
  3310. WireConnection;132;1;128;0
  3311. WireConnection;131;0;130;0
  3312. WireConnection;131;1;126;0
  3313. WireConnection;166;0;170;0
  3314. WireConnection;166;1;164;0
  3315. WireConnection;154;0;165;0
  3316. WireConnection;154;1;166;0
  3317. WireConnection;192;0;124;0
  3318. WireConnection;171;0;162;0
  3319. WireConnection;171;1;167;0
  3320. WireConnection;175;0;124;0
  3321. WireConnection;175;1;176;0
  3322. WireConnection;193;0;192;0
  3323. WireConnection;174;0;171;0
  3324. WireConnection;194;0;193;0
  3325. WireConnection;160;0;174;0
  3326. WireConnection;160;1;175;0
  3327. WireConnection;197;0;138;0
  3328. WireConnection;181;0;158;0
  3329. WireConnection;181;1;124;0
  3330. WireConnection;179;0;194;0
  3331. WireConnection;179;1;160;0
  3332. WireConnection;189;0;179;0
  3333. WireConnection;189;1;181;0
  3334. WireConnection;161;0;197;0
  3335. WireConnection;161;1;137;0
  3336. WireConnection;167;0;154;0
  3337. WireConnection;135;0;131;0
  3338. WireConnection;135;1;132;0
  3339. WireConnection;209;0;124;0
  3340. WireConnection;138;0;209;0
  3341. WireConnection;176;1;163;0
  3342. WireConnection;176;2;169;0
  3343. WireConnection;176;3;156;0
  3344. WireConnection;199;0;189;0
  3345. WireConnection;199;4;161;0
  3346. WireConnection;199;8;135;0
  3347. ASEEND*/
  3348. //CHKSM=48A47B8E01D3445C4D3368C4375AA126421853D7