Lit.shader 143 KB

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