Waterfall Base.shader 121 KB

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