CTI URP Bark Array.shader 122 KB

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