Candela Flame.shader 128 KB

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