Toby Standard Shader.shader 130 KB

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