Cloud.shader 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739
  1. // Made with Amplify Shader Editor v1.9.8.1
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Cloud"
  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. //_TessPhongStrength( "Tess Phong Strength", Range( 0, 1 ) ) = 0.5
  10. //_TessValue( "Tess Max Tessellation", Range( 1, 32 ) ) = 16
  11. //_TessMin( "Tess Min Distance", Float ) = 10
  12. //_TessMax( "Tess Max Distance", Float ) = 25
  13. //_TessEdgeLength ( "Tess Edge length", Range( 2, 50 ) ) = 16
  14. //_TessMaxDisp( "Tess Max Displacement", Float ) = 25
  15. [HideInInspector] _QueueOffset("_QueueOffset", Float) = 0
  16. [HideInInspector] _QueueControl("_QueueControl", Float) = -1
  17. [HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
  18. [HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
  19. [HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
  20. [HideInInspector][ToggleOff] _ReceiveShadows("Receive Shadows", Float) = 1.0
  21. }
  22. SubShader
  23. {
  24. LOD 0
  25. Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" "Queue"="Geometry" "UniversalMaterialType"="Unlit" }
  26. Cull Back
  27. AlphaToMask Off
  28. HLSLINCLUDE
  29. #pragma target 4.5
  30. #pragma prefer_hlslcc gles
  31. // ensure rendering platforms toggle list is visible
  32. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  33. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
  34. #ifndef ASE_TESS_FUNCS
  35. #define ASE_TESS_FUNCS
  36. float4 FixedTess( float tessValue )
  37. {
  38. return tessValue;
  39. }
  40. float CalcDistanceTessFactor (float4 vertex, float minDist, float maxDist, float tess, float4x4 o2w, float3 cameraPos )
  41. {
  42. float3 wpos = mul(o2w,vertex).xyz;
  43. float dist = distance (wpos, cameraPos);
  44. float f = clamp(1.0 - (dist - minDist) / (maxDist - minDist), 0.01, 1.0) * tess;
  45. return f;
  46. }
  47. float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
  48. {
  49. float4 tess;
  50. tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
  51. tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
  52. tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
  53. tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
  54. return tess;
  55. }
  56. float CalcEdgeTessFactor (float3 wpos0, float3 wpos1, float edgeLen, float3 cameraPos, float4 scParams )
  57. {
  58. float dist = distance (0.5 * (wpos0+wpos1), cameraPos);
  59. float len = distance(wpos0, wpos1);
  60. float f = max(len * scParams.y / (edgeLen * dist), 1.0);
  61. return f;
  62. }
  63. float DistanceFromPlane (float3 pos, float4 plane)
  64. {
  65. float d = dot (float4(pos,1.0f), plane);
  66. return d;
  67. }
  68. bool WorldViewFrustumCull (float3 wpos0, float3 wpos1, float3 wpos2, float cullEps, float4 planes[6] )
  69. {
  70. float4 planeTest;
  71. planeTest.x = (( DistanceFromPlane(wpos0, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  72. (( DistanceFromPlane(wpos1, planes[0]) > -cullEps) ? 1.0f : 0.0f ) +
  73. (( DistanceFromPlane(wpos2, planes[0]) > -cullEps) ? 1.0f : 0.0f );
  74. planeTest.y = (( DistanceFromPlane(wpos0, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  75. (( DistanceFromPlane(wpos1, planes[1]) > -cullEps) ? 1.0f : 0.0f ) +
  76. (( DistanceFromPlane(wpos2, planes[1]) > -cullEps) ? 1.0f : 0.0f );
  77. planeTest.z = (( DistanceFromPlane(wpos0, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  78. (( DistanceFromPlane(wpos1, planes[2]) > -cullEps) ? 1.0f : 0.0f ) +
  79. (( DistanceFromPlane(wpos2, planes[2]) > -cullEps) ? 1.0f : 0.0f );
  80. planeTest.w = (( DistanceFromPlane(wpos0, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  81. (( DistanceFromPlane(wpos1, planes[3]) > -cullEps) ? 1.0f : 0.0f ) +
  82. (( DistanceFromPlane(wpos2, planes[3]) > -cullEps) ? 1.0f : 0.0f );
  83. return !all (planeTest);
  84. }
  85. float4 DistanceBasedTess( float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist, float4x4 o2w, float3 cameraPos )
  86. {
  87. float3 f;
  88. f.x = CalcDistanceTessFactor (v0,minDist,maxDist,tess,o2w,cameraPos);
  89. f.y = CalcDistanceTessFactor (v1,minDist,maxDist,tess,o2w,cameraPos);
  90. f.z = CalcDistanceTessFactor (v2,minDist,maxDist,tess,o2w,cameraPos);
  91. return CalcTriEdgeTessFactors (f);
  92. }
  93. float4 EdgeLengthBasedTess( float4 v0, float4 v1, float4 v2, float edgeLength, float4x4 o2w, float3 cameraPos, float4 scParams )
  94. {
  95. float3 pos0 = mul(o2w,v0).xyz;
  96. float3 pos1 = mul(o2w,v1).xyz;
  97. float3 pos2 = mul(o2w,v2).xyz;
  98. float4 tess;
  99. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  100. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  101. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  102. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  103. return tess;
  104. }
  105. float4 EdgeLengthBasedTessCull( float4 v0, float4 v1, float4 v2, float edgeLength, float maxDisplacement, float4x4 o2w, float3 cameraPos, float4 scParams, float4 planes[6] )
  106. {
  107. float3 pos0 = mul(o2w,v0).xyz;
  108. float3 pos1 = mul(o2w,v1).xyz;
  109. float3 pos2 = mul(o2w,v2).xyz;
  110. float4 tess;
  111. if (WorldViewFrustumCull(pos0, pos1, pos2, maxDisplacement, planes))
  112. {
  113. tess = 0.0f;
  114. }
  115. else
  116. {
  117. tess.x = CalcEdgeTessFactor (pos1, pos2, edgeLength, cameraPos, scParams);
  118. tess.y = CalcEdgeTessFactor (pos2, pos0, edgeLength, cameraPos, scParams);
  119. tess.z = CalcEdgeTessFactor (pos0, pos1, edgeLength, cameraPos, scParams);
  120. tess.w = (tess.x + tess.y + tess.z) / 3.0f;
  121. }
  122. return tess;
  123. }
  124. #endif //ASE_TESS_FUNCS
  125. ENDHLSL
  126. Pass
  127. {
  128. Name "Forward"
  129. Tags { "LightMode"="UniversalForwardOnly" }
  130. Blend One Zero, One Zero
  131. ZWrite On
  132. ZTest LEqual
  133. Offset 0 , 0
  134. ColorMask RGBA
  135. HLSLPROGRAM
  136. #pragma multi_compile_fragment _ALPHATEST_ON
  137. #pragma multi_compile_instancing
  138. #pragma instancing_options renderinglayer
  139. #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
  140. #pragma multi_compile_fog
  141. #define ASE_FOG 1
  142. #define ASE_VERSION 19801
  143. #define ASE_SRP_VERSION 140011
  144. #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
  145. #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
  146. #pragma multi_compile _ DIRLIGHTMAP_COMBINED
  147. #pragma multi_compile _ LIGHTMAP_ON
  148. #pragma multi_compile _ DYNAMICLIGHTMAP_ON
  149. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  150. #pragma vertex vert
  151. #pragma fragment frag
  152. #define SHADERPASS SHADERPASS_UNLIT
  153. #if ASE_SRP_VERSION >=140007
  154. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  155. #endif
  156. #if ASE_SRP_VERSION >=140007
  157. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  158. #endif
  159. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  160. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  161. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  162. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  163. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  164. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  165. #if ASE_SRP_VERSION >=140010
  166. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  167. #endif
  168. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  169. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
  170. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  171. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl"
  172. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl"
  173. #if defined(LOD_FADE_CROSSFADE)
  174. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  175. #endif
  176. #define ASE_NEEDS_VERT_NORMAL
  177. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  178. #define ASE_SV_DEPTH SV_DepthLessEqual
  179. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  180. #else
  181. #define ASE_SV_DEPTH SV_Depth
  182. #define ASE_SV_POSITION_QUALIFIERS
  183. #endif
  184. struct Attributes
  185. {
  186. float4 positionOS : POSITION;
  187. float3 normalOS : NORMAL;
  188. float4 texcoord : TEXCOORD0;
  189. float4 texcoord1 : TEXCOORD1;
  190. float4 texcoord2 : TEXCOORD2;
  191. UNITY_VERTEX_INPUT_INSTANCE_ID
  192. };
  193. struct PackedVaryings
  194. {
  195. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  196. float4 clipPosV : TEXCOORD0;
  197. float3 positionWS : TEXCOORD1;
  198. #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX)
  199. half4 fogFactorAndVertexLight : TEXCOORD2;
  200. #endif
  201. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  202. float4 shadowCoord : TEXCOORD3;
  203. #endif
  204. #if defined(LIGHTMAP_ON)
  205. float4 lightmapUVOrVertexSH : TEXCOORD4;
  206. #endif
  207. #if defined(DYNAMICLIGHTMAP_ON)
  208. float2 dynamicLightmapUV : TEXCOORD5;
  209. #endif
  210. UNITY_VERTEX_INPUT_INSTANCE_ID
  211. UNITY_VERTEX_OUTPUT_STEREO
  212. };
  213. CBUFFER_START(UnityPerMaterial)
  214. #ifdef ASE_TESSELLATION
  215. float _TessPhongStrength;
  216. float _TessValue;
  217. float _TessMin;
  218. float _TessMax;
  219. float _TessEdgeLength;
  220. float _TessMaxDisp;
  221. #endif
  222. CBUFFER_END
  223. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  224. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  225. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  226. float snoise( float2 v )
  227. {
  228. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  229. float2 i = floor( v + dot( v, C.yy ) );
  230. float2 x0 = v - i + dot( i, C.xx );
  231. float2 i1;
  232. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  233. float4 x12 = x0.xyxy + C.xxzz;
  234. x12.xy -= i1;
  235. i = mod2D289( i );
  236. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  237. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  238. m = m * m;
  239. m = m * m;
  240. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  241. float3 h = abs( x ) - 0.5;
  242. float3 ox = floor( x + 0.5 );
  243. float3 a0 = x - ox;
  244. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  245. float3 g;
  246. g.x = a0.x * x0.x + h.x * x0.y;
  247. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  248. return 130.0 * dot( m, g );
  249. }
  250. PackedVaryings VertexFunction( Attributes input )
  251. {
  252. PackedVaryings output = (PackedVaryings)0;
  253. UNITY_SETUP_INSTANCE_ID(input);
  254. UNITY_TRANSFER_INSTANCE_ID(input, output);
  255. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  256. float2 temp_cast_0 = (5.0).xx;
  257. float2 texCoord11 = input.texcoord.xy * temp_cast_0 + float2( 0,0 );
  258. float simplePerlin2D10 = snoise( texCoord11 );
  259. simplePerlin2D10 = simplePerlin2D10*0.5 + 0.5;
  260. #ifdef ASE_ABSOLUTE_VERTEX_POS
  261. float3 defaultVertexValue = input.positionOS.xyz;
  262. #else
  263. float3 defaultVertexValue = float3(0, 0, 0);
  264. #endif
  265. float3 vertexValue = ( simplePerlin2D10 * input.normalOS );
  266. #ifdef ASE_ABSOLUTE_VERTEX_POS
  267. input.positionOS.xyz = vertexValue;
  268. #else
  269. input.positionOS.xyz += vertexValue;
  270. #endif
  271. input.normalOS = input.normalOS;
  272. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  273. #if defined(LIGHTMAP_ON)
  274. OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUVOrVertexSH.xy);
  275. #endif
  276. #if defined(DYNAMICLIGHTMAP_ON)
  277. output.dynamicLightmapUV.xy = input.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
  278. #endif
  279. #if defined(ASE_FOG) || defined(_ADDITIONAL_LIGHTS_VERTEX)
  280. output.fogFactorAndVertexLight = 0;
  281. #if defined(ASE_FOG) && !defined(_FOG_FRAGMENT)
  282. output.fogFactorAndVertexLight.x = ComputeFogFactor(vertexInput.positionCS.z);
  283. #endif
  284. #ifdef _ADDITIONAL_LIGHTS_VERTEX
  285. half3 vertexLight = VertexLighting( vertexInput.positionWS, normalInput.normalWS );
  286. output.fogFactorAndVertexLight.yzw = vertexLight;
  287. #endif
  288. #endif
  289. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  290. output.shadowCoord = GetShadowCoord( vertexInput );
  291. #endif
  292. output.positionCS = vertexInput.positionCS;
  293. output.clipPosV = vertexInput.positionCS;
  294. output.positionWS = vertexInput.positionWS;
  295. return output;
  296. }
  297. #if defined(ASE_TESSELLATION)
  298. struct VertexControl
  299. {
  300. float4 positionOS : INTERNALTESSPOS;
  301. float3 normalOS : NORMAL;
  302. UNITY_VERTEX_INPUT_INSTANCE_ID
  303. };
  304. struct TessellationFactors
  305. {
  306. float edge[3] : SV_TessFactor;
  307. float inside : SV_InsideTessFactor;
  308. };
  309. VertexControl vert ( Attributes input )
  310. {
  311. VertexControl output;
  312. UNITY_SETUP_INSTANCE_ID(input);
  313. UNITY_TRANSFER_INSTANCE_ID(input, output);
  314. output.positionOS = input.positionOS;
  315. output.normalOS = input.normalOS;
  316. return output;
  317. }
  318. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  319. {
  320. TessellationFactors output;
  321. float4 tf = 1;
  322. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  323. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  324. #if defined(ASE_FIXED_TESSELLATION)
  325. tf = FixedTess( tessValue );
  326. #elif defined(ASE_DISTANCE_TESSELLATION)
  327. tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  328. #elif defined(ASE_LENGTH_TESSELLATION)
  329. tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  330. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  331. tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  332. #endif
  333. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  334. return output;
  335. }
  336. [domain("tri")]
  337. [partitioning("fractional_odd")]
  338. [outputtopology("triangle_cw")]
  339. [patchconstantfunc("TessellationFunction")]
  340. [outputcontrolpoints(3)]
  341. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  342. {
  343. return patch[id];
  344. }
  345. [domain("tri")]
  346. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  347. {
  348. Attributes output = (Attributes) 0;
  349. output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
  350. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  351. #if defined(ASE_PHONG_TESSELLATION)
  352. float3 pp[3];
  353. for (int i = 0; i < 3; ++i)
  354. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
  355. float phongStrength = _TessPhongStrength;
  356. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  357. #endif
  358. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  359. return VertexFunction(output);
  360. }
  361. #else
  362. PackedVaryings vert ( Attributes input )
  363. {
  364. return VertexFunction( input );
  365. }
  366. #endif
  367. half4 frag ( PackedVaryings input
  368. #ifdef ASE_DEPTH_WRITE_ON
  369. ,out float outputDepth : ASE_SV_DEPTH
  370. #endif
  371. #ifdef _WRITE_RENDERING_LAYERS
  372. , out float4 outRenderingLayers : SV_Target1
  373. #endif
  374. ) : SV_Target
  375. {
  376. UNITY_SETUP_INSTANCE_ID(input);
  377. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  378. #if defined(LOD_FADE_CROSSFADE)
  379. LODFadeCrossFade( input.positionCS );
  380. #endif
  381. float3 WorldPosition = input.positionWS;
  382. float3 WorldViewDirection = GetWorldSpaceNormalizeViewDir( WorldPosition );
  383. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  384. float4 ClipPos = input.clipPosV;
  385. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  386. float2 NormalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
  387. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  388. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  389. ShadowCoords = input.shadowCoord;
  390. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  391. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  392. #endif
  393. #endif
  394. float3 temp_cast_0 = (0.5).xxx;
  395. float3 BakedAlbedo = 0;
  396. float3 BakedEmission = 0;
  397. float3 Color = temp_cast_0;
  398. float Alpha = 1;
  399. float AlphaClipThreshold = 0.5;
  400. float AlphaClipThresholdShadow = 0.5;
  401. #ifdef ASE_DEPTH_WRITE_ON
  402. float DepthValue = input.positionCS.z;
  403. #endif
  404. #ifdef _ALPHATEST_ON
  405. clip(Alpha - AlphaClipThreshold);
  406. #endif
  407. InputData inputData = (InputData)0;
  408. inputData.positionWS = WorldPosition;
  409. inputData.viewDirectionWS = WorldViewDirection;
  410. #ifdef ASE_FOG
  411. inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
  412. #endif
  413. #ifdef _ADDITIONAL_LIGHTS_VERTEX
  414. inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
  415. #endif
  416. inputData.normalizedScreenSpaceUV = NormalizedScreenSpaceUV;
  417. #if defined(_DBUFFER)
  418. ApplyDecalToBaseColor(input.positionCS, Color);
  419. #endif
  420. #ifdef ASE_FOG
  421. #ifdef TERRAIN_SPLAT_ADDPASS
  422. Color.rgb = MixFogColor(Color.rgb, half3(0,0,0), inputData.fogCoord);
  423. #else
  424. Color.rgb = MixFog(Color.rgb, inputData.fogCoord);
  425. #endif
  426. #endif
  427. #ifdef ASE_DEPTH_WRITE_ON
  428. outputDepth = DepthValue;
  429. #endif
  430. #ifdef _WRITE_RENDERING_LAYERS
  431. uint renderingLayers = GetMeshRenderingLayer();
  432. outRenderingLayers = float4( EncodeMeshRenderingLayer( renderingLayers ), 0, 0, 0 );
  433. #endif
  434. return half4( Color, Alpha );
  435. }
  436. ENDHLSL
  437. }
  438. Pass
  439. {
  440. Name "DepthOnly"
  441. Tags { "LightMode"="DepthOnly" }
  442. ZWrite On
  443. ColorMask R
  444. AlphaToMask Off
  445. HLSLPROGRAM
  446. #pragma multi_compile _ALPHATEST_ON
  447. #pragma multi_compile_instancing
  448. #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
  449. #define ASE_FOG 1
  450. #define ASE_VERSION 19801
  451. #define ASE_SRP_VERSION 140011
  452. #pragma vertex vert
  453. #pragma fragment frag
  454. #if ASE_SRP_VERSION >=140007
  455. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  456. #endif
  457. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  458. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  459. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  460. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  461. #if defined(LOD_FADE_CROSSFADE)
  462. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  463. #endif
  464. #define ASE_NEEDS_VERT_NORMAL
  465. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  466. #define ASE_SV_DEPTH SV_DepthLessEqual
  467. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  468. #else
  469. #define ASE_SV_DEPTH SV_Depth
  470. #define ASE_SV_POSITION_QUALIFIERS
  471. #endif
  472. struct Attributes
  473. {
  474. float4 positionOS : POSITION;
  475. float3 normalOS : NORMAL;
  476. float4 ase_texcoord : TEXCOORD0;
  477. UNITY_VERTEX_INPUT_INSTANCE_ID
  478. };
  479. struct PackedVaryings
  480. {
  481. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  482. float4 clipPosV : TEXCOORD0;
  483. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  484. float3 positionWS : TEXCOORD1;
  485. #endif
  486. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  487. float4 shadowCoord : TEXCOORD2;
  488. #endif
  489. UNITY_VERTEX_INPUT_INSTANCE_ID
  490. UNITY_VERTEX_OUTPUT_STEREO
  491. };
  492. CBUFFER_START(UnityPerMaterial)
  493. #ifdef ASE_TESSELLATION
  494. float _TessPhongStrength;
  495. float _TessValue;
  496. float _TessMin;
  497. float _TessMax;
  498. float _TessEdgeLength;
  499. float _TessMaxDisp;
  500. #endif
  501. CBUFFER_END
  502. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  503. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  504. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  505. float snoise( float2 v )
  506. {
  507. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  508. float2 i = floor( v + dot( v, C.yy ) );
  509. float2 x0 = v - i + dot( i, C.xx );
  510. float2 i1;
  511. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  512. float4 x12 = x0.xyxy + C.xxzz;
  513. x12.xy -= i1;
  514. i = mod2D289( i );
  515. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  516. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  517. m = m * m;
  518. m = m * m;
  519. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  520. float3 h = abs( x ) - 0.5;
  521. float3 ox = floor( x + 0.5 );
  522. float3 a0 = x - ox;
  523. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  524. float3 g;
  525. g.x = a0.x * x0.x + h.x * x0.y;
  526. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  527. return 130.0 * dot( m, g );
  528. }
  529. PackedVaryings VertexFunction( Attributes input )
  530. {
  531. PackedVaryings output = (PackedVaryings)0;
  532. UNITY_SETUP_INSTANCE_ID(input);
  533. UNITY_TRANSFER_INSTANCE_ID(input, output);
  534. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  535. float2 temp_cast_0 = (5.0).xx;
  536. float2 texCoord11 = input.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
  537. float simplePerlin2D10 = snoise( texCoord11 );
  538. simplePerlin2D10 = simplePerlin2D10*0.5 + 0.5;
  539. #ifdef ASE_ABSOLUTE_VERTEX_POS
  540. float3 defaultVertexValue = input.positionOS.xyz;
  541. #else
  542. float3 defaultVertexValue = float3(0, 0, 0);
  543. #endif
  544. float3 vertexValue = ( simplePerlin2D10 * input.normalOS );
  545. #ifdef ASE_ABSOLUTE_VERTEX_POS
  546. input.positionOS.xyz = vertexValue;
  547. #else
  548. input.positionOS.xyz += vertexValue;
  549. #endif
  550. input.normalOS = input.normalOS;
  551. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  552. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  553. output.positionWS = vertexInput.positionWS;
  554. #endif
  555. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) && defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  556. output.shadowCoord = GetShadowCoord( vertexInput );
  557. #endif
  558. output.positionCS = vertexInput.positionCS;
  559. output.clipPosV = vertexInput.positionCS;
  560. return output;
  561. }
  562. #if defined(ASE_TESSELLATION)
  563. struct VertexControl
  564. {
  565. float4 positionOS : INTERNALTESSPOS;
  566. float3 normalOS : NORMAL;
  567. float4 ase_texcoord : TEXCOORD0;
  568. UNITY_VERTEX_INPUT_INSTANCE_ID
  569. };
  570. struct TessellationFactors
  571. {
  572. float edge[3] : SV_TessFactor;
  573. float inside : SV_InsideTessFactor;
  574. };
  575. VertexControl vert ( Attributes input )
  576. {
  577. VertexControl output;
  578. UNITY_SETUP_INSTANCE_ID(input);
  579. UNITY_TRANSFER_INSTANCE_ID(input, output);
  580. output.positionOS = input.positionOS;
  581. output.normalOS = input.normalOS;
  582. output.ase_texcoord = input.ase_texcoord;
  583. return output;
  584. }
  585. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  586. {
  587. TessellationFactors output;
  588. float4 tf = 1;
  589. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  590. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  591. #if defined(ASE_FIXED_TESSELLATION)
  592. tf = FixedTess( tessValue );
  593. #elif defined(ASE_DISTANCE_TESSELLATION)
  594. tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  595. #elif defined(ASE_LENGTH_TESSELLATION)
  596. tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  597. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  598. tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  599. #endif
  600. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  601. return output;
  602. }
  603. [domain("tri")]
  604. [partitioning("fractional_odd")]
  605. [outputtopology("triangle_cw")]
  606. [patchconstantfunc("TessellationFunction")]
  607. [outputcontrolpoints(3)]
  608. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  609. {
  610. return patch[id];
  611. }
  612. [domain("tri")]
  613. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  614. {
  615. Attributes output = (Attributes) 0;
  616. output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
  617. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  618. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  619. #if defined(ASE_PHONG_TESSELLATION)
  620. float3 pp[3];
  621. for (int i = 0; i < 3; ++i)
  622. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
  623. float phongStrength = _TessPhongStrength;
  624. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  625. #endif
  626. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  627. return VertexFunction(output);
  628. }
  629. #else
  630. PackedVaryings vert ( Attributes input )
  631. {
  632. return VertexFunction( input );
  633. }
  634. #endif
  635. half4 frag(PackedVaryings input
  636. #ifdef ASE_DEPTH_WRITE_ON
  637. ,out float outputDepth : ASE_SV_DEPTH
  638. #endif
  639. ) : SV_Target
  640. {
  641. UNITY_SETUP_INSTANCE_ID(input);
  642. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  643. #if defined(ASE_NEEDS_FRAG_WORLD_POSITION)
  644. float3 WorldPosition = input.positionWS;
  645. #endif
  646. float4 ShadowCoords = float4( 0, 0, 0, 0 );
  647. float4 ClipPos = input.clipPosV;
  648. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  649. #if defined(ASE_NEEDS_FRAG_SHADOWCOORDS)
  650. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  651. ShadowCoords = input.shadowCoord;
  652. #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
  653. ShadowCoords = TransformWorldToShadowCoord( WorldPosition );
  654. #endif
  655. #endif
  656. float Alpha = 1;
  657. float AlphaClipThreshold = 0.5;
  658. #ifdef ASE_DEPTH_WRITE_ON
  659. float DepthValue = input.positionCS.z;
  660. #endif
  661. #ifdef _ALPHATEST_ON
  662. clip(Alpha - AlphaClipThreshold);
  663. #endif
  664. #if defined(LOD_FADE_CROSSFADE)
  665. LODFadeCrossFade( input.positionCS );
  666. #endif
  667. #ifdef ASE_DEPTH_WRITE_ON
  668. outputDepth = DepthValue;
  669. #endif
  670. return 0;
  671. }
  672. ENDHLSL
  673. }
  674. Pass
  675. {
  676. Name "SceneSelectionPass"
  677. Tags { "LightMode"="SceneSelectionPass" }
  678. Cull Off
  679. AlphaToMask Off
  680. HLSLPROGRAM
  681. #define ASE_FOG 1
  682. #define ASE_VERSION 19801
  683. #define ASE_SRP_VERSION 140011
  684. #pragma vertex vert
  685. #pragma fragment frag
  686. #define ATTRIBUTES_NEED_NORMAL
  687. #define ATTRIBUTES_NEED_TANGENT
  688. #define SHADERPASS SHADERPASS_DEPTHONLY
  689. #if ASE_SRP_VERSION >=140007
  690. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  691. #endif
  692. #if ASE_SRP_VERSION >=140007
  693. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  694. #endif
  695. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  696. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  697. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  698. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  699. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  700. #if ASE_SRP_VERSION >=140010
  701. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  702. #endif
  703. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  704. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  705. #define ASE_NEEDS_VERT_NORMAL
  706. struct Attributes
  707. {
  708. float4 positionOS : POSITION;
  709. float3 normalOS : NORMAL;
  710. float4 ase_texcoord : TEXCOORD0;
  711. UNITY_VERTEX_INPUT_INSTANCE_ID
  712. };
  713. struct PackedVaryings
  714. {
  715. float4 positionCS : SV_POSITION;
  716. UNITY_VERTEX_INPUT_INSTANCE_ID
  717. UNITY_VERTEX_OUTPUT_STEREO
  718. };
  719. CBUFFER_START(UnityPerMaterial)
  720. #ifdef ASE_TESSELLATION
  721. float _TessPhongStrength;
  722. float _TessValue;
  723. float _TessMin;
  724. float _TessMax;
  725. float _TessEdgeLength;
  726. float _TessMaxDisp;
  727. #endif
  728. CBUFFER_END
  729. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  730. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  731. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  732. float snoise( float2 v )
  733. {
  734. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  735. float2 i = floor( v + dot( v, C.yy ) );
  736. float2 x0 = v - i + dot( i, C.xx );
  737. float2 i1;
  738. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  739. float4 x12 = x0.xyxy + C.xxzz;
  740. x12.xy -= i1;
  741. i = mod2D289( i );
  742. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  743. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  744. m = m * m;
  745. m = m * m;
  746. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  747. float3 h = abs( x ) - 0.5;
  748. float3 ox = floor( x + 0.5 );
  749. float3 a0 = x - ox;
  750. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  751. float3 g;
  752. g.x = a0.x * x0.x + h.x * x0.y;
  753. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  754. return 130.0 * dot( m, g );
  755. }
  756. int _ObjectId;
  757. int _PassValue;
  758. struct SurfaceDescription
  759. {
  760. float Alpha;
  761. float AlphaClipThreshold;
  762. };
  763. PackedVaryings VertexFunction(Attributes input )
  764. {
  765. PackedVaryings output;
  766. ZERO_INITIALIZE(PackedVaryings, output);
  767. UNITY_SETUP_INSTANCE_ID(input);
  768. UNITY_TRANSFER_INSTANCE_ID(input, output);
  769. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  770. float2 temp_cast_0 = (5.0).xx;
  771. float2 texCoord11 = input.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
  772. float simplePerlin2D10 = snoise( texCoord11 );
  773. simplePerlin2D10 = simplePerlin2D10*0.5 + 0.5;
  774. #ifdef ASE_ABSOLUTE_VERTEX_POS
  775. float3 defaultVertexValue = input.positionOS.xyz;
  776. #else
  777. float3 defaultVertexValue = float3(0, 0, 0);
  778. #endif
  779. float3 vertexValue = ( simplePerlin2D10 * input.normalOS );
  780. #ifdef ASE_ABSOLUTE_VERTEX_POS
  781. input.positionOS.xyz = vertexValue;
  782. #else
  783. input.positionOS.xyz += vertexValue;
  784. #endif
  785. input.normalOS = input.normalOS;
  786. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  787. output.positionCS = TransformWorldToHClip(positionWS);
  788. return output;
  789. }
  790. #if defined(ASE_TESSELLATION)
  791. struct VertexControl
  792. {
  793. float4 positionOS : INTERNALTESSPOS;
  794. float3 normalOS : NORMAL;
  795. float4 ase_texcoord : TEXCOORD0;
  796. UNITY_VERTEX_INPUT_INSTANCE_ID
  797. };
  798. struct TessellationFactors
  799. {
  800. float edge[3] : SV_TessFactor;
  801. float inside : SV_InsideTessFactor;
  802. };
  803. VertexControl vert ( Attributes input )
  804. {
  805. VertexControl output;
  806. UNITY_SETUP_INSTANCE_ID(input);
  807. UNITY_TRANSFER_INSTANCE_ID(input, output);
  808. output.positionOS = input.positionOS;
  809. output.normalOS = input.normalOS;
  810. output.ase_texcoord = input.ase_texcoord;
  811. return output;
  812. }
  813. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  814. {
  815. TessellationFactors output;
  816. float4 tf = 1;
  817. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  818. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  819. #if defined(ASE_FIXED_TESSELLATION)
  820. tf = FixedTess( tessValue );
  821. #elif defined(ASE_DISTANCE_TESSELLATION)
  822. tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  823. #elif defined(ASE_LENGTH_TESSELLATION)
  824. tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  825. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  826. tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  827. #endif
  828. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  829. return output;
  830. }
  831. [domain("tri")]
  832. [partitioning("fractional_odd")]
  833. [outputtopology("triangle_cw")]
  834. [patchconstantfunc("TessellationFunction")]
  835. [outputcontrolpoints(3)]
  836. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  837. {
  838. return patch[id];
  839. }
  840. [domain("tri")]
  841. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  842. {
  843. Attributes output = (Attributes) 0;
  844. output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
  845. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  846. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  847. #if defined(ASE_PHONG_TESSELLATION)
  848. float3 pp[3];
  849. for (int i = 0; i < 3; ++i)
  850. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
  851. float phongStrength = _TessPhongStrength;
  852. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  853. #endif
  854. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  855. return VertexFunction(output);
  856. }
  857. #else
  858. PackedVaryings vert ( Attributes input )
  859. {
  860. return VertexFunction( input );
  861. }
  862. #endif
  863. half4 frag(PackedVaryings input ) : SV_Target
  864. {
  865. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  866. surfaceDescription.Alpha = 1;
  867. surfaceDescription.AlphaClipThreshold = 0.5;
  868. #if _ALPHATEST_ON
  869. float alphaClipThreshold = 0.01f;
  870. #if ALPHA_CLIP_THRESHOLD
  871. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  872. #endif
  873. clip(surfaceDescription.Alpha - alphaClipThreshold);
  874. #endif
  875. half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
  876. return outColor;
  877. }
  878. ENDHLSL
  879. }
  880. Pass
  881. {
  882. Name "ScenePickingPass"
  883. Tags { "LightMode"="Picking" }
  884. AlphaToMask Off
  885. HLSLPROGRAM
  886. #define ASE_FOG 1
  887. #define ASE_VERSION 19801
  888. #define ASE_SRP_VERSION 140011
  889. #pragma vertex vert
  890. #pragma fragment frag
  891. #define ATTRIBUTES_NEED_NORMAL
  892. #define ATTRIBUTES_NEED_TANGENT
  893. #define SHADERPASS SHADERPASS_DEPTHONLY
  894. #if ASE_SRP_VERSION >=140007
  895. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  896. #endif
  897. #if ASE_SRP_VERSION >=140007
  898. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  899. #endif
  900. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  901. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  902. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  903. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  904. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  905. #if ASE_SRP_VERSION >=140010
  906. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  907. #endif
  908. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  909. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  910. #if defined(LOD_FADE_CROSSFADE)
  911. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  912. #endif
  913. #define ASE_NEEDS_VERT_NORMAL
  914. struct Attributes
  915. {
  916. float4 positionOS : POSITION;
  917. float3 normalOS : NORMAL;
  918. float4 ase_texcoord : TEXCOORD0;
  919. UNITY_VERTEX_INPUT_INSTANCE_ID
  920. };
  921. struct PackedVaryings
  922. {
  923. float4 positionCS : SV_POSITION;
  924. UNITY_VERTEX_INPUT_INSTANCE_ID
  925. UNITY_VERTEX_OUTPUT_STEREO
  926. };
  927. CBUFFER_START(UnityPerMaterial)
  928. #ifdef ASE_TESSELLATION
  929. float _TessPhongStrength;
  930. float _TessValue;
  931. float _TessMin;
  932. float _TessMax;
  933. float _TessEdgeLength;
  934. float _TessMaxDisp;
  935. #endif
  936. CBUFFER_END
  937. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  938. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  939. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  940. float snoise( float2 v )
  941. {
  942. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  943. float2 i = floor( v + dot( v, C.yy ) );
  944. float2 x0 = v - i + dot( i, C.xx );
  945. float2 i1;
  946. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  947. float4 x12 = x0.xyxy + C.xxzz;
  948. x12.xy -= i1;
  949. i = mod2D289( i );
  950. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  951. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  952. m = m * m;
  953. m = m * m;
  954. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  955. float3 h = abs( x ) - 0.5;
  956. float3 ox = floor( x + 0.5 );
  957. float3 a0 = x - ox;
  958. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  959. float3 g;
  960. g.x = a0.x * x0.x + h.x * x0.y;
  961. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  962. return 130.0 * dot( m, g );
  963. }
  964. float4 _SelectionID;
  965. struct SurfaceDescription
  966. {
  967. float Alpha;
  968. float AlphaClipThreshold;
  969. };
  970. PackedVaryings VertexFunction(Attributes input )
  971. {
  972. PackedVaryings output;
  973. ZERO_INITIALIZE(PackedVaryings, output);
  974. UNITY_SETUP_INSTANCE_ID(input);
  975. UNITY_TRANSFER_INSTANCE_ID(input, output);
  976. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  977. float2 temp_cast_0 = (5.0).xx;
  978. float2 texCoord11 = input.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
  979. float simplePerlin2D10 = snoise( texCoord11 );
  980. simplePerlin2D10 = simplePerlin2D10*0.5 + 0.5;
  981. #ifdef ASE_ABSOLUTE_VERTEX_POS
  982. float3 defaultVertexValue = input.positionOS.xyz;
  983. #else
  984. float3 defaultVertexValue = float3(0, 0, 0);
  985. #endif
  986. float3 vertexValue = ( simplePerlin2D10 * input.normalOS );
  987. #ifdef ASE_ABSOLUTE_VERTEX_POS
  988. input.positionOS.xyz = vertexValue;
  989. #else
  990. input.positionOS.xyz += vertexValue;
  991. #endif
  992. input.normalOS = input.normalOS;
  993. float3 positionWS = TransformObjectToWorld( input.positionOS.xyz );
  994. output.positionCS = TransformWorldToHClip(positionWS);
  995. return output;
  996. }
  997. #if defined(ASE_TESSELLATION)
  998. struct VertexControl
  999. {
  1000. float4 positionOS : INTERNALTESSPOS;
  1001. float3 normalOS : NORMAL;
  1002. float4 ase_texcoord : TEXCOORD0;
  1003. UNITY_VERTEX_INPUT_INSTANCE_ID
  1004. };
  1005. struct TessellationFactors
  1006. {
  1007. float edge[3] : SV_TessFactor;
  1008. float inside : SV_InsideTessFactor;
  1009. };
  1010. VertexControl vert ( Attributes input )
  1011. {
  1012. VertexControl output;
  1013. UNITY_SETUP_INSTANCE_ID(input);
  1014. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1015. output.positionOS = input.positionOS;
  1016. output.normalOS = input.normalOS;
  1017. output.ase_texcoord = input.ase_texcoord;
  1018. return output;
  1019. }
  1020. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1021. {
  1022. TessellationFactors output;
  1023. float4 tf = 1;
  1024. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1025. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1026. #if defined(ASE_FIXED_TESSELLATION)
  1027. tf = FixedTess( tessValue );
  1028. #elif defined(ASE_DISTANCE_TESSELLATION)
  1029. tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1030. #elif defined(ASE_LENGTH_TESSELLATION)
  1031. tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1032. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1033. tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1034. #endif
  1035. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1036. return output;
  1037. }
  1038. [domain("tri")]
  1039. [partitioning("fractional_odd")]
  1040. [outputtopology("triangle_cw")]
  1041. [patchconstantfunc("TessellationFunction")]
  1042. [outputcontrolpoints(3)]
  1043. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1044. {
  1045. return patch[id];
  1046. }
  1047. [domain("tri")]
  1048. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1049. {
  1050. Attributes output = (Attributes) 0;
  1051. output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
  1052. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1053. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1054. #if defined(ASE_PHONG_TESSELLATION)
  1055. float3 pp[3];
  1056. for (int i = 0; i < 3; ++i)
  1057. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
  1058. float phongStrength = _TessPhongStrength;
  1059. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1060. #endif
  1061. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1062. return VertexFunction(output);
  1063. }
  1064. #else
  1065. PackedVaryings vert ( Attributes input )
  1066. {
  1067. return VertexFunction( input );
  1068. }
  1069. #endif
  1070. half4 frag(PackedVaryings input ) : SV_Target
  1071. {
  1072. SurfaceDescription surfaceDescription = (SurfaceDescription)0;
  1073. surfaceDescription.Alpha = 1;
  1074. surfaceDescription.AlphaClipThreshold = 0.5;
  1075. #if _ALPHATEST_ON
  1076. float alphaClipThreshold = 0.01f;
  1077. #if ALPHA_CLIP_THRESHOLD
  1078. alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
  1079. #endif
  1080. clip(surfaceDescription.Alpha - alphaClipThreshold);
  1081. #endif
  1082. half4 outColor = 0;
  1083. outColor = _SelectionID;
  1084. return outColor;
  1085. }
  1086. ENDHLSL
  1087. }
  1088. Pass
  1089. {
  1090. Name "DepthNormals"
  1091. Tags { "LightMode"="DepthNormalsOnly" }
  1092. ZTest LEqual
  1093. ZWrite On
  1094. HLSLPROGRAM
  1095. #pragma multi_compile _ALPHATEST_ON
  1096. #pragma multi_compile_instancing
  1097. #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
  1098. #define ASE_FOG 1
  1099. #define ASE_VERSION 19801
  1100. #define ASE_SRP_VERSION 140011
  1101. #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
  1102. #pragma vertex vert
  1103. #pragma fragment frag
  1104. #define ATTRIBUTES_NEED_NORMAL
  1105. #define ATTRIBUTES_NEED_TANGENT
  1106. #define VARYINGS_NEED_NORMAL_WS
  1107. #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
  1108. #if ASE_SRP_VERSION >=140007
  1109. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  1110. #endif
  1111. #if ASE_SRP_VERSION >=140007
  1112. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
  1113. #endif
  1114. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  1115. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
  1116. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  1117. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  1118. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
  1119. #if ASE_SRP_VERSION >=140010
  1120. #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
  1121. #endif
  1122. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  1123. #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
  1124. #if defined(LOD_FADE_CROSSFADE)
  1125. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  1126. #endif
  1127. #define ASE_NEEDS_VERT_NORMAL
  1128. #if defined(ASE_EARLY_Z_DEPTH_OPTIMIZE) && (SHADER_TARGET >= 45)
  1129. #define ASE_SV_DEPTH SV_DepthLessEqual
  1130. #define ASE_SV_POSITION_QUALIFIERS linear noperspective centroid
  1131. #else
  1132. #define ASE_SV_DEPTH SV_Depth
  1133. #define ASE_SV_POSITION_QUALIFIERS
  1134. #endif
  1135. struct Attributes
  1136. {
  1137. float4 positionOS : POSITION;
  1138. float3 normalOS : NORMAL;
  1139. float4 ase_texcoord : TEXCOORD0;
  1140. UNITY_VERTEX_INPUT_INSTANCE_ID
  1141. };
  1142. struct PackedVaryings
  1143. {
  1144. ASE_SV_POSITION_QUALIFIERS float4 positionCS : SV_POSITION;
  1145. float4 clipPosV : TEXCOORD0;
  1146. float3 positionWS : TEXCOORD1;
  1147. float3 normalWS : TEXCOORD2;
  1148. UNITY_VERTEX_INPUT_INSTANCE_ID
  1149. UNITY_VERTEX_OUTPUT_STEREO
  1150. };
  1151. CBUFFER_START(UnityPerMaterial)
  1152. #ifdef ASE_TESSELLATION
  1153. float _TessPhongStrength;
  1154. float _TessValue;
  1155. float _TessMin;
  1156. float _TessMax;
  1157. float _TessEdgeLength;
  1158. float _TessMaxDisp;
  1159. #endif
  1160. CBUFFER_END
  1161. float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1162. float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
  1163. float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
  1164. float snoise( float2 v )
  1165. {
  1166. const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
  1167. float2 i = floor( v + dot( v, C.yy ) );
  1168. float2 x0 = v - i + dot( i, C.xx );
  1169. float2 i1;
  1170. i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
  1171. float4 x12 = x0.xyxy + C.xxzz;
  1172. x12.xy -= i1;
  1173. i = mod2D289( i );
  1174. float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
  1175. float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
  1176. m = m * m;
  1177. m = m * m;
  1178. float3 x = 2.0 * frac( p * C.www ) - 1.0;
  1179. float3 h = abs( x ) - 0.5;
  1180. float3 ox = floor( x + 0.5 );
  1181. float3 a0 = x - ox;
  1182. m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
  1183. float3 g;
  1184. g.x = a0.x * x0.x + h.x * x0.y;
  1185. g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  1186. return 130.0 * dot( m, g );
  1187. }
  1188. struct SurfaceDescription
  1189. {
  1190. float Alpha;
  1191. float AlphaClipThreshold;
  1192. };
  1193. PackedVaryings VertexFunction( Attributes input )
  1194. {
  1195. PackedVaryings output;
  1196. ZERO_INITIALIZE(PackedVaryings, output);
  1197. UNITY_SETUP_INSTANCE_ID(input);
  1198. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1199. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  1200. float2 temp_cast_0 = (5.0).xx;
  1201. float2 texCoord11 = input.ase_texcoord.xy * temp_cast_0 + float2( 0,0 );
  1202. float simplePerlin2D10 = snoise( texCoord11 );
  1203. simplePerlin2D10 = simplePerlin2D10*0.5 + 0.5;
  1204. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1205. float3 defaultVertexValue = input.positionOS.xyz;
  1206. #else
  1207. float3 defaultVertexValue = float3(0, 0, 0);
  1208. #endif
  1209. float3 vertexValue = ( simplePerlin2D10 * input.normalOS );
  1210. #ifdef ASE_ABSOLUTE_VERTEX_POS
  1211. input.positionOS.xyz = vertexValue;
  1212. #else
  1213. input.positionOS.xyz += vertexValue;
  1214. #endif
  1215. input.normalOS = input.normalOS;
  1216. VertexPositionInputs vertexInput = GetVertexPositionInputs( input.positionOS.xyz );
  1217. output.positionCS = vertexInput.positionCS;
  1218. output.clipPosV = vertexInput.positionCS;
  1219. output.positionWS = vertexInput.positionWS;
  1220. output.normalWS = TransformObjectToWorldNormal( input.normalOS );
  1221. return output;
  1222. }
  1223. #if defined(ASE_TESSELLATION)
  1224. struct VertexControl
  1225. {
  1226. float4 positionOS : INTERNALTESSPOS;
  1227. float3 normalOS : NORMAL;
  1228. float4 ase_texcoord : TEXCOORD0;
  1229. UNITY_VERTEX_INPUT_INSTANCE_ID
  1230. };
  1231. struct TessellationFactors
  1232. {
  1233. float edge[3] : SV_TessFactor;
  1234. float inside : SV_InsideTessFactor;
  1235. };
  1236. VertexControl vert ( Attributes input )
  1237. {
  1238. VertexControl output;
  1239. UNITY_SETUP_INSTANCE_ID(input);
  1240. UNITY_TRANSFER_INSTANCE_ID(input, output);
  1241. output.positionOS = input.positionOS;
  1242. output.normalOS = input.normalOS;
  1243. output.ase_texcoord = input.ase_texcoord;
  1244. return output;
  1245. }
  1246. TessellationFactors TessellationFunction (InputPatch<VertexControl,3> input)
  1247. {
  1248. TessellationFactors output;
  1249. float4 tf = 1;
  1250. float tessValue = _TessValue; float tessMin = _TessMin; float tessMax = _TessMax;
  1251. float edgeLength = _TessEdgeLength; float tessMaxDisp = _TessMaxDisp;
  1252. #if defined(ASE_FIXED_TESSELLATION)
  1253. tf = FixedTess( tessValue );
  1254. #elif defined(ASE_DISTANCE_TESSELLATION)
  1255. tf = DistanceBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, tessValue, tessMin, tessMax, GetObjectToWorldMatrix(), _WorldSpaceCameraPos );
  1256. #elif defined(ASE_LENGTH_TESSELLATION)
  1257. tf = EdgeLengthBasedTess(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams );
  1258. #elif defined(ASE_LENGTH_CULL_TESSELLATION)
  1259. tf = EdgeLengthBasedTessCull(input[0].positionOS, input[1].positionOS, input[2].positionOS, edgeLength, tessMaxDisp, GetObjectToWorldMatrix(), _WorldSpaceCameraPos, _ScreenParams, unity_CameraWorldClipPlanes );
  1260. #endif
  1261. output.edge[0] = tf.x; output.edge[1] = tf.y; output.edge[2] = tf.z; output.inside = tf.w;
  1262. return output;
  1263. }
  1264. [domain("tri")]
  1265. [partitioning("fractional_odd")]
  1266. [outputtopology("triangle_cw")]
  1267. [patchconstantfunc("TessellationFunction")]
  1268. [outputcontrolpoints(3)]
  1269. VertexControl HullFunction(InputPatch<VertexControl, 3> patch, uint id : SV_OutputControlPointID)
  1270. {
  1271. return patch[id];
  1272. }
  1273. [domain("tri")]
  1274. PackedVaryings DomainFunction(TessellationFactors factors, OutputPatch<VertexControl, 3> patch, float3 bary : SV_DomainLocation)
  1275. {
  1276. Attributes output = (Attributes) 0;
  1277. output.positionOS = patch[0].positionOS * bary.x + patch[1].positionOS * bary.y + patch[2].positionOS * bary.z;
  1278. output.normalOS = patch[0].normalOS * bary.x + patch[1].normalOS * bary.y + patch[2].normalOS * bary.z;
  1279. output.ase_texcoord = patch[0].ase_texcoord * bary.x + patch[1].ase_texcoord * bary.y + patch[2].ase_texcoord * bary.z;
  1280. #if defined(ASE_PHONG_TESSELLATION)
  1281. float3 pp[3];
  1282. for (int i = 0; i < 3; ++i)
  1283. pp[i] = output.positionOS.xyz - patch[i].normalOS * (dot(output.positionOS.xyz, patch[i].normalOS) - dot(patch[i].positionOS.xyz, patch[i].normalOS));
  1284. float phongStrength = _TessPhongStrength;
  1285. output.positionOS.xyz = phongStrength * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-phongStrength) * output.positionOS.xyz;
  1286. #endif
  1287. UNITY_TRANSFER_INSTANCE_ID(patch[0], output);
  1288. return VertexFunction(output);
  1289. }
  1290. #else
  1291. PackedVaryings vert ( Attributes input )
  1292. {
  1293. return VertexFunction( input );
  1294. }
  1295. #endif
  1296. void frag(PackedVaryings input
  1297. , out half4 outNormalWS : SV_Target0
  1298. #ifdef ASE_DEPTH_WRITE_ON
  1299. ,out float outputDepth : ASE_SV_DEPTH
  1300. #endif
  1301. #ifdef _WRITE_RENDERING_LAYERS
  1302. , out float4 outRenderingLayers : SV_Target1
  1303. #endif
  1304. )
  1305. {
  1306. UNITY_SETUP_INSTANCE_ID(input);
  1307. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( input );
  1308. float3 WorldPosition = input.positionWS;
  1309. float3 WorldNormal = input.normalWS;
  1310. float4 ClipPos = input.clipPosV;
  1311. float4 ScreenPos = ComputeScreenPos( input.clipPosV );
  1312. float Alpha = 1;
  1313. float AlphaClipThreshold = 0.5;
  1314. #ifdef ASE_DEPTH_WRITE_ON
  1315. float DepthValue = input.positionCS.z;
  1316. #endif
  1317. #ifdef _ALPHATEST_ON
  1318. clip(Alpha - AlphaClipThreshold);
  1319. #endif
  1320. #if defined(LOD_FADE_CROSSFADE)
  1321. LODFadeCrossFade( input.positionCS );
  1322. #endif
  1323. #ifdef ASE_DEPTH_WRITE_ON
  1324. outputDepth = DepthValue;
  1325. #endif
  1326. #if defined(_GBUFFER_NORMALS_OCT)
  1327. float3 normalWS = normalize(input.normalWS);
  1328. float2 octNormalWS = PackNormalOctQuadEncode(normalWS);
  1329. float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);
  1330. half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);
  1331. outNormalWS = half4(packedNormalWS, 0.0);
  1332. #else
  1333. float3 normalWS = input.normalWS;
  1334. outNormalWS = half4(NormalizeNormalPerPixel(normalWS), 0.0);
  1335. #endif
  1336. #ifdef _WRITE_RENDERING_LAYERS
  1337. uint renderingLayers = GetMeshRenderingLayer();
  1338. outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0);
  1339. #endif
  1340. }
  1341. ENDHLSL
  1342. }
  1343. }
  1344. CustomEditor "UnityEditor.ShaderGraphUnlitGUI"
  1345. FallBack "Hidden/Shader Graph/FallbackError"
  1346. Fallback Off
  1347. }
  1348. /*ASEBEGIN
  1349. Version=19801
  1350. Node;AmplifyShaderEditor.RangedFloatNode;12;-832,112;Inherit;False;Constant;_Float0;Float 0;0;0;Create;True;0;0;0;False;0;False;5;0;0;0;0;1;FLOAT;0
  1351. Node;AmplifyShaderEditor.TextureCoordinatesNode;11;-688,80;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
  1352. Node;AmplifyShaderEditor.NoiseGeneratorNode;10;-416,80;Inherit;True;Simplex2D;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT;0
  1353. Node;AmplifyShaderEditor.NormalVertexDataNode;15;-400,352;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  1354. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-112,256;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
  1355. Node;AmplifyShaderEditor.RangedFloatNode;16;16,-48;Inherit;False;Constant;_Float1;Float 1;0;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0
  1356. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;0;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ExtraPrePass;0;0;ExtraPrePass;5;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;0;False;False;0;;0;0;Standard;0;False;0
  1357. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ShadowCaster;0;2;ShadowCaster;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;False;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;True;3;False;;False;True;1;LightMode=ShadowCaster;False;False;0;;0;0;Standard;0;False;0
  1358. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;3;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthOnly;0;3;DepthOnly;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;False;False;True;True;False;False;False;0;False;;False;False;False;False;False;False;False;False;False;True;1;False;;False;False;True;1;LightMode=DepthOnly;False;False;0;;0;0;Standard;0;False;0
  1359. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;4;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Meta;0;4;Meta;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=Meta;False;False;0;;0;0;Standard;0;False;0
  1360. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;5;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;Universal2D;0;5;Universal2D;0;False;False;False;False;False;False;False;False;False;False;False;False;True;0;False;;False;True;0;False;;False;False;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;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;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=Universal2D;False;False;0;;0;0;Standard;0;False;0
  1361. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;6;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;SceneSelectionPass;0;6;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;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;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
  1362. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;7;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;ScenePickingPass;0;7;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;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;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
  1363. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;8;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormals;0;8;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;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;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;False;True;1;False;;True;3;False;;False;True;1;LightMode=DepthNormalsOnly;False;False;0;;0;0;Standard;0;False;0
  1364. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;9;0,0;Float;False;False;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;1;New Amplify Shader;2992e84f91cbeb14eab234972e07ea9d;True;DepthNormalsOnly;0;9;DepthNormalsOnly;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;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;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;False;True;1;False;;True;3;False;;False;True;1;LightMode=DepthNormalsOnly;False;True;9;d3d11;metal;vulkan;xboxone;xboxseries;playstation;ps4;ps5;switch;0;;0;0;Standard;0;False;0
  1365. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;1;208,-32;Float;False;True;-1;3;UnityEditor.ShaderGraphUnlitGUI;0;13;Cloud;2992e84f91cbeb14eab234972e07ea9d;True;Forward;0;1;Forward;9;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;False;False;False;True;4;RenderPipeline=UniversalPipeline;RenderType=Opaque=RenderType;Queue=Geometry=Queue=0;UniversalMaterialType=Unlit;True;5;True;12;all;0;False;True;1;1;False;;0;False;;1;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;True;True;True;0;False;;False;False;False;False;False;False;False;True;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;1;False;;True;3;False;;True;True;0;False;;0;False;;True;1;LightMode=UniversalForwardOnly;False;False;0;;0;0;Standard;25;Surface;0;0; Blend;0;0;Two Sided;1;0;Alpha Clipping;1;0; Use Shadow Threshold;0;0;Forward Only;0;0;Cast Shadows;0;638803938338071915;Receive Shadows;0;638803938350782325;GPU Instancing;1;0;LOD CrossFade;1;0;Built-in Fog;1;0;Meta Pass;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;0;10;False;True;False;True;False;False;True;True;True;False;False;;False;0
  1366. WireConnection;11;0;12;0
  1367. WireConnection;10;0;11;0
  1368. WireConnection;13;0;10;0
  1369. WireConnection;13;1;15;0
  1370. WireConnection;1;2;16;0
  1371. WireConnection;1;5;13;0
  1372. ASEEND*/
  1373. //CHKSM=8DF70D8C7602DD70B079E562823975CB06F375C0