{"id":320,"date":"2024-09-29T09:13:36","date_gmt":"2024-09-29T01:13:36","guid":{"rendered":"https:\/\/www.bertzzz-horizon.xyz\/?p=320"},"modified":"2024-10-20T21:08:28","modified_gmt":"2024-10-20T13:08:28","slug":"%e6%9f%8f%e6%9e%97%e4%b9%8b%e5%a3%b0%ef%bc%9f%e6%9f%8f%e6%9e%97%e5%99%aa%e5%a3%b0%ef%bc%81","status":"publish","type":"post","link":"https:\/\/www.bertzzz-horizon.xyz\/?p=320","title":{"rendered":"\u67cf\u6797\u4e4b\u58f0\uff1f\u67cf\u6797\u566a\u58f0\uff01"},"content":{"rendered":"\n<p>\u6b64\u67cf\u6797\uff08Ken <strong>Perlin<\/strong>\uff09\u975e\u5f7c\u67cf\u6797\uff08<strong>Berlin<\/strong>,the capital and largest city of Germany\uff09\u2026\u2026<\/p>\n\n\n\n<p>\u67cf\u6797\u566a\u58f0\uff08Perlin Noise\uff09\u5e94\u8be5\u4e0d\u7528\u8d58\u8ff0\u4e86\u3002<\/p>\n\n\n\n<ul>\n<li><sub>Improving noise,Ken Perlin,<a href=\"https:\/\/mrl.nyu.edu\/~perlin\/paper445.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><em>https:\/\/mrl.nyu.edu\/~perlin\/paper445.pdf<\/em><\/a><\/sub><\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u91cc\u76f4\u63a5\u628a\u6838\u5fc3\u4ee3\u7801\u653e\u4e0a\u6765\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def lerp(a, b, t):\n    return a + t * (b - a)<\/code><\/pre>\n\n\n\n<p>\u8fd9\u662f\u7528\u6765\u8fdb\u884c\u63d2\u503c\u7684lerp\u51fd\u6570\u3002\u4e0d\u8fc7\u8bf7\u7ee7\u7eed\u5f80\u4e0b\u770b\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def fade(t):\n    return t * t * t * (t * (t * 6 - 15) + 10)<\/code><\/pre>\n\n\n\n<p>\u76f4\u63a5lerp\u51fd\u6570\u8fdb\u884c\u7ebf\u6027\u63d2\u503c\u7684\u6548\u679c\u5e76\u4e0d\u597d\uff0c\u56e0\u6b64\u6211\u4eec\u4f7f\u7528\u8fd9\u4e2afade\u51fd\u6570\uff0c\u5b83\u7684\u53d8\u5316\u4e24\u5934\u5feb\uff0c\u4e2d\u95f4\u6162\u3002<\/p>\n\n\n\n<p class=\"has-text-align-justify\">\u987a\u4fbf\u4e00\u8bf4\uff0c\u5728<em>https:\/\/easings.net\/<\/em>\u53ef\u4ee5\u67e5\u5230\u5f88\u591a\u7f13\u52a8\u51fd\u6570\u3002\uff08\u65e0\u5173\uff09<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def grad(hash, x, y):\n    #\u6309\u4f4d\u4e0e\u8fd0\u7b97\u53d6\u51fahash\u7684\u6700\u540e\u4e24\u4f4d\n    h = hash &amp; 3\n\n    #u\u548cv\u57fa\u4e8eh\u7684\u503c\u5728x\u548cy\u4e4b\u95f4\u4ea4\u6362\n    u = x if h &lt; 2 else y\n    v = y if h &lt; 2 else x\n\n    #\u5224\u65ad\uff0c\u53d6\u548c\n    return (u if (h &amp; 1) == 0 else -u) + (v if (h &amp; 2) == 0 else -v)<\/code><\/pre>\n\n\n\n<p>\u8ba1\u7b97\u68af\u5ea6\u503c\u3002\u6ca1\u4ec0\u4e48\u597d\u8bf4\u7684\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def perlin(x, y, p):\n\n    #\u63d0\u53d6\u5750\u6807\u6574\u6570\u90e8\u5206\u5e76\u4fdd\u8bc1\u53d6\u503c\u8303\u56f4\n    x0 = int(x) &amp; 255\n    y0 = int(y) &amp; 255\n\n    xi = x - int(x)\n    yi = y - int(y)\n\n    #\u8ba1\u7b97\u63d2\u503c\u9700\u8981\u7684\u7684\u5e73\u6ed1\u503c\n    u = fade(xi)\n    v = fade(yi)\n\n    #\u786e\u5b9a\u7f51\u683c\u6bcf\u4e2a\u70b9\u7684\u7d22\u5f15\u5e76\u8ba1\u7b97\u68af\u5ea6\n    aa = p[x0] + y0\n    ab = p[x0] + y0 + 1\n    ba = p[x0 + 1] + y0\n    bb = p[x0 + 1] + y0 + 1\n\n    grad_aa = grad(p[aa], xi, yi)\n    grad_ab = grad(p[ab], xi, yi - 1)\n    grad_ba = grad(p[ba], xi - 1, yi)\n    grad_bb = grad(p[bb], xi - 1, yi - 1)\n\n    lerp_a = lerp(grad_aa, grad_ab, v)\n    lerp_b = lerp(grad_ba, grad_bb, v)\n\n    return lerp(lerp_a, lerp_b, u)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u5c1d\u8bd5\u5c06\u67cf\u6797\u566a\u58f0\u6df7\u5165\u56fe\u50cf\u4e2d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"1024\" src=\"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/jill_processed-904x1024.jpg\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/jill_processed-904x1024.jpg 904w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/jill_processed-265x300.jpg 265w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/jill_processed-768x870.jpg 768w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/jill_processed.jpg 1080w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure>\n\n\n\n<p>\u9a8c\u8bc1\u7801\u4e2d\u778e\u773c\u9009\u9879\u7684\u6765\u6e90\uff1f<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u56de\u5230\u4e00\u7ef4\u60c5\u5f62\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u67cf\u6797\u566a\u58f0\u4e0e\u6b63\u5f26\u51fd\u6570\u6df7\u5408<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/combined-1024x512.jpg\" alt=\"\" class=\"wp-image-330\" srcset=\"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/combined-1024x512.jpg 1024w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/combined-300x150.jpg 300w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/combined-768x384.jpg 768w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/combined.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/blended-1024x512.jpg\" alt=\"\" class=\"wp-image-331\" srcset=\"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/blended-1024x512.jpg 1024w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/blended-300x150.jpg 300w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/blended-768x384.jpg 768w, https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/blended.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u751f\u6210\u5904\u5904\u770b\u4f3c\u968f\u673a\u4f46\u662f\u603b\u4f53\u89c4\u5f8b\u6027\u8d77\u4f0f\u7684\u6570\u636e\u3002\u6e38\u620f\u4e2d\u7684\u5c71\u5ce6\u7b49\u968f\u673a\u751f\u6210\u5c31\u53ef\u4ee5\u8fd9\u4e48\u505a\uff08\u6269\u5c55\u7ef4\u6570\u5373\u53ef\uff09\u3002\u52a0\u4e0a\u201c\u65f6\u95f4\u201d\u8fd9\u4e00\u7ef4\u8fd8\u53ef\u4ee5\u751f\u6210\u6d77\u6d6a\u7b49\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b64\u67cf\u6797\uff08Ken Perlin\uff09\u975e\u5f7c\u67cf\u6797\uff08Berlin,the capital and largest city [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":321,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[9],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.bertzzz-horizon.xyz\/wordpress\/wp-content\/uploads\/2024\/09\/perlin_noise.png","_links":{"self":[{"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/posts\/320"}],"collection":[{"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320"}],"version-history":[{"count":9,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":347,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/posts\/320\/revisions\/347"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=\/wp\/v2\/media\/321"}],"wp:attachment":[{"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bertzzz-horizon.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}