{"id":5403,"date":"2023-11-21T14:37:04","date_gmt":"2023-11-21T06:37:04","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=5403"},"modified":"2023-11-21T14:37:04","modified_gmt":"2023-11-21T06:37:04","slug":"spine%e6%ba%b6%e8%a7%a3%e6%95%88%e6%9e%9c%e8%af%95%e5%81%9a","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=5403","title":{"rendered":"Spine\u6eb6\u89e3\u6548\u679c\u8bd5\u505a"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>Shader \"Spine\/Skeleton-Dissolve\" {\n\tProperties{\n\t\t_Cutoff(\"Alpha cutoff\", Range(0,1)) = 0.0\n\t\t_Color(\"Color\", Color) = (1.000000,1.000000,1.000000,1.000000)\n\t\t_Alpha(\"Alpha \",Range(0,1)) = 1\n\t\t_LumV(\"LumV\",Range(0,1)) = 0\n\t\t_TintBlackV(\"TintBlackV\",Range(0,1)) = 0\n\t\t_TintWhiteV(\"TintWhiteV\", Range(0,1)) = 0\n\t\t[NoScaleOffset] _MainTex (\"Main Texture\", 2D) = \"black\" {}\n\t\t[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput(\"Straight Alpha Texture\", Int) = 1\n\t\t[HideInInspector] _StencilRef(\"Stencil Reference\", Float) = 1.0\n\t\t[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp(\"Stencil Comparison\", Float) = 8 \/\/ Set to Always as default\n\n\t\t\/\/ Outline properties are drawn via custom editor.\n\t\t[HideInInspector] _OutlineWidth(\"Outline Width\", Range(0,8)) = 3.0\n\t\t[HideInInspector] _OutlineColor(\"Outline Color\", Color) = (1,1,0,1)\n\t\t[HideInInspector] _OutlineReferenceTexWidth(\"Reference Texture Width\", Int) = 1024\n\t\t[HideInInspector] _ThresholdEnd(\"Outline Threshold\", Range(0,1)) = 0.25\n\t\t[HideInInspector] _OutlineSmoothness(\"Outline Smoothness\", Range(0,1)) = 1.0\n\t\t[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood(\"Sample 8 Neighbours\", Float) = 1\n\t\t[HideInInspector] _OutlineMipLevel(\"Outline Mip Level\", Range(0,3)) = 0\n\n\t\t_DissolveTexture(\"\u6eb6\u89e3\u7eb9\u7406\", 2D) = \"black\" {}\n\t\t_DissolveSize(\"\u7eb9\u7406\u7f29\u653e\", Float) = 10\n\t\t_DissolveSpeed(\"\u6eb6\u89e3\u901f\u5ea6\", Float) = 10\n\t\t_DissolveColor(\"\u6eb6\u89e3\u989c\u8272\", Color) = (1.000000,1.000000,1.000000,1.000000)\n\t\t_DissolveEdge(\"\u6eb6\u89e3\u8fb9\u7f18\u5bbd\u5ea6\", Float) = 3\n\t}\n\n\tSubShader {\n\t\tTags { \"Queue\"=\"Transparent\" \"IgnoreProjector\"=\"True\" \"RenderType\"=\"Transparent\" \"PreviewType\"=\"Plane\" }\n\n\t\tFog { Mode Off }\n\t\tCull Off\n\t\tZWrite Off\n\t\tLighting Off\n\t\tBlend One OneMinusSrcAlpha\n\t\t\n\t\tStencil {\n\t\t\tRef[_StencilRef]\n\t\t\tComp[_StencilComp]\n\t\t\tPass Keep\n\t\t}\n\n\t\tPass {\n\t\t\tTags { \"Queue\"=\"Transparent\" \"IgnoreProjector\"=\"True\" \"RenderType\"=\"Transparent\" \"PreviewType\"=\"Plane\" }\n\t\t\tName \"Normal\"\n\t\t\tColorMask RGBA\n\t\t\tCGPROGRAM\n\t\t\t#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT\n\t\t\t#pragma vertex vert\n\t\t\t#pragma fragment frag\n\t\t\t#include \"UnityCG.cginc\"\n\t\t\tsampler2D _MainTex;\n\t\t\tsampler2D _DissolveTexture;\n\t\t\tfixed _Cutoff;\n\t\t\tint _GreyScale;\n\t\t\tfloat4 _Color;\n\t\t\thalf _Alpha;\n\t\t\tfloat _LumV;\n\t\t\tfloat _TintBlackV;\n\t\t\tfloat _TintWhiteV;\n\t\t\tfloat _DissolveSpeed;\n\t\t\tfloat _DissolveSize;\n\t\t\tfloat _DissolveEdge;\n\t\t\tfloat4 _DissolveColor;\n\t\t\t\t\n\t\t\tstruct VertexInput {\n\t\t\t\tfloat4 vertex : POSITION;\n\t\t\t\tfloat2 uv : TEXCOORD0;\n\t\t\t\tfloat4 vertexColor : COLOR;\n\t\t\t};\n\n\t\t\tstruct VertexOutput {\n\t\t\t\tfloat4 pos : SV_POSITION;\n\t\t\t\tfloat2 uv : TEXCOORD0;\n\t\t\t\tfloat4 uv2 : TEXCOORD1;\n\t\t\t\tfloat4 vertexColor : COLOR;\n\t\t\t};\n\n\t\t\tVertexOutput vert (VertexInput v) {\n\t\t\t\tVertexOutput o;\n\t\t\t\to.pos = UnityObjectToClipPos(v.vertex);\n\t\t\t\to.uv2 = ComputeScreenPos(o.pos);\n\t\t\t\to.uv = v.uv;\n\t\t\t\to.vertexColor = v.vertexColor;\n\t\t\t\treturn o;\n\t\t\t}\n\n\t\t\tfloat4 frag (VertexOutput i) : SV_Target {\n\t\t\t\tfloat4 texColor = tex2D(_MainTex, i.uv);\n\t\t\t\ttexColor.a = lerp(0, texColor.a, _Alpha);\n\n\t\t\t\t#if defined(_STRAIGHT_ALPHA_INPUT)\n\t\t\t\t\ttexColor.rgb *= texColor.a;\n\t\t\t\t#endif\n\n\t\t\t\tfloat2 disUv = i.uv2.xy \/ _DissolveSize;\n\t\t\t\tfloat4 disCol = tex2D(_DissolveTexture, disUv);\n\n\t\t\t\tfloat ds = _DissolveSpeed \/ 10;\n\t\t\t\tfloat alpha = clamp( (_Time.y % ds) \/ ds, 0, 1);\n\t\t\t\tclip(disCol.r - alpha );\n\n\t\t\t\tfloat a = step( disCol.r - alpha, _DissolveEdge \/ 100);\n\t\t\t\ttexColor.rgb = lerp(texColor.rgb, texColor.rgb * _DissolveColor.rgb, a);\n\n\t\t\t\treturn texColor;\n\t\t\t}\n\t\t\tENDCG\n\t\t}\n\t}\n\tCustomEditor \"SpineShaderWithOutlineGUI\"\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/5403"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5403"}],"version-history":[{"count":1,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/5403\/revisions"}],"predecessor-version":[{"id":5404,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/5403\/revisions\/5404"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}