UV wave.shader 127 KB

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