Simple Coverage.shader 158 KB

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