{"id":5393,"date":"2023-11-15T23:42:34","date_gmt":"2023-11-15T15:42:34","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=5393"},"modified":"2023-11-15T23:43:26","modified_gmt":"2023-11-15T15:43:26","slug":"%e7%ae%80%e5%8d%95%e7%9a%84%e7%ba%b9%e7%90%86%e6%89%b0%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=5393","title":{"rendered":"\u7b80\u5355\u7684\u7eb9\u7406\u6270\u52a8\u6548\u679c"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>Shader \"Unlit\/NoiseTexture\"\n{\n    Properties\n    {\n        _MainTex (\"MainTexture\", 2d) = \"white\"{}\n        _WarpTex (\"NoiseTexture\", 2d) = \"white\"{}\n        _WaveValue (\"_WaveValue\", range(0, 20)) = 10\n        _WaveSpeed (\"_WaveSpeed\", range(0, 100)) = 10\n    }\n    SubShader \n    {\n        Pass \n        {\n            Name \"FORWARD\"\n            CGPROGRAM\n            #pragma vertex vert\n            #pragma fragment frag\n            #include \"UnityCG.cginc\"\n            sampler2D _MainTex;\n            sampler2D _WarpTex;    \n            float4 _WarpTex_ST;\n            half _WaveValue;\n            half _WaveSpeed;\n            struct VertexInput \n            {\n                float4 vertex : POSITION;\n                float2 uv : TEXCOORD0;\n            };\n\n            struct VertexOutput \n            {\n                float4 pos : SV_POSITION;\n                float2 uv0 : TEXCOORD0;\n                float2 uv1 : TEXCOORD1;\n            };\n\n            VertexOutput vert (VertexInput v) \n            {\n                VertexOutput o = (VertexOutput)0;\n                o.pos = UnityObjectToClipPos( v.vertex);\n                o.uv0 = v.uv;\n                o.uv1 = TRANSFORM_TEX(v.uv, _WarpTex);\n                o.uv1.x = o.uv1.x + frac(_Time.x * _WaveSpeed \/ 100);\n                o.uv1.y = o.uv1.y + frac(_Time.y * _WaveSpeed \/ 100);\n                return o;\n            }\n\n            half4 frag(VertexOutput i) : COLOR \n            {\n                float3 offset = tex2D(_WarpTex, i.uv1).rgb \/ _WaveValue;\n                return tex2D(_MainTex, i.uv0 + offset.xy);\n            }\n            ENDCG\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"474\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2023\/11\/image-20.png\" alt=\"\" class=\"wp-image-5395\" srcset=\"https:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2023\/11\/image-20.png 972w, https:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2023\/11\/image-20-512x250.png 512w, https:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2023\/11\/image-20-768x375.png 768w\" sizes=\"(max-width: 972px) 100vw, 972px\" \/><\/figure>\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\/5393"}],"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=5393"}],"version-history":[{"count":2,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/5393\/revisions"}],"predecessor-version":[{"id":5396,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/5393\/revisions\/5396"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}