123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946 |
- Shader /*ase_name*/ "Hidden/Universal/Unlit" /*end*/
- {
- Properties
- {
- /*ase_props*/
- //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
- //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
- //_TessMin( "Tess Min Distance", Float ) = 10
- //_TessMax( "Tess Max Distance", Float ) = 25
- //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
- //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
- [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0
- [HideInInspector] _QueueControl("_QueueControl", Float) = -1
- [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
- [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
- [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
- [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0
- }
- SubShader
- {
- /*ase_subshader_options:Name=Additional Options
- Option:Surface:Opaque,Transparent:Opaque
- Opaque:SetPropertyOnSubShader:RenderType,Opaque
- Opaque:SetPropertyOnSubShader:RenderQueue,Geometry
- Opaque:SetPropertyOnPass:Forward:ZWrite,On
- Opaque:HideOption: Blend
- Opaque:RemoveDefine:_SURFACE_TYPE_TRANSPARENT 1
- Opaque:HidePort:Forward:Alpha
- Opaque:RefreshOption:Alpha Clipping
- Opaque:ExcludePass:Universal2D
- Opaque:ExcludePass:DepthNormalsOnly
- Transparent:SetPropertyOnSubShader:RenderType,Transparent
- Transparent:SetPropertyOnSubShader:RenderQueue,Transparent
- Transparent:SetPropertyOnPass:Forward:ZWrite,Off
- Transparent:ShowOption: Blend
- Transparent:SetDefine:_SURFACE_TYPE_TRANSPARENT 1
- Transparent:ShowPort:Forward:Alpha
- Transparent:ExcludePass:Universal2D
- Transparent:ExcludePass:DepthNormalsOnly
- Option: Blend:Alpha,Premultiply,Additive,Multiply:Alpha
- Alpha:SetPropertyOnPass:Forward:BlendRGB,SrcAlpha,OneMinusSrcAlpha
- Premultiply:SetPropertyOnPass:Forward:BlendRGB,One,OneMinusSrcAlpha
- Additive:SetPropertyOnPass:Forward:BlendRGB,One,One
- Multiply:SetPropertyOnPass:Forward:BlendRGB,DstColor,Zero
- Alpha,Premultiply,Additive:SetPropertyOnPass:Forward:BlendAlpha,One,OneMinusSrcAlpha
- Multiply:SetPropertyOnPass:Forward:BlendAlpha,One,Zero
- disable:SetPropertyOnPass:Forward:BlendRGB,One,Zero
- disable:SetPropertyOnPass:Forward:BlendAlpha,One,Zero
- Option:Two Sided:On,Cull Back,Cull Front:Cull Back
- On:SetPropertyOnSubShader:CullMode,Off
- Cull Back:SetPropertyOnSubShader:CullMode,Back
- Cull Front:SetPropertyOnSubShader:CullMode,Front
- Option:Alpha Clipping:false,true:true
- true:ShowPort:Forward:Alpha
- true:ShowPort:Forward:Alpha Clip Threshold
- true?Cast Shadows=true:ShowOption: Use Shadow Threshold
- true?Surface=Opaque:SetPropertyOnSubShader:RenderType,TransparentCutout
- true?Surface=Opaque:SetPropertyOnSubShader:RenderQueue,AlphaTest
- true:SetDefine:Forward:pragma multi_compile_fragment _ALPHATEST_ON
- true:SetDefine:Meta:pragma multi_compile_fragment _ALPHATEST_ON
- true:SetDefine:Universal2D:pragma multi_compile_fragment _ALPHATEST_ON
- true:SetDefine:ShadowCaster:pragma multi_compile _ALPHATEST_ON
- true:SetDefine:DepthOnly:pragma multi_compile _ALPHATEST_ON
- true:SetDefine:DepthNormals:pragma multi_compile _ALPHATEST_ON
- false:HidePort:Forward:Alpha Clip Threshold
- false:SetOption: Use Shadow Threshold,0
- false:HideOption: Use Shadow Threshold
- false:RefreshOption:Surface
- false:RemoveDefine:Forward:pragma multi_compile_fragment _ALPHATEST_ON
- false:RemoveDefine:Meta:pragma multi_compile_fragment _ALPHATEST_ON
- false:RemoveDefine:Universal2D:pragma multi_compile_fragment _ALPHATEST_ON
- false:RemoveDefine:ShadowCaster:pragma multi_compile _ALPHATEST_ON
- false:RemoveDefine:DepthOnly:pragma multi_compile _ALPHATEST_ON
- false:RemoveDefine:DepthNormals:pragma multi_compile _ALPHATEST_ON
- Option: Use Shadow Threshold:false,true:false
- true:ShowPort:Forward:Alpha Clip Threshold Shadow
- true:SetDefine:_ALPHATEST_SHADOW_ON 1
- false,disable:RemoveDefine:_ALPHATEST_SHADOW_ON 1
- false,disable:HidePort:Forward:Alpha Clip Threshold Shadow
- Option:Forward Only:false,true:false
- false,disable:SetPropertyOnPass:Forward:ChangeTagValue,LightMode,UniversalForward
- false,disable:SetPropertyOnPass:DepthNormals:ChangeTagValue,LightMode,DepthNormals
- true:SetPropertyOnPass:Forward:ChangeTagValue,LightMode,UniversalForwardOnly
- true:SetPropertyOnPass:DepthNormals:ChangeTagValue,LightMode,DepthNormalsOnly
- Option:Cast Shadows:false,true:true
- true:IncludePass:ShadowCaster
- false,disable:ExcludePass:ShadowCaster
- true?Alpha Clipping=true:ShowOption: Use Shadow Threshold
- false:HideOption: Use Shadow Threshold
- Option:Receive Shadows:false,true:true
- true:SetDefine:Forward:pragma shader_feature_local _RECEIVE_SHADOWS_OFF
- false:RemoveDefine:Forward:pragma shader_feature_local _RECEIVE_SHADOWS_OFF
- Option:GPU Instancing:false,true:true
- true:SetDefine:Forward:pragma multi_compile_instancing
- true:SetDefine:ShadowCaster:pragma multi_compile_instancing
- true:SetDefine:DepthOnly:pragma multi_compile_instancing
- true:SetDefine:DepthNormals:pragma multi_compile_instancing
- false:RemoveDefine:Forward:pragma multi_compile_instancing
- false:RemoveDefine:ShadowCaster:pragma multi_compile_instancing
- false:RemoveDefine:DepthOnly:pragma multi_compile_instancing
- false:RemoveDefine:DepthNormals:pragma multi_compile_instancing
- true:SetDefine:Forward:pragma instancing_options renderinglayer
- false:RemoveDefine:Forward:pragma instancing_options renderinglayer
- Option:LOD CrossFade:false,true:true
- true:SetDefine:Forward:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- true:SetDefine:ShadowCaster:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- true:SetDefine:DepthOnly:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- true:SetDefine:DepthNormals:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- false:RemoveDefine:Forward:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- false:RemoveDefine:ShadowCaster:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- false:RemoveDefine:DepthOnly:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- false:RemoveDefine:DepthNormals:pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
- Option:Built-in Fog:false,true:true
- true:SetDefine:Forward:pragma multi_compile_fog
- false:RemoveDefine:Forward:pragma multi_compile_fog
- true:SetDefine:ASE_FOG 1
- false:RemoveDefine:ASE_FOG 1
- Option:Meta Pass:false,true:false
- true:IncludePass:Meta
- true:ShowPort:Forward:Baked Albedo
- true:ShowPort:Forward:Baked Emission
- false,disable:ExcludePass:Meta
- false:HidePort:Forward:Baked Albedo
- false:HidePort:Forward:Baked Emission
- Option:Extra Pre Pass:false,true:false
- true:IncludePass:ExtraPrePass
- false,disable:ExcludePass:ExtraPrePass
- Option:Tessellation:false,true:false
- true:SetDefine:ASE_TESSELLATION 1
- true:SetDefine:pragma require tessellation tessHW
- true:SetDefine:pragma hull HullFunction
- true:SetDefine:pragma domain DomainFunction
- true:ShowOption: Phong
- true:ShowOption: Type
- false,disable:RemoveDefine:ASE_TESSELLATION 1
- false,disable:RemoveDefine:pragma require tessellation tessHW
- false,disable:RemoveDefine:pragma hull HullFunction
- false,disable:RemoveDefine:pragma domain DomainFunction
- false,disable:HideOption: Phong
- false,disable:HideOption: Type
- Option: Phong:false,true:false
- true:SetDefine:ASE_PHONG_TESSELLATION
- false,disable:RemoveDefine:ASE_PHONG_TESSELLATION
- true:ShowOption: Strength
- false,disable:HideOption: Strength
- Field: Strength:Float:0.5:0:1:_TessPhongStrength
- Change:SetMaterialProperty:_TessPhongStrength
- Change:SetShaderProperty:_TessPhongStrength,_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5
- Inline,disable:SetShaderProperty:_TessPhongStrength,//_TessPhongStrength( "Phong Tess Strength", Range( 0, 1 ) ) = 0.5
- Option: Type:Fixed,Distance Based,Edge Length,Edge Length Cull:Fixed
- Fixed:SetDefine:ASE_FIXED_TESSELLATION
- Fixed,Distance Based:ShowOption: Tess
- Distance Based:SetDefine:ASE_DISTANCE_TESSELLATION
- Distance Based:ShowOption: Min
- Distance Based:ShowOption: Max
- Edge Length:SetDefine:ASE_LENGTH_TESSELLATION
- Edge Length,Edge Length Cull:ShowOption: Edge Length
- Edge Length Cull:SetDefine:ASE_LENGTH_CULL_TESSELLATION
- Edge Length Cull:ShowOption: Max Displacement
- disable,Distance Based,Edge Length,Edge Length Cull:RemoveDefine:ASE_FIXED_TESSELLATION
- disable,Fixed,Edge Length,Edge Length Cull:RemoveDefine:ASE_DISTANCE_TESSELLATION
- disable,Fixed,Distance Based,Edge Length Cull:RemoveDefine:ASE_LENGTH_TESSELLATION
- disable,Fixed,Distance Based,Edge Length:RemoveDefine:ASE_LENGTH_CULL_TESSELLATION
- disable,Edge Length,Edge Length Cull:HideOption: Tess
- disable,Fixed,Edge Length,Edge Length Cull:HideOption: Min
- disable,Fixed,Edge Length,Edge Length Cull:HideOption: Max
- disable,Fixed,Distance Based:HideOption: Edge Length
- disable,Fixed,Distance Based,Edge Length:HideOption: Max Displacement
- Field: Tess:Float:16:1:32:_TessValue
- Change:SetMaterialProperty:_TessValue
- Change:SetShaderProperty:_TessValue,_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16
- Inline,disable:SetShaderProperty:_TessValue,//_TessValue( "Max Tessellation", Range( 1, 32 ) ) = 16
- Field: Min:Float:10:_TessMin
- Change:SetMaterialProperty:_TessMin
- Change:SetShaderProperty:_TessMin,_TessMin( "Tess Min Distance", Float ) = 10
- Inline,disable:SetShaderProperty:_TessMin,//_TessMin( "Tess Min Distance", Float ) = 10
- Field: Max:Float:25:_TessMax
- Change:SetMaterialProperty:_TessMax
- Change:SetShaderProperty:_TessMax,_TessMax( "Tess Max Distance", Float ) = 25
- Inline,disable:SetShaderProperty:_TessMax,//_TessMax( "Tess Max Distance", Float ) = 25
- Field: Edge Length:Float:16:2:50:_TessEdgeLength
- Change:SetMaterialProperty:_TessEdgeLength
- Change:SetShaderProperty:_TessEdgeLength,_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16
- Inline,disable:SetShaderProperty:_TessEdgeLength,//_TessEdgeLength ( "Edge length", Range( 2, 50 ) ) = 16
- Field: Max Displacement:Float:25:_TessMaxDisp
- Change:SetMaterialProperty:_TessMaxDisp
- Change:SetShaderProperty:_TessMaxDisp,_TessMaxDisp( "Max Displacement", Float ) = 25
- Inline,disable:SetShaderProperty:_TessMaxDisp,//_TessMaxDisp( "Max Displacement", Float ) = 25
- Option:Write Depth:false,true:false
- true:SetDefine:ASE_DEPTH_WRITE_ON
- true:ShowOption: Early Z
- true:ShowPort:Forward:Depth Value
- false,disable:RemoveDefine:ASE_DEPTH_WRITE_ON
- false,disable:HideOption: Early Z
- false,disable:HidePort:Forward:Depth Value
- Option: Early Z:false,true:false
- true:SetDefine:ASE_EARLY_Z_DEPTH_OPTIMIZE
- false,disable:RemoveDefine:ASE_EARLY_Z_DEPTH_OPTIMIZE
- Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative
- Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1
- Absolute:SetPortName:Forward:5,Vertex Position
- Relative:SetPortName:Forward:5,Vertex Offset
- Absolute:SetPortName:ExtraPrePass:3,Vertex Position
- Relative:SetPortName:ExtraPrePass:3,Vertex Offset
- */
- Tags
- {
- "RenderPipeline" = "UniversalPipeline"
- "RenderType"="Opaque"
- "Queue"="Geometry+0"
- "UniversalMaterialType"="Unlit"
- }
- Cull Back
- AlphaToMask Off
- /*ase_stencil*/
- HLSLINCLUDE
- #pragma target 4.5
- #pragma prefer_hlslcc gles
- #pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
- #ifndef ASE_TESS_FUNCS
- #define ASE_TESS_FUNCS
- float4 FixedTess( float tessValue )
- {
- return tessValue;
- }
- float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
- {
- float3 wpos = mul(o2w,vertex).xyz;
- float dist = distance (wpos, cameraPos);
- float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
- return f;
- }
- float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
- {
- float4 tess;
- tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
- tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
- tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
- tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
- return tess;
- }
- float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
- {
- float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
- float len = distance(wpos0, wpos1);
- float f = max(len * scParams.y / (edgeLen * dist), 1.0);
- return f;
- }
- float DistanceFromPlane (float3 pos, float4 plane)
- {
- float d = dot (float4(pos,1.0f), plane);
- return d;
- }
- bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
- {
- float4 planeTest;
- planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
- planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
- planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
- planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
- (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
- return !all (planeTest);
- }
- float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
- {
- float3 f;
- f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
- f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
- f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
- return CalcTriEdgeTessFactors (f);
- }
- float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
- {
- float3 pos0 = mul(o2w,v0).xyz;
- float3 pos1 = mul(o2w,v1).xyz;
- float3 pos2 = mul(o2w,v2).xyz;
- float4 tess;
- tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
- tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
- tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
- tess.w = (tess.x + tess.y + tess.z) / 3.0f;
- return tess;
- }
- float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
- {
- float3 pos0 = mul(o2w,v0).xyz;
- float3 pos1 = mul(o2w,v1).xyz;
- float3 pos2 = mul(o2w,v2).xyz;
- float4 tess;
- if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
- {
- tess = 0.0f;
- }
- else
- {
- tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
- tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
- tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
- tess.w = (tess.x + tess.y + tess.z) / 3.0f;
- }
- return tess;
- }
- #endif //ASE_TESS_FUNCS
- ENDHLSL
- /*ase_pass*/
- Pass
- {
- Name "ExtraPrePass"
- Tags{ }
- Blend One Zero
- Cull Back
- ZWrite On
- ZTest LEqual
- Offset 0,0
- ColorMask RGBA
- /*ase_stencil*/
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma vertex vert
- #pragma fragment frag
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- float4 clipPosV : TEXCOORD0;
- float3 positionWS : TEXCOORD1;
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- float4 shadowCoord : TEXCOORD2;
- #endif
- #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX)
- half4 fogFactorAndVertexLight : TEXCOORD3;
- #endif
- /*ase_interp(4,):sp=sp;wp=tc1;sc=tc2*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output = (PackedVaryings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_VertexP*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;4;-1;_NormalP*/input.normalOS/*end*/;
- VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- output.shadowCoord = GetShadowCoord( vertexInput );
- #endif
- #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX)
- output.fogFactorAndVertexLight = 0;
- #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT)
- output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z);
- #endif
- #ifdef _ADDITIONAL_LIGHTS_VERTEX
- half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
- output.fogFactorAndVertexLight.yzw = vertexLight;
- #endif
- #endif
- output.positionCS = vertexInput.positionCS;
- output.clipPosV = vertexInput.positionCS;
- output.positionWS = vertexInput.positionWS;
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag ( PackedVaryings input /*ase_frag_input*/ ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID( input );
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition );
- /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 );
- /*ase_local_var:sp*/float4 ClipPos = input.clipPosV;
- /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV );
- #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
- ShadowCoords = input.shadowCoord;
- #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
- ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
- #endif
- #endif
- InputData inputData = (InputData)0;
- inputData.positionWS = WorldPosition;
- inputData.viewDirectionWS = WorldViewDirection;
- #ifdef ASE_FOG
- inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
- #endif
- #ifdef _ADDITIONAL_LIGHTS_VERTEX
- inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
- #endif
- /*ase_frag_code:input=PackedVaryings*/
- float3 Color = /*ase_frag_out:Color;Float3;0;-1;_ColorP*/float3( 0, 0, 0 )/*end*/;
- float Alpha = /*ase_frag_out:Alpha;Float;1;-1;_AlphaP*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;2;-1;_AlphaClipP*/0.5/*end*/;
- #ifdef _ALPHATEST_ON
- clip( Alpha - AlphaClipThreshold );
- #endif
- #ifdef ASE_FOG
- #ifdef TERRAIN_SPLAT_ADDPASS
- Color.rgb = MixFogColor(Color.rgb, half3(0,0,0), inputData.fogCoord);
- #else
- Color.rgb = MixFog(Color.rgb, inputData.fogCoord);
- #endif
- #endif
- #if defined(LOD_FADE_CROSSFADE)
- LODFadeCrossFade( input.positionCS );
- #endif
- return half4( Color, Alpha );
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_main_pass*/
- Name "Forward"
- Tags
- {
- "LightMode" = "UniversalForwardOnly"
- }
- Blend One Zero
- ZWrite On
- ZTest LEqual
- Offset 0,0
- ColorMask RGBA
- /*ase_stencil*/
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
- #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
- /*ase_srp_cond_end*/
- #pragma multi_compile _ DIRLIGHTMAP_COMBINED
- #pragma multi_compile _ LIGHTMAP_ON
- #pragma multi_compile _ DYNAMICLIGHTMAP_ON
- #pragma multi_compile_fragment _ DEBUG_DISPLAY
- #pragma vertex vert
- #pragma fragment frag
- #define SHADERPASS SHADERPASS_UNLIT
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- /*ase_srp_cond_begin:>=140010*/
- #if ASE_SRP_VERSION >=140010
- #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:<140010*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
- #define ASE_SV_DEPTH SV_DepthLessEqual
- #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
- #else
- #define ASE_SV_DEPTH SV_Depth
- #define ASE_SV_POSITION_QUALIFIERS
- #endif
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- float4 texcoord : TEXCOORD0;
- float4 texcoord1 : TEXCOORD1;
- float4 texcoord2 : TEXCOORD2;
- /*ase_vdata:p=p;n=n;uv0=tc0;uv1=tc1;uv2=tc2*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
- float4 clipPosV : TEXCOORD0;
- float3 positionWS : TEXCOORD1;
- #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX)
- half4 fogFactorAndVertexLight : TEXCOORD2;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- float4 shadowCoord : TEXCOORD3;
- #endif
- #if defined(LIGHTMAP_ON)
- float4 lightmapUVOrVertexSH : TEXCOORD4;
- #endif
- #if defined(DYNAMICLIGHTMAP_ON)
- float2 dynamicLightmapUV : TEXCOORD5;
- #endif
- /*ase_interp(6,):sp=sp;wp=tc1;sc=tc3*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output = (PackedVaryings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;5;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;6;-1;_Normal*/input.normalOS/*end*/;
- VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
- #if defined(LIGHTMAP_ON)
- OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy);
- #endif
- #if defined(DYNAMICLIGHTMAP_ON)
- output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
- #endif
- #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX)
- output.fogFactorAndVertexLight = 0;
- #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT)
- output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z);
- #endif
- #ifdef _ADDITIONAL_LIGHTS_VERTEX
- half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
- output.fogFactorAndVertexLight.yzw = vertexLight;
- #endif
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- output.shadowCoord = GetShadowCoord( vertexInput );
- #endif
- output.positionCS = vertexInput.positionCS;
- output.clipPosV = vertexInput.positionCS;
- output.positionWS = vertexInput.positionWS;
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag ( PackedVaryings input
- #ifdef ASE_DEPTH_WRITE_ON
- ,out float outputDepth : ASE_SV_DEPTH
- #endif
- #ifdef _WRITE_RENDERING_LAYERS
- , out float4 outRenderingLayers : SV_Target1
- #endif
- /*ase_frag_input*/ ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
- #if defined(LOD_FADE_CROSSFADE)
- LODFadeCrossFade( input.positionCS );
- #endif
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- /*ase_local_var:wvd*/float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition );
- /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 );
- /*ase_local_var:sp*/float4 ClipPos = input.clipPosV;
- /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV );
- float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
- #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
- ShadowCoords = input.shadowCoord;
- #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
- ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
- #endif
- #endif
- /*ase_frag_code:input=PackedVaryings*/
- float3 BakedAlbedo = /*ase_frag_out:Baked Albedo;Float3;0;-1;_Albedo*/0/*end*/;
- float3 BakedEmission = /*ase_frag_out:Baked Emission;Float3;1;-1;_Emission*/0/*end*/;
- float3 Color = /*ase_frag_out:Color;Float3;2;-1;_Color*/float3(0.5, 0.5, 0.5)/*end*/;
- float Alpha = /*ase_frag_out:Alpha;Float;3;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;4;-1;_AlphaClip*/0.5/*end*/;
- float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;7;-1;_AlphaClipShadow*/0.5/*end*/;
- #ifdef ASE_DEPTH_WRITE_ON
- float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/;
- #endif
- #ifdef _ALPHATEST_ON
- clip(Alpha - AlphaClipThreshold);
- #endif
- InputData inputData = (InputData)0;
- inputData.positionWS = WorldPosition;
- inputData.viewDirectionWS = WorldViewDirection;
- #ifdef ASE_FOG
- inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
- #endif
- #ifdef _ADDITIONAL_LIGHTS_VERTEX
- inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
- #endif
- inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
- #if defined(_DBUFFER)
- ApplyDecalToBaseColor(input.positionCS, Color);
- #endif
- #ifdef ASE_FOG
- #ifdef TERRAIN_SPLAT_ADDPASS
- Color.rgb = MixFogColor(Color.rgb, half3(0,0,0), inputData.fogCoord);
- #else
- Color.rgb = MixFog(Color.rgb, inputData.fogCoord);
- #endif
- #endif
- #ifdef ASE_DEPTH_WRITE_ON
- outputDepth = DepthValue;
- #endif
- #ifdef _WRITE_RENDERING_LAYERS
- uint renderingLayers = GetMeshRenderingLayer();
- outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
- #endif
- return half4( Color, Alpha );
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_hide_pass*/
- Name "ShadowCaster"
- Tags
- {
- "LightMode" = "ShadowCaster"
- }
- ZWrite On
- ZTest LEqual
- AlphaToMask Off
- ColorMask 0
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
- #pragma vertex vert
- #pragma fragment frag
- #define SHADERPASS SHADERPASS_SHADOWCASTER
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
- #define ASE_SV_DEPTH SV_DepthLessEqual
- #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
- #else
- #define ASE_SV_DEPTH SV_Depth
- #define ASE_SV_POSITION_QUALIFIERS
- #endif
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
- float4 clipPosV : TEXCOORD0;
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- float3 positionWS : TEXCOORD1;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- float4 shadowCoord : TEXCOORD2;
- #endif
- /*ase_interp(3,):sp=sp;wp=tc1;sc=tc2*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- float3 _LightDirection;
- float3 _LightPosition;
- PackedVaryings VertexFunction( Attributes input/*ase_vert_input*/ )
- {
- PackedVaryings output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( output );
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/;
- float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- output.positionWS = positionWS;
- #endif
- float3 normalWS = TransformObjectToWorldDir(input.normalOS);
- #if _CASTING_PUNCTUAL_LIGHT_SHADOW
- float3 lightDirectionWS = normalize(_LightPosition - positionWS);
- #else
- float3 lightDirectionWS = _LightDirection;
- #endif
- float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
- #if UNITY_REVERSED_Z
- positionCS.z = min(positionCS.z, UNITY_NEAR_CLIP_VALUE);
- #else
- positionCS.z = max(positionCS.z, UNITY_NEAR_CLIP_VALUE);
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- VertexPositionInputs vertexInput = (VertexPositionInputs)0;
- vertexInput.positionWS = positionWS;
- vertexInput.positionCS = positionCS;
- output.shadowCoord = GetShadowCoord( vertexInput );
- #endif
- output.positionCS = positionCS;
- output.clipPosV = positionCS;
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag(PackedVaryings input
- #ifdef ASE_DEPTH_WRITE_ON
- ,out float outputDepth : ASE_SV_DEPTH
- #endif
- /*ase_frag_input*/ ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID( input );
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- #endif
- /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 );
- /*ase_local_var:sp*/float4 ClipPos = input.clipPosV;
- /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV );
- #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
- ShadowCoords = input.shadowCoord;
- #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
- ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
- #endif
- #endif
- /*ase_frag_code:input=PackedVaryings*/
- float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/;
- float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;4;-1;_AlphaClipShadow*/0.5/*end*/;
- #ifdef ASE_DEPTH_WRITE_ON
- float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/;
- #endif
- #ifdef _ALPHATEST_ON
- #ifdef _ALPHATEST_SHADOW_ON
- clip(Alpha - AlphaClipThresholdShadow);
- #else
- clip(Alpha - AlphaClipThreshold);
- #endif
- #endif
- #if defined(LOD_FADE_CROSSFADE)
- LODFadeCrossFade( input.positionCS );
- #endif
- #ifdef ASE_DEPTH_WRITE_ON
- outputDepth = DepthValue;
- #endif
- return 0;
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_hide_pass*/
- Name "DepthOnly"
- Tags
- {
- "LightMode" = "DepthOnly"
- }
- ZWrite On
- ColorMask R
- AlphaToMask Off
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma vertex vert
- #pragma fragment frag
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
- #define ASE_SV_DEPTH SV_DepthLessEqual
- #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
- #else
- #define ASE_SV_DEPTH SV_Depth
- #define ASE_SV_POSITION_QUALIFIERS
- #endif
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
- float4 clipPosV : TEXCOORD0;
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- float3 positionWS : TEXCOORD1;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- float4 shadowCoord : TEXCOORD2;
- #endif
- /*ase_interp(3,):sp=sp;wp=tc1;sc=tc2*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output = (PackedVaryings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/;
- VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- output.positionWS = vertexInput.positionWS;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- output.shadowCoord = GetShadowCoord( vertexInput );
- #endif
- output.positionCS = vertexInput.positionCS;
- output.clipPosV = vertexInput.positionCS;
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag(PackedVaryings input
- #ifdef ASE_DEPTH_WRITE_ON
- ,out float outputDepth : ASE_SV_DEPTH
- #endif
- /*ase_frag_input*/ ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- #endif
- /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 );
- /*ase_local_var:sp*/float4 ClipPos = input.clipPosV;
- /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV );
- #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
- ShadowCoords = input.shadowCoord;
- #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
- ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
- #endif
- #endif
- /*ase_frag_code:input=PackedVaryings*/
- float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/;
- #ifdef ASE_DEPTH_WRITE_ON
- float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/;
- #endif
- #ifdef _ALPHATEST_ON
- clip(Alpha - AlphaClipThreshold);
- #endif
- #if defined(LOD_FADE_CROSSFADE)
- LODFadeCrossFade( input.positionCS );
- #endif
- #ifdef ASE_DEPTH_WRITE_ON
- outputDepth = DepthValue;
- #endif
- return 0;
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_hide_pass*/
- Name "Meta"
- Tags
- {
- "LightMode" = "Meta"
- }
- Cull Off
- HLSLPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- /*ase_pragma*/
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- float4 texcoord1 : TEXCOORD1;
- float4 texcoord2 : TEXCOORD2;
- /*ase_vdata:p=p;n=n;uv1=tc1;uv2=tc2*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- float3 positionWS : TEXCOORD0;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- float4 shadowCoord : TEXCOORD1;
- #endif
- /*ase_interp(2,):sp=sp;wp=tc0;sc=tc1*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TRANSMISSION
- float _TransmissionShadow;
- #endif
- #ifdef ASE_TRANSLUCENCY
- float _TransStrength;
- float _TransNormal;
- float _TransScattering;
- float _TransDirect;
- float _TransAmbient;
- float _TransShadow;
- #endif
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- #ifdef SCENEPICKINGPASS
- float4 _SelectionID;
- #endif
- #ifdef SCENESELECTIONPASS
- int _ObjectId;
- int _PassValue;
- #endif
- /*ase_globals*/
- /*ase_funcs*/
- PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output = (PackedVaryings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;4;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;5;-1;_Normal*/input.normalOS/*end*/;
- float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- output.positionWS = positionWS;
- #endif
- output.positionCS = MetaVertexPosition( input.positionOS, input.texcoord1.xy, input.texcoord1.xy, unity_LightmapST, unity_DynamicLightmapST );
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- VertexPositionInputs vertexInput = (VertexPositionInputs)0;
- vertexInput.positionWS = positionWS;
- vertexInput.positionCS = output.positionCS;
- output.shadowCoord = GetShadowCoord( vertexInput );
- #endif
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- float4 texcoord1 : TEXCOORD1;
- float4 texcoord2 : TEXCOORD2;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- output.texcoord1 = input.texcoord1;
- output.texcoord2 = input.texcoord2;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- output.texcoord1 = patch[0].texcoord1 * bary.x + patch[1].texcoord1 * bary.y + patch[2].texcoord1 * bary.z;
- output.texcoord2 = patch[0].texcoord2 * bary.x + patch[1].texcoord2 * bary.y + patch[2].texcoord2 * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag(PackedVaryings input /*ase_frag_input*/ ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- #endif
- /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 );
- #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
- ShadowCoords = input.shadowCoord;
- #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
- ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
- #endif
- #endif
- /*ase_frag_code:input=PackedVaryings*/
- float3 BakedAlbedo = /*ase_frag_out:Baked Albedo;Float3;0;-1;_Albedo*/0/*end*/;
- float3 BakedEmission = /*ase_frag_out:Baked Emission;Float3;1;-1;_Emission*/0/*end*/;
- float Alpha = /*ase_frag_out:Alpha;Float;2;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;3;-1;_AlphaClip*/0.5/*end*/;
- #ifdef _ALPHATEST_ON
- clip(Alpha - AlphaClipThreshold);
- #endif
- MetaInput metaInput = (MetaInput)0;
- metaInput.Albedo = BakedAlbedo;
- metaInput.Emission = BakedEmission;
- return MetaFragment(metaInput);
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass // -- DEPRECATED --
- {
- /*ase_hide_pass:SyncP*/
- Name "Universal2D"
- Tags
- {
- "LightMode" = "Universal2D"
- }
- Blend One Zero
- ZWrite On
- ZTest LEqual
- Offset 0,0
- ColorMask RGBA
- /*ase_stencil*/
- HLSLPROGRAM
- #pragma multi_compile _ LIGHTMAP_ON
- #pragma multi_compile _ DIRLIGHTMAP_COMBINED
- #pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
- #pragma multi_compile _ DEBUG_DISPLAY
- #pragma vertex vert
- #pragma fragment frag
- #define SHADERPASS SHADERPASS_UNLIT
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- /*ase_srp_cond_begin:>=140010*/
- #if ASE_SRP_VERSION >=140010
- #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:<140010*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl"
- /*ase_pragma*/
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- float3 positionWS : TEXCOORD0;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- float4 shadowCoord : TEXCOORD1;
- #endif
- #ifdef ASE_FOG
- float fogFactor : TEXCOORD2;
- #endif
- /*ase_interp(3,):sp=sp;wp=tc0;sc=tc1*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- /*ase_globals*/
- /*ase_funcs*/
- PackedVaryings vert( Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output = (PackedVaryings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;5;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;6;-1;_Normal*/input.normalOS/*end*/;
- float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
- float4 positionCS = TransformWorldToHClip( positionWS );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- output.positionWS = positionWS;
- #endif
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- VertexPositionInputs vertexInput = (VertexPositionInputs)0;
- vertexInput.positionWS = positionWS;
- vertexInput.positionCS = positionCS;
- output.shadowCoord = GetShadowCoord( vertexInput );
- #endif
- #ifdef ASE_FOG
- output.fogFactor = ComputeFogFactor( positionCS.z );
- #endif
- output.positionCS = positionCS;
- return output;
- }
- half4 frag ( PackedVaryings input /*ase_frag_input*/ ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID( input );
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
- #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- #endif
- /*ase_local_var:sc*/float4 ShadowCoords = float4( 0, 0, 0, 0 );
- #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
- #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
- ShadowCoords = input.shadowCoord;
- #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
- ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
- #endif
- #endif
- /*ase_frag_code:input=PackedVaryings*/
- float3 BakedAlbedo = /*ase_frag_out:Baked Albedo;Float3;0;-1;_Albedo*/0/*end*/;
- float3 BakedEmission = /*ase_frag_out:Baked Emission;Float3;1;-1;_Emission*/0/*end*/;
- float3 Color = /*ase_frag_out:Color;Float3;2;-1;_Color*/float3( 0.5, 0.5, 0.5 )/*end*/;
- float Alpha = /*ase_frag_out:Alpha;Float;3;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;4;-1;_AlphaClip*/0.5/*end*/;
- float AlphaClipThresholdShadow = /*ase_frag_out:Alpha Clip Threshold Shadow;Float;7;-1;_AlphaClipShadow*/0.5/*end*/;
- #ifdef _ALPHATEST_ON
- clip( Alpha - AlphaClipThreshold );
- #endif
- #if defined(_DBUFFER)
- ApplyDecalToBaseColor(input.positionCS, Color);
- #endif
- #ifdef ASE_FOG
- Color = MixFog( Color, input.fogFactor );
- #endif
- return half4( Color, Alpha );
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_hide_pass*/
- Name "SceneSelectionPass"
- Tags
- {
- "LightMode" = "SceneSelectionPass"
- }
- Cull Off
- AlphaToMask Off
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma vertex vert
- #pragma fragment frag
- #define ATTRIBUTES_NEED_NORMAL
- #define ATTRIBUTES_NEED_TANGENT
- #define SHADERPASS SHADERPASS_DEPTHONLY
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- /*ase_srp_cond_begin:>=140010*/
- #if ASE_SRP_VERSION >=140010
- #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:<140010*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- /*ase_pragma*/
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- /*ase_interp(0,):sp=sp*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- int _ObjectId;
- int _PassValue;
- struct SurfaceDescription
- {
- float Alpha;
- float AlphaClipThreshold;
- };
- PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output;
- ZERO_INITIALIZE(PackedVaryings, output);
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/;
- float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
- output.positionCS = TransformWorldToHClip(positionWS);
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target
- {
- SurfaceDescription surfaceDescription = (SurfaceDescription)0;
- /*ase_frag_code:input=PackedVaryings*/
- surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/;
- surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/;
- #if _ALPHATEST_ON
- float alphaClipThreshold = 0.01f;
- #if ALPHA_CLIP_THRESHOLD
- alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
- #endif
- clip(surfaceDescription.Alpha - alphaClipThreshold);
- #endif
- half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
- return outColor;
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_hide_pass*/
- Name "ScenePickingPass"
- Tags
- {
- "LightMode" = "Picking"
- }
- AlphaToMask Off
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma vertex vert
- #pragma fragment frag
- #define ATTRIBUTES_NEED_NORMAL
- #define ATTRIBUTES_NEED_TANGENT
- #define SHADERPASS SHADERPASS_DEPTHONLY
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- /*ase_srp_cond_begin:>=140010*/
- #if ASE_SRP_VERSION >=140010
- #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:<140010*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- /*ase_interp(0,):sp=sp*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- float4 _SelectionID;
- struct SurfaceDescription
- {
- float Alpha;
- float AlphaClipThreshold;
- };
- PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output;
- ZERO_INITIALIZE(PackedVaryings, output);
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/;
- float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
- output.positionCS = TransformWorldToHClip(positionWS);
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target
- {
- SurfaceDescription surfaceDescription = (SurfaceDescription)0;
- /*ase_frag_code:input=PackedVaryings*/
- surfaceDescription.Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/;
- surfaceDescription.AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/;
- #if _ALPHATEST_ON
- float alphaClipThreshold = 0.01f;
- #if ALPHA_CLIP_THRESHOLD
- alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
- #endif
- clip(surfaceDescription.Alpha - alphaClipThreshold);
- #endif
- half4 outColor = 0;
- outColor = _SelectionID;
- return outColor;
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass
- {
- /*ase_hide_pass*/
- Name "DepthNormals"
- Tags
- {
- "LightMode" = "DepthNormalsOnly"
- }
- ZTest LEqual
- ZWrite On
- HLSLPROGRAM
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
- /*ase_srp_cond_end*/
- #pragma vertex vert
- #pragma fragment frag
- #define ATTRIBUTES_NEED_NORMAL
- #define ATTRIBUTES_NEED_TANGENT
- #define VARYINGS_NEED_NORMAL_WS
- #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- /*ase_srp_cond_begin:>=140010*/
- #if ASE_SRP_VERSION >=140010
- #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:<140010*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
- #define ASE_SV_DEPTH SV_DepthLessEqual
- #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
- #else
- #define ASE_SV_DEPTH SV_Depth
- #define ASE_SV_POSITION_QUALIFIERS
- #endif
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
- float4 clipPosV : TEXCOORD0;
- float3 positionWS : TEXCOORD1;
- float3 normalWS : TEXCOORD2;
- /*ase_interp(3,):sp=sp;wp=tc1;wn=tc2*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- struct SurfaceDescription
- {
- float Alpha;
- float AlphaClipThreshold;
- };
- PackedVaryings VertexFunction( Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output;
- ZERO_INITIALIZE(PackedVaryings, output);
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/;
- VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
- output.positionCS = vertexInput.positionCS;
- output.clipPosV = vertexInput.positionCS;
- output.positionWS = vertexInput.positionWS;
- output.normalWS = TransformObjectToWorldNormal( input.normalOS );
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- void frag(PackedVaryings input
- , out half4 outNormalWS : SV_Target0
- #ifdef ASE_DEPTH_WRITE_ON
- ,out float outputDepth : ASE_SV_DEPTH
- #endif
- #ifdef _WRITE_RENDERING_LAYERS
- , out float4 outRenderingLayers : SV_Target1
- #endif
- /*ase_frag_input*/ )
- {
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
- /*ase_local_var:wp*/float3 WorldPosition = input.positionWS;
- /*ase_local_var:wn*/float3 WorldNormal = input.normalWS;
- /*ase_local_var:sp*/float4 ClipPos = input.clipPosV;
- /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV );
- /*ase_frag_code:input=PackedVaryings*/
- float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/;
- #ifdef ASE_DEPTH_WRITE_ON
- float DepthValue = /*ase_frag_out:Depth Value;Float;17;-1;_DepthValue*/input.positionCS.z/*end*/;
- #endif
- #ifdef _ALPHATEST_ON
- clip(Alpha - AlphaClipThreshold);
- #endif
- #if defined(LOD_FADE_CROSSFADE)
- LODFadeCrossFade( input.positionCS );
- #endif
- #ifdef ASE_DEPTH_WRITE_ON
- outputDepth = DepthValue;
- #endif
- #if defined(_GBUFFER_NORMALS_OCT)
- float3 normalWS = normalize(input.normalWS);
- float2 octNormalWS = PackNormalOctQuadEncode(normalWS);
- float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);
- half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);
- outNormalWS = half4(packedNormalWS, 0.0);
- #else
- float3 normalWS = input.normalWS;
- outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0);
- #endif
- #ifdef _WRITE_RENDERING_LAYERS
- uint renderingLayers = GetMeshRenderingLayer();
- outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0);
- #endif
- }
- ENDHLSL
- }
- /*ase_pass*/
- Pass // -- DEPRECATED --
- {
- /*ase_hide_pass*/
- Name "DepthNormalsOnly"
- Tags
- {
- "LightMode" = "DepthNormalsOnly"
- }
- ZTest LEqual
- ZWrite On
- HLSLPROGRAM
- #pragma exclude_renderers gles gles3 glcore
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile _ DOTS_INSTANCING_ON
- /*ase_srp_cond_end*/
- #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
- /*ase_srp_cond_begin:<140007*/
- #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
- /*ase_srp_cond_end*/
- #pragma vertex vert
- #pragma fragment frag
- #define ATTRIBUTES_NEED_NORMAL
- #define ATTRIBUTES_NEED_TANGENT
- #define ATTRIBUTES_NEED_TEXCOORD1
- #define VARYINGS_NEED_NORMAL_WS
- #define VARYINGS_NEED_TANGENT_WS
- #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:>=140007*/
- #if ASE_SRP_VERSION >=140007
- #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
- #endif
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
- /*ase_srp_cond_begin:>=140010*/
- #if ASE_SRP_VERSION >=140010
- #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
- #endif
- /*ase_srp_cond_end*/
- /*ase_srp_cond_begin:<140010*/
- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
- /*ase_srp_cond_end*/
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
- #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
- #if defined(LOD_FADE_CROSSFADE)
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
- #endif
- /*ase_pragma*/
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL;
- /*ase_vdata:p=p;n=n*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct PackedVaryings
- {
- float4 positionCS : SV_POSITION;
- float4 clipPosV : TEXCOORD0;
- float3 normalWS : TEXCOORD1;
- /*ase_interp(2,):sp=sp;wn=tc0*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- CBUFFER_START(UnityPerMaterial)
- #ifdef ASE_TESSELLATION
- float _TessPhongStrength;
- float _TessValue;
- float _TessMin;
- float _TessMax;
- float _TessEdgeLength;
- float _TessMaxDisp;
- #endif
- CBUFFER_END
- /*ase_globals*/
- /*ase_funcs*/
- struct SurfaceDescription
- {
- float Alpha;
- float AlphaClipThreshold;
- };
- PackedVaryings VertexFunction(Attributes input /*ase_vert_input*/ )
- {
- PackedVaryings output;
- ZERO_INITIALIZE(PackedVaryings, output);
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- /*ase_vert_code:input=Attributes;output=PackedVaryings*/
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- float3 defaultVertexValue = input.positionOS.xyz;
- #else
- float3 defaultVertexValue = float3(0, 0, 0);
- #endif
- float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;2;-1;_Vertex*/defaultVertexValue/*end*/;
- #ifdef ASE_ABSOLUTE_VERTEX_POS
- input.positionOS.xyz = vertexValue;
- #else
- input.positionOS.xyz += vertexValue;
- #endif
- input.normalOS = /*ase_vert_out:Vertex Normal;Float3;3;-1;_Normal*/input.normalOS/*end*/;
- VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
- output.positionCS = vertexInput.positionCS;
- output.clipPosV = vertexInput.positionCS;
- output.normalWS = TransformObjectToWorldNormal( input.normalOS );
- return output;
- }
- #if defined(ASE_TESSELLATION)
- struct VertexControl
- {
- float4 positionOS : INTERNALTESSPOS;
- float3 normalOS : NORMAL;
- /*ase_vcontrol*/
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct TessellationFactors
- {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- VertexControl vert ( Attributes input )
- {
- VertexControl output;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- output.positionOS = input.positionOS;
- output.normalOS = input.normalOS;
- /*ase_control_code:input=Attributes;output=VertexControl*/
- return output;
- }
- TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
- {
- TessellationFactors output;
- float4 tf = 1;
- 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*/;
- float edgeLength = /*ase_inline_begin*/_TessEdgeLength/*ase_inline_end*/; float tessMaxDisp = /*ase_inline_begin*/_TessMaxDisp/*ase_inline_end*/;
- #if defined(ASE_FIXED_TESSELLATION)
- tf = FixedTess( tessValue );
- #elif defined(ASE_DISTANCE_TESSELLATION)
- tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
- #elif defined(ASE_LENGTH_TESSELLATION)
- tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
- #elif defined(ASE_LENGTH_CULL_TESSELLATION)
- tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
- #endif
- output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
- return output;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("TessellationFunction")]
- [outputcontrolpoints(3)]
- VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
- {
- return patch[id];
- }
- [domain("tri")]
- PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
- {
- Attributes output = (Attributes) 0;
- output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
- output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
- /*ase_domain_code:patch=VertexControl;output=Attributes;bary=SV_DomainLocation*/
- #if defined(ASE_PHONG_TESSELLATION)
- float3 pp[3];
- for (int i = 0; i < 3; ++i)
- pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
- float phongStrength = /*ase_inline_begin*/_TessPhongStrength/*ase_inline_end*/;
- output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
- #endif
- UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
- return VertexFunction(output);
- }
- #else
- PackedVaryings vert ( Attributes input )
- {
- return VertexFunction( input );
- }
- #endif
- half4 frag(PackedVaryings input /*ase_frag_input*/) : SV_Target
- {
- /*ase_local_var:sp*/float4 ClipPos = input.clipPosV;
- /*ase_local_var:spu*/float4 ScreenPos = ComputeScreenPos( input.clipPosV );
- /*ase_frag_code:input=PackedVaryings*/
- float Alpha = /*ase_frag_out:Alpha;Float;0;-1;_Alpha*/1/*end*/;
- float AlphaClipThreshold = /*ase_frag_out:Alpha Clip Threshold;Float;1;-1;_AlphaClip*/0.5/*end*/;
- #if _ALPHATEST_ON
- clip( Alpha - AlphaClipThreshold );
- #endif
- return half4( NormalizeNormalPerPixel( input.normalWS ), 0.0 );
- }
- ENDHLSL
- }
- /*ase_pass_end*/
- }
- /*ase_lod*/
- CustomEditor "UnityEditor.ShaderGraphUnlitGUI"
- FallBack "Hidden/Shader Graph/FallbackError"
- }
|