{"id":202,"date":"2024-07-29T12:19:02","date_gmt":"2024-07-29T04:19:02","guid":{"rendered":"http:\/\/chenglixue.top\/?p=202"},"modified":"2024-08-08T14:09:30","modified_gmt":"2024-08-08T06:09:30","slug":"unity-%e5%a4%a7%e6%b0%94%e6%95%a3%e5%b0%84%e7%9a%84%e5%8e%9f%e7%90%86%e5%ae%9e%e7%8e%b0%e5%8f%8a%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"http:\/\/chenglixue.top\/?p=202","title":{"rendered":"unity \u5927\u6c14\u6563\u5c04\u7684\u539f\u7406\u5b9e\u73b0\u53ca\u4f18\u5316"},"content":{"rendered":"<p><div class=\"has-toc have-toc\"><\/div><\/p>\n<h1>\u4ec0\u4e48\u662f\u5927\u6c14\u6563\u5c04<\/h1>\n<p>\u5927\u6c14\u6563\u5c04\u6a21\u62df\u592a\u9633\u5149\u5728\u5927\u6c14\u5c42\u7a7f\u884c\u65f6\u53d1\u751f\u7684\u4e00\u7cfb\u5217\u590d\u6742\u7684\u5149\u5b66\u73b0\u8c61\uff0c\u8fdb\u800c\u6a21\u62df\u51fa\u5927\u81ea\u7136\u4e2d\u4ee4\u4eba\u60ca\u8273\u7684\u89c6\u89c9\u6548\u679c\u3002UE\u63d0\u4f9b\u4e86\u4e00\u4e2a\u73b0\u6210\u7684\u5927\u6c14\u6563\u5c04\u7ec4\u4ef6\uff0c\u5927\u81f4\u6548\u679c\u5982\u4e0b\u6240\u793a\uff1a<br \/>\n<img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a09f3bd9c307b7e90715fe.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a09f3bd9c307b7e90715fe.png\" alt=\"\" \/><\/p><\/noscript>\n<p>\u4f20\u7edf\u5927\u6c14\u7684\u6e32\u67d3\u662f\u4f7f\u7528<code>\u7c7b\u4f3c phong \u6a21\u578b\u7684\u7ecf\u9a8c\u516c\u5f0f<\/code>\u53bb\u903c\u8fd1\uff0c\u867d\u7136\u7ed3\u679c\u8fd8\u884c\uff0c\u4f46\u53c2\u6570\u5bf9\u4e8e\u827a\u672f\u5bb6\u4e0d\u597d\u7406\u89e3\uff0c\u4e14\u4e0d\u662f\u57fa\u4e8e\u7269\u7406\u7684<\/p>\n<h1>\u4e3a\u4ec0\u4e48\u9700\u8981\u5927\u6c14\u6563\u5c04<\/h1>\n<p>\u5f88\u76f4\u63a5\u7684\u4e00\u4e2a\u539f\u56e0\uff1a\u4e3a\u4e86\u597d\u5eb7\uff01\u4e0a\u56fe\u53ef\u4ee5\u770b\u51fa\u52a0\u4e86\u5927\u6c14\u6563\u5c04\u4f7f\u5f97\u6574\u4f53\u6c1b\u56f4\u62c9\u6ee1<\/p>\n<h1>\u7406\u8bba<\/h1>\n<p>\u5176\u4e2d\u7684\u63a8\u5bfc\u90e8\u5206\u53ef\u4ee5\u770b\u5927\u54e5\u7684<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/zhuanlan.zhihu.com\/p\/237727216\" target=\"_blank\"  rel=\"nofollow\" >\u6587\u7ae0<\/a><\/p>\n<h2>\u6563\u5c04\u3001\u8870\u51cf\u3001\u5438\u6536<\/h2>\n<p>\u5728\u8c08\u8bba\u7269\u7406\u6e32\u67d3\u90e8\u5206\u90fd\u7ed5\u4e0d\u5f00\u8fd9\u4e09\u8d27\uff1a\u6563\u5c04\u3001\u8870\u51cf\u3001\u5438\u6536<\/p>\n<p>\u6563\u5c04\uff1a\u548c\u6b21\u8868\u9762\u6563\u5c04\u7684\u6563\u5c04\u662f\u540c\u4e00\u4e2a\u610f\u601d\u2014\u2014\u5149\u7ebf\u6253\u5230\u7269\u4f53\u8868\u9762\uff0c\u4f1a\u51fa\u73b0\u53cd\u5c04\u3001\u6298\u5c04\uff0c\u4e14\u5e26\u6709\u80fd\u91cf\u635f\u5931<\/p>\n<p>\u8870\u51cf\uff1a\u5149\u7ebf\u5728\u7a7a\u6c14\u4e2d\u884c\u8fdb\u4e5f\u4f1a\u4f34\u6709\u80fd\u91cf\u635f\u5931<\/p>\n<p>\u5438\u6536\uff1a\u5149\u7ebf\u6253\u5230\u7269\u4f53\u8868\u9762\u65f6\uff0c\u90e8\u5206\u6563\u5c04\uff0c\u90e8\u5206\u88ab\u5438\u6536<\/p>\n<p>\u5927\u6c14\u4e2d\u6839\u636e\u9897\u7c92\u7684\u76f4\u5f84\u5927\u5c0f\uff0c\u4e3b\u8981\u5b58\u5728\u4e24\u79cd\u6563\u5c04\u2014\u2014<code>\u745e\u5229\u6563\u5c04\u548c\u7c73\u6c0f\u6563\u5c04<\/code><\/p>\n<ol>\n<li>\u745e\u5229\u6563\u5c04\uff08\u9897\u7c92\u76f4\u5f84\u8fdc\u5c0f\u4e8e\u6ce2\u957f\uff09\uff1a\u4e0d\u540c\u6ce2\u957f\u7684\u5149\u635f\u5931\u7684\u80fd\u91cf\u5404\u6709\u4e0d\u540c\uff0c\u4f46\u662f\u6563\u5c04\u5411\u5404\u4e2a\u65b9\u5411\u7684\u80fd\u91cf\u76f8\u5dee\u4e0d\u5927(<code>\u5404\u5411\u540c\u6027<\/code>)\u3002\u745e\u5229\u6563\u5c04<code>\u9003\u9038\u8f83\u591a\u7684\u84dd\u5149<\/code>\uff0c\u8fd9\u662f<code>\u5929\u7a7a\u5448\u73b0\u84dd\u8272<\/code>\u7684\u539f\u56e0<\/li>\n<li>\u7c73\u6c0f\u6563\u5c04\uff08\u7c92\u5b50\u76f4\u5f84\u548c\u6ce2\u957f\u76f8\u5f53\uff09\uff1a\u4e0d\u540c\u6ce2\u957f\u7684\u5149\u635f\u5931\u7684\u80fd\u91cf\u76f8\u540c\uff0c\u4f46\u662f\u4e0d\u540c\u7684\u6563\u5c04\u65b9\u5411\u51fa\u5c04\u7684\u80fd\u91cf\u6709\u7740\u5de8\u5927\u7684\u5dee\u5f02(<code>\u5404\u5411\u5f02\u6027<\/code>)\u3002\u7c73\u6c0f\u6563\u5c04\u65b9\u5411\u6027\u8f83\u5f3a\uff0c\u662f<code>\u592a\u9633\u5149\u6655<\/code>\u7684\u6210\u56e0<\/li>\n<\/ol>\n<h2>\u5927\u6c14<\/h2>\n<ul>\n<li>\u5927\u6c14\u7684\u7ec4\u6210\uff1a\u5927\u6c14\u91cc\u5305\u542b\u8bb8\u591a\u4e0d\u540c\u7684\u9897\u7c92\uff0c\u8fd9\u4e9b\u9897\u7c92\u6709\u5927\u6709\u5c0f\uff0c\u5f53\u5149\u7ebf\u6253\u5230\u4e0d\u540c\u7684\u9897\u7c92\u65f6\uff0c\u4f1a\u53d1\u751f\u4e0d\u540c\u7684\u6563\u5c04\u3002\u5f53\u6253\u5230\u5c0f\u9897\u7c92\u65f6\uff0c\u4f1a\u53d1\u751fRayleigh \u6563\u5c04\uff1b\u5f53\u6253\u5230\u5927\u9897\u7c92\u65f6\uff0c\u4f1a\u53d1\u751fMei\u6563\u5c04<\/li>\n<li>\u5927\u6c14\u7684\u5bc6\u5ea6\uff1a\u5927\u6c14\u7684\u5bc6\u5ea6\u5e76\u4e0d\u662f\u5747\u5300\u7684\uff0c<code>\u5bc6\u5ea6\u5927\u5c0f\u4e0e\u6d77\u62d4\u6709\u5173<\/code>\uff0c\u5bc6\u5ea6\u8d8a\u5927\u6563\u5c04\u5f3a\u5ea6\u8d8a\u5f3a<\/li>\n<\/ul>\n<h2>\u6563\u5c04\u65b9\u7a0b<\/h2>\n<p>\u745e\u5229\u6563\u5c04\u548c\u7c73\u6c0f\u6563\u5c04\u90fd\u6709\u7740\u4e0d\u540c\u7684\u6563\u5c04\u65b9\u7a0b\uff0c\u7528\u4ee5\u63cf\u8ff0<code>\u5165\u5c04\u5149\u6563\u5c04\u5230\u7279\u5b9a\u65b9\u5411\u4e0a\u7684\u80fd\u91cf\u767e\u5206\u6bd4<\/code><\/p>\n<ul>\n<li>\u4e3b\u8981\u5f62\u5f0f\uff1a<span class=\"katex math inline\">S(\u03bb, \u03b8, h)<\/span>.\u9664\u6b64\u4e4b\u5916\u7686\u4e3a\u5e38\u91cf<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u4e49\uff1a<strong>\u6ce2\u957f<span class=\"katex math inline\">\u03bb<\/span>\u7684\u5149\uff0c\u5728\u6d77\u62d4<span class=\"katex math inline\">h<\/span>\u5904\uff0c\u6563\u5c04\u5230<span class=\"katex math inline\">\u03b8<\/span>\u89d2\u5ea6\u7684\u80fd\u91cf\u767e\u5206\u6bd4<\/strong>\u3002\u6563\u5c04\u65b9\u7a0b\u771f\u6b63\u8868\u793a\u7684\u662f\u6563\u5c04\u5230\u76f8\u673a\u7684\u80fd\u91cf\u5927\u5c0f\uff08\u56e0\u4e3a\u6563\u5c04\u4f1a\u671d\u5404\u4e2a\u65b9\u5411\uff0c\u4f46\u6e32\u67d3\u65f6\u53ea\u5173\u5fc3\u6563\u5c04\u5230\u76f8\u673a\u65b9\u5411\u7684\u767e\u5206\u6bd4\uff09<\/p>\n<\/li>\n<\/ul>\n<p>\u5148\u7740\u624b\u76f8\u5bf9\u7b80\u5355\u7684\u745e\u5229\u6563\u5c04\uff0c\u4e00\u6b65\u6b65\u5730\u6765\u89e3\u8bfb\u6563\u5c04\u65b9\u7a0b\uff0c\u641e\u660e\u767d\u540e\u518d\u770b\u66f4\u52a0\u590d\u6742\u7684\u7c73\u6c0f\u6563\u5c04<\/p>\n<h2>\u745e\u5229\u6563\u5c04<\/h2>\n<p>\u745e\u5229\u6563\u5c04\u65b9\u7a0b\uff1a<span class=\"katex math multi-line\">S(\u03bb, \u03b8, h) = \\frac{\u03a0^2(n^2 - 1)^2}{2} \\frac{\u03c1(h)}{N} \\frac{1}{\u03bb^4} (1 + cos^2\u03b8)<\/span><\/p>\n<h3>\u6563\u5c04\u7cfb\u6570<\/h3>\n<ul>\n<li>\u5b9a\u4e49\uff1a\u6563\u5c04\u5230\u67d0\u65b9\u5411\u7684\u767e\u5206\u6bd4\uff0c\u66f4\u51c6\u786e\u5730\u8bf4\u6563\u5c04\u7cfb\u6570\u63cf\u8ff0\u4e86\u5149\u6563\u5c04\u540e\u7684<strong>\u80fd\u91cf\u635f\u5931\u767e\u5206\u6bd4<\/strong>\n<p>\u7b80\u5355\u6765\u8bf4\uff0c\u6563\u5c04\u65b9\u7a0b\u63cf\u8ff0\u4e86\u5165\u5c04\u5149\u6563\u5c04\u5230\u7279\u5b9a\u65b9\u5411\u4e0a\u7684\u80fd\u91cf\u767e\u5206\u6bd4\uff0c\u8fd9\u4e2a\u767e\u5206\u6bd4\u5c31\u7531\u6563\u5c04\u7cfb\u6570\u51b3\u5b9a<\/p>\n<\/li>\n<li>\n<p>\u4e3b\u8981\u5f62\u5f0f\uff1a<span class=\"katex math inline\">\u03b2 = (\u03bb, h)<\/span><\/p>\n<p>\u6563\u5c04\u7cfb\u6570<strong>\u53ea\u548c\u6ce2\u957f\u3001\u6d77\u62d4\u9ad8\u5ea6\u6709\u5173<\/strong>\uff0c\u4e0e\u65b9\u5411\u65e0\u5173<\/p>\n<\/li>\n<li>\n<p>\u745e\u5229\u6563\u5c04\u7cfb\u6570\uff1a<span class=\"katex math multi-line\">\u03b2 = (\u03bb, h) = \\frac{8\u03a0^3 (n^2 - 1)^2}{3} \\frac{\u03c1_r(h)}{N} \\frac{1}{\u03bb^4}<\/span><\/p>\n<p>\u8fd9\u91cc\u5148\u5c55\u793a\u745e\u5229\u6563\u5c04\u7cfb\u6570\u7684\u4e3b\u8981\u5f62\u5f0f\uff0c\u7ec6\u8282\u7b49\u540e\u9762\u518d\u4ecb\u7ecd\uff0c\u4e0d\u7136\u4eba\u8981\u6655\u7684<\/p>\n<\/li>\n<li>\n<p>\u7b80\u5355\u8ba1\u7b97<\/p>\n<p>\u745e\u5229\u6563\u5c04\u867d\u7136\u6bd4\u7c73\u6c0f\u6563\u5c04\u66f4\u7b80\u6d01\uff0c\u4f46\u8ba1\u7b97\u91cf\u4f9d\u7136\u4e0d\u5c0f\uff0c\u5728\u5b9e\u65f6\u6e32\u67d3\u4e2d\u4e00\u80a1\u8111\u7684\u8ba1\u7b97\u662f\u4e0d\u53ef\u53d6\u7684\uff0c\u9700\u8981\u4e00\u5b9a\u7684\u624b\u6bb5\u6765\u7b80\u5316<\/p>\n<p>\u901a\u5e38\u5728\u7b80\u5316\u65f6\uff0c\u9700\u8981\u628a\u6563\u5c04\u7cfb\u6570\u5206\u4e3a<span class=\"katex math inline\">\u03b2(\u03bb) \u03c1(h)<\/span>\uff0c\u5176\u4e2d<span class=\"katex math inline\">\u03b2(\u03bb)<\/span>\u8868\u793a\u6d77\u62d4\u9ad8\u5ea6\u4e3a0\u7684\u6563\u5c04\u7cfb\u6570\uff0c\u5373<span class=\"katex math inline\">\\frac{8\u03a0^3 (n^2 - 1)^2}{3} \\frac{1}{N} \\frac{1}{\u03bb^4}<\/span><\/p>\n<p>\u5728\u5b9e\u9645\u8ba1\u7b97\u65f6\uff0c\u5927\u591a\u8bbe\u5b9a<strong>\u7ea2\u7eff\u84dd\u7684\u6ce2\u957f\u4e3a440\u3001550\u3001680nm<\/strong>\uff0c\u5373<span class=\"katex math inline\">\u03b2(440,550,680) = (33.1, 13.5, 5.8) * 10^{-6}<\/span>\u3002\u5b9e\u9645\u4e0a\uff0c<strong>\u8fd9\u4e2a\u503c\u662f\u6563\u5c04\u7cfb\u6570\u7684\u6700\u5927\u503c\uff0c\u5f53\u6d77\u62d4\u9ad8\u5ea6\u8d8a\u9ad8\uff0c\u6563\u5c04\u7cfb\u6570\u8d8a\u5c0f<\/strong><\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u62c6\u5206\u5f00\u5462\uff1f\u56e0\u4e3a\u53ef\u4ee5\u770b\u51fa\u5f53<span class=\"katex math inline\">\u03b2(\u03bb)<\/span>\u4e0e\u6d77\u62d4\u9ad8\u5ea6\u65e0\u5173\u65f6\uff0c\u4ec5\u4ec5\u662f\u4e00\u4e2a\u5e38\u6570\uff0c\u90a3\u4e48\u53ef\u4ee5\u63d0\u524d\u5728cpu\u7aef\u5c06<span class=\"katex math inline\">\u03b2(\u03bb)<\/span>\u4f20\u7ed9gpu\uff0c\u4ee5\u51cf\u5c11gpu\u538b\u529b<\/p>\n<p>\u5269\u4e0b\u7684\u53ea\u9700\u5728GPU\u4e2d\u8ba1\u7b97<span class=\"katex math inline\">\u03c1(h)<\/span>\uff0c\u4f46<span class=\"katex math inline\">\u03c1(h)<\/span>\u7684\u8ba1\u7b97\u5e76\u4e0d\u7b80\u5355\uff0c\u56e0\u4e3a\u5b83\u4ee3\u8868\u7740\u6d77\u62d4\u9ad8\u5ea6\u5bf9\u6563\u5c04\u7684\u5f71\u54cd\uff0c\u9700\u8981\u5bf9\u4ed6\u8ba1\u7b97\u5927\u91cf\u79ef\u5206<\/p>\n<\/li>\n<\/ul>\n<h3>\u76f8\u4f4d\u51fd\u6570<\/h3>\n<p>\u76ee\u524d\u5df2\u7ecf\u77e5\u9053\u6563\u5c04\u65b9\u7a0b\u4e2d\u7684\u6ce2\u957f\u4e0e\u6d77\u62d4\u9ad8\u5ea6\u4e86\uff0c\u53ea\u5269\u4e0b\u8ba1\u7b97<strong>\u6307\u5b9a\u65b9\u5411\u5360\u6563\u5c04\u65b9\u5411\u7684\u767e\u5206\u6bd4<\/strong>\uff0c\u800c\u76f8\u4f4d\u51fd\u6570\u5c31\u5728\u505a\u8fd9\u4e2a\u5de5\u4f5c<\/p>\n<ul>\n<li>\u4e3b\u8981\u5f62\u5f0f\uff1a<span class=\"katex math inline\">\u03b3(\u03b8)<\/span><\/p>\n<\/li>\n<li>\n<p>\u745e\u5229\u6563\u5c04\u76f8\u4f4d\u51fd\u6570\uff1a<span class=\"katex math multi-line\">\u03b3(\u03b8) = \\frac{3}{16\u03a0}(1 + cos^2\u03b8)<\/span><\/p>\n<p>\u6839\u636e\u8be5\u51fd\u6570\u4e0d\u96be\u770b\u51fa\uff0c\u5149\u7ebf<strong>\u5f88\u96be\u6cbf\u774090\u00b0\u65b9\u5411\u6563\u5c04\uff0c\u5f88\u5bb9\u6613\u6cbf\u7740\u539f\u65b9\u5411\u6216\u53cd\u65b9\u5411\u6563\u5c04<\/strong><\/p>\n<\/li>\n<\/ul>\n<h3>\u5927\u6c14\u5bc6\u5ea6\u6bd4\u4f8b\u51fd\u6570\u03c1(h)<\/h3>\n<p>\u03c1(h)\u610f\u4e3a\u5927\u6c14\u5bc6\u5ea6\u6bd4\u4f8b\u65b9\u7a0b\uff0c\u8868\u793a<strong>\u6d77\u62d4\u4e3ah\u5904\u7684\u5927\u6c14\u5bc6\u5ea6\u548c\u6d77\u5e73\u9762\u5904\u7684\u5927\u6c14\u5bc6\u5ea6\u7684\u6bd4\u503c<\/strong><\/p>\n<ul>\n<li>\u51fd\u6570\u5f62\u5f0f\uff1a<span class=\"katex math inline\">\u03c1(h) = \\frac{density(h)}{density(0)}<\/span>\n<p><span class=\"katex math inline\">density(0)<\/span>\u53ef\u4ee5\u6d4b\u7b97\u51fa\u6765\uff0c\u4f46<span class=\"katex math inline\">density(h)<\/span>\u9700\u8981\u8ba1\u7b97\u4e14\u96be\u5ea6\u4e0d\u5c0f\uff0c\u56e0\u4e3a\u5927\u6c14\u7684\u7ec4\u6210\u975e\u5e38\u590d\u6742\uff0c\u7531\u4e0d\u540c\u538b\u529b\u3001\u5bc6\u5ea6\u3001\u6e29\u5ea6\u7684\u51e0\u5c42\u7ec4\u6210\u3002\u597d\u5728\u745e\u4e3d\u6563\u5c04\u548c\u7c73\u6c0f\u6563\u5c04\u53d1\u751f\u5728<strong>\u8f83\u4f4e\u7684\u5927\u6c14\u5c42<\/strong>\uff0c\u5728\u8fd9\u91cc<strong>\u5927\u6c14\u5bc6\u5ea6\u968f\u7740\u9ad8\u5ea6\u6307\u6570\u8870\u51cf<\/strong>\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u6761\u66f2\u7ebf\u8fd1\u4f3c\u6a21\u62df<span class=\"katex math inline\">density(h)<\/span><\/p>\n<p>\u4f46\u5728\u5b9e\u9645\u8ba1\u7b97\u65f6\uff0c\u4e0d\u4f1a\u7528\u5230\u4e0a\u8ff0\u51fd\u6570\uff0c\u800c\u662f\u4f7f\u7528\u8fd1\u4f3c\u2014\u2014<span class=\"katex math inline\">\u03c1(h) = exp(-\\frac{h}{H})<\/span>\uff0c\u5176\u4e2d<strong>H\u662f\u57fa\u51c6\u9ad8\u5ea6\uff08\u56fa\u5b9a\u503c\uff09\uff0c\u745e\u5229\u6563\u5c04\u4e3a8500\u7c73<\/strong><\/p>\n<\/li>\n<\/ul>\n<h3>\u80fd\u91cf\u8870\u51cf<\/h3>\n<p>\u5df2\u7ecf\u77e5\u9053\u6563\u5c04\u7cfb\u6570\u4e86\uff0c\u90a3\u4e48\u5047\u8bbe\u5149\u7ebf\u521d\u59cb\u5f3a\u5ea6\u4e3a<span class=\"katex math inline\">I_0<\/span>\uff0c\u5b83\u5728\u4e00\u5904\u6563\u5c04\u7cfb\u6570\u4e3a<span class=\"katex math inline\">\u03b2<\/span>\u7684<strong>\u5747\u5300\u4ecb\u8d28<\/strong>\u884c\u9a76<strong>x\u8ddd\u79bb<\/strong>\u540e\uff0c\u5269\u4f59\u7684\u80fd\u91cf<span class=\"katex math inline\">I_1<\/span>\u5e94\u4e3a\u591a\u5c11\uff1f<\/p>\n<p>\u5982\u679c\u53ea\u53d1\u751f\u4e00\u6b21\u6563\u5c04\uff0c\u90a3<span class=\"katex math inline\">I_1<\/span>\u80af\u5b9a\u4e3a<span class=\"katex math inline\">I_1 = I0(1 - \u03b2)<\/span><\/p>\n<p>\u4f46\u5728\u5927\u6c14\u4e2d\u662f\u5b58\u5728\u8bb8\u591a\u8bb8\u591a\u9897\u7c92\u7684\uff0c\u5927\u6982\u7387\u662f\u4f1a\u6253\u4e2d\u591a\u4e2a\u9897\u7c92\uff0c\u5bfc\u81f4\u591a\u6b21\u6563\u5c04\u7684\uff0c\u56e0\u6b64\u9700\u8981\u4e00\u4e2a\u516c\u5f0f\u6765\u8868\u793a\u591a\u6b21\u6563\u5c04\u7684\u7ed3\u679c<\/p>\n<p><strong>\u80fd\u91cf\u8870\u51cf\u516c\u5f0f\uff1a<span class=\"katex math inline\">I_1 = I_0 \\space exp(-\u03b2(\u03bb,h)x)<\/span><\/strong><\/p>\n<h3>\u5927\u6c14\u900f\u5c04\u7387<\/h3>\n<p>\u4e0a\u5904\u80fd\u91cf\u8870\u51cf\u662f\u5efa\u7acb\u5728\u5747\u5300\u4ecb\u8d28\u7684\u57fa\u7840\u4e0a\u8ba1\u7b97\u7684\uff0c\u4f46\u73b0\u5b9e\u4e2d\u5927\u6c14\u7684\u4ecb\u8d28\u5e76\u975e\u5747\u5300\u7684<\/p>\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5149\u7ebf\u4ecec\u70b9\u8fdb\u5165\u5927\u6c14\uff0c\u6b64\u5904\u80fd\u91cf\u4e3a<span class=\"katex math inline\">I_c<\/span>\uff0c\u4e00\u76f4\u884c\u8fdb\u5230\u70b9P\uff0c\u5728\u9014\u4e2d\u53d1\u751f\u4e86\u591a\u6b21\u6563\u5c04\uff0c\u9700\u8981\u6c42\u70b9P\u7684\u80fd\u91cf<span class=\"katex math inline\">I_p<\/span>\u7684\u503c<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a1d4e4d9c307b7e90a1e86.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a1d4e4d9c307b7e90a1e86.png\" alt=\"\" \/><\/p><\/noscript>\n<ul>\n<li>\u4e3a\u4e86\u89e3\u51b3\u8be5\u95ee\u9898\u9700\u8981\u5f15\u51fa\u5927\u6c14\u900f\u5c04\u7387\u65b9\u7a0b\uff0c\u5b83\u63cf\u8ff0\u4e86<strong>\u5149\u7ebf\u5728\u5927\u6c14\u4e2d\u884c\u8fdb\u4e00\u6bb5\u8ddd\u79bb\u540e\uff0c \u5269\u4f59\u7684\u80fd\u91cf\u767e\u5206\u6bd4<\/strong><\/p>\n<\/li>\n<li>\n<p>\u516c\u5f0f\uff1a<span class=\"katex math inline\">T_{CP} = \\frac{I_P}{I_C}<\/span><\/p>\n<\/li>\n<li>\n<p>\u63a8\u5bfc\u8fc7\u7a0b<\/p>\n<ul>\n<li>\u6839\u636e\u80fd\u91cf\u8870\u51cf\u516c\u5f0f\uff0c\u4e0d\u96be\u5f97\u51fa\uff1a<br \/>\n<span class=\"katex math inline\">I_Q = Ic * exp(-\u03b2(\u03bb,h_0) * Length(CQ))<\/span><\/li>\n<\/ul>\n<p><span class=\"katex math inline\">I_P = I_Q * exp(-\u03b2(\u03bb,h_1) * Length(QP))<\/span><\/p>\n<ul>\n<li>\u90a3\u4e48\uff1a<span class=\"katex math inline\">I_P = [Ic * exp(-\u03b2(\u03bb,h_0) * Length(CQ))] * [exp(-\u03b2(\u03bb,h_1) * Length(QP))]<\/span><\/p>\n<\/li>\n<li>\n<p>\u4f46\u5728\u5b9e\u9645\u8ba1\u7b97\u4e2d\uff0c\u4f1a\u5b58\u5728\u591a\u4e2aCQ\u3001QP\u8fd9\u6837\u7684\u8ddd\u79bb\uff0c\u4e14\u5b83\u4eec\u7684\u8ddd\u79bb\u503c\u90fd\u662f\u56fa\u5b9a\u7684\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u8fdb\u884c\u79ef\u5206\u63a8\u5e7f\uff1a<span class=\"katex math inline\">I_P = I_c * exp(-\u03b2(\u03bb, h_0) - \u03b2(\u03bb, h_1) ds)<\/span><\/p>\n<\/li>\n<\/ul>\n<p>$I_P = I_c exp(- \\sum_{Q\u2208CP} \u03b2(\u03bb, h_Q) ds)$<\/p>\n<p>\u5176\u4e2d\uff0c\u70b9Q\u770b\u4f5cCQ\u4e0a\u8bb8\u8bb8\u591a\u591a\u7528\u4e8e\u79ef\u5206\u7684\u70b9<\/p>\n<ul>\n<li>\u90a3\u4e48<span class=\"katex math inline\">T_{CP} = exp(- \\sum_{Q\u2208CP} \u03b2(\u03bb, h_Q) ds)<\/span><\/li>\n<\/ul>\n<\/li>\n<li>\u4f18\u5316\n<ul>\n<li>\u628a\u6563\u5c04\u7cfb\u6570\u516c\u5f0f\u4ee3\u5165<span class=\"katex math inline\">T_{CP}<\/span>\uff0c\u53ef\u5f97\uff1a<span class=\"katex math inline\">T_{CP} = exp(- \\sum_{Q\u2208CP} \\frac{8\u03a0^3 (n^2 - 1)^2}{3} \\frac{\u03c1(h_Q)}{N} \\frac{1}{\u03bb^4} ds)<\/span><\/p>\n<\/li>\n<li>\n<p>\u79fb\u52a8\u4e00\u4e0b\uff1a<span class=\"katex math inline\">T_{CP} = exp(- \\frac{8\u03a0^3 (n^2 - 1)^2}{3}\\frac{1}{\u03bb^4} \\frac{1}{N} \\sum_{Q\u2208CP} \u03c1(h_Q) ds)<\/span><\/p>\n<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u770b\u5230\u524d\u9762\u7684\u662f\u5e38\u91cf\uff0c\u5c3e\u90e8\u7684<span class=\"katex math inline\">\\sum_{Q\u2208CP} \u03c1(h_Q) ds<\/span>\u5373\u4e3a\u79ef\u5206\u9879\uff0c\u8ba1\u7b97\u65f6\u4f7f\u7528Raymarch\u5373\u53ef<\/p>\n<p>\u4e3a\u4e86\u7b80\u4fbf\uff0c\u8fd9\u91cc\u5c06<span class=\"katex math inline\">\\sum_{Q\u2208CP} \u03c1(h_Q) ds<\/span>\u770b\u4f5c<strong>D(CP)<\/strong>\uff08\u8bd1\u4f5c<strong>OpticalDepth  \u5149\u5b66\u6df1\u5ea6<\/strong>\uff0c\u610f\u4e3a<strong>\u4e00\u6bb5\u8ddd\u79bb\uff0c \u5927\u6c14\u5bc6\u5ea6\u6bd4\u4f8b<span class=\"katex math inline\">\u03c1(h)<\/span>\u7684\u7d2f\u52a0<\/strong>\uff09\uff0c\u53ef\u5f97<span class=\"katex math inline\">T_{CP} = exp(-\u03b2(\u03bb) D(CP))<\/span><\/p>\n<\/li>\n<\/ul>\n<h2>\u7c73\u6c0f\u6563\u5c04<\/h2>\n<p>\u7c73\u6c0f\u6563\u5c04\u65b9\u7a0b\uff1a<span class=\"katex math multi-line\">S(\u03bb, \u03b8, h) = \u03a0^2(n^2 - 1)^2 \\frac{\u03c1(h)}{N} \\frac{1 - g^2}{2 + g^2} \\frac{1 + cos^2\u03b8}{(1 - g^2 - 2gcos\u03b8)^{\\frac{3}{2}}}<\/span><\/p>\n<h3>\u76f8\u4f4d\u51fd\u6570<\/h3>\n<p><span class=\"katex math inline\">\u03b3(\u03b8) = \\frac{1 - g^2}{4\u03a0(1 + g^2 - 2gcos(\u03b8))^{\\frac{3}{2}}}<\/span><\/p>\n<h3>\u5927\u6c14\u5bc6\u5ea6\u51fd\u6570<\/h3>\n<p><span class=\"katex math inline\">\u03c1(h) = exp(-\\frac{h}{H}), H = 1200.0f<\/span><\/p>\n<h2>\u5927\u6c14\u6563\u5c04\u6a21\u578b<\/h2>\n<p>\u4e8b\u5b9e\u4e0a\u5149\u7ebf\u8fdb\u5165\u5927\u6c14\u540e\u5e76\u4e0d\u4f1a\u4ee5\u4e00\u6761\u76f4\u7ebf\u4e00\u76f4\u5411\u524d\u884c\u8fdb\uff0c\u800c\u662f\u78b0\u5230\u9897\u7c92\uff0c\u5411\u591a\u4e2a\u65b9\u5411\u6563\u5c04\u591a\u6761\u5149\u7ebf\uff0c\u6700\u7ec8\u8fdb\u5165\u76f8\u673a<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a20724d9c307b7e93b5508.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a20724d9c307b7e93b5508.png\" alt=\"\" \/><\/p><\/noscript>\n<p>\u8fd9\u5c31\u5b58\u5728\u5355\u6b21\u6563\u5c04\u548c\u591a\u6b21\u6563\u5c04\u7684\u60c5\u51b5<\/p>\n<ul>\n<li>\u5355\u6b21\u6563\u5c04\uff1a\u5149\u7ebf\u8fdb\u5165\u5927\u6c14\u540e\uff0c\u7b2c\u4e00\u6b21\u6253\u4e2d\u9897\u7c92\u5bfc\u81f4\u6563\u5c04\uff0c\u6700\u7ec8\u8fdb\u5165\u76f8\u673a<\/li>\n<li>\u591a\u6b21\u6563\u5c04\uff1a\u5149\u7ebf\u8fdb\u5165\u5927\u6c14\u540e\uff0c\u4e24\u6b21\u53ca\u4ee5\u4e0a\u6253\u4e2d\u9897\u7c92\u5bfc\u81f4\u6563\u5c04\uff0c\u6700\u7ec8\u8fdb\u5165\u76f8\u673a<\/li>\n<\/ul>\n<p>\u56e0\u4e3a\u591a\u6b21\u6563\u5c04\u975e\u5e38\u590d\u6742\uff0c\u5bf9\u4e8e\u5b9e\u73b0\u6e32\u67d3\u6765\u8bf4\u662f\u4e0d\u53ef\u80fd\u7684\uff0c\u4e14\u5355\u6b21\u6563\u5c04\u7684\u6e32\u67d3\u6548\u679c\u5df2\u7ecf\u4e0d\u9519\u4e86\uff0c\u6240\u4ee5\u8fd9\u91cc\u53ea\u4ecb\u7ecd\u5355\u6b21\u6563\u5c04\u65b9\u7a0b\u7684\u63a8\u5bfc<\/p>\n<h3>\u5355\u6b21\u6563\u5c04\u65b9\u7a0b<\/h3>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a20998d9c307b7e93d648d.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a20998d9c307b7e93d648d.png\" alt=\"\" \/><\/p><\/noscript>\n<p>\u6839\u636e\u5148\u524d\u63d0\u5230\u7684\u6563\u5c04\u65b9\u7a0b\uff0c\u4e0d\u96be\u63a8\u51fa\uff1a<\/p>\n<p><span class=\"katex math inline\">I_{PA} = I_P S(\u03bb, \u03b8, h) T(PA)<\/span><\/p>\n<p><span class=\"katex math inline\">I_{PA} = I_C \\space T(CP) \\space S(\u03bb, \u03b8, h) \\space T(PA)<\/span><\/p>\n<p><span class=\"katex math inline\">I_{PA} = I_C \\space S(\u03bb, \u03b8, h) \\space T(CP) \\space T(PA)<\/span><\/p>\n<p>\u4f46AB\u4e0a\u4e0d\u6b62\u5b58\u5728\u4e00\u4e2a\u70b9P\u4f7f\u5149\u7ebf\u53d1\u751f\u6563\u5c04\uff0c\u6781\u6709\u53ef\u80fd\u6709\u591a\u4e2a\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u79ef\u5206\u4e86\uff1a<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a20ab5d9c307b7e93e541b.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a20ab5d9c307b7e93e541b.png\" alt=\"\" \/><\/p><\/noscript>\n<p><span class=\"katex math inline\">I_A = I_{PA} \\sum_{P\u2208AB} ds<\/span><\/p>\n<p>\u6700\u7ec8\u5f97\u5230\u5355\u6b21\u6563\u5c04\u6a21\u578b\u7684\u6e32\u67d3\u65b9\u7a0b\uff1a<span class=\"katex math inline\">I_A = I_C \\space S(\u03bb, \u03b8, h) \\space T(CP) \\space T(PA) \\sum_{P\u2208AB} ds<\/span><\/p>\n<h2>\u4f18\u5316<\/h2>\n<h3>\u6563\u5c04\u65b9\u7a0b<\/h3>\n<p><span class=\"katex math inline\">S(\u03bb,\u03b8,h) = \u03b2(\u03bb,h) \u03b3(\u03b8) = \u03b2(\u03bb) \u03c1(h) \u03b3(\u03b8)<\/span><\/p>\n<p>\u56e0\u4e3a<span class=\"katex math inline\">\u03b2(\u03bb)<\/span>\u8868\u793a\u6563\u5c04\u7cfb\u6570\uff0c\u4e0e\u6d77\u62d4\u9ad8\u5ea6\u65e0\u5173\uff0c\u662f\u4e2a\u5e38\u91cf\uff0c\u4e14<span class=\"katex math inline\">\u03b3(\u03b8)<\/span>\u8868\u793a\u76f8\u4f4d\u51fd\u6570\uff0c\u662f\u4e2a\u5e38\u91cf\u3002\u6240\u4ee5\u53ef\u4ee5\u5c06<span class=\"katex math inline\">\u03b2(\u03bb) \u03b3(\u03b8)<\/span>\u8fd9\u4e24\u8d27\u4ece\u6563\u5c04\u65b9\u7a0b\u4e2d\u63d0\u51fa\u6765\uff0c\u53ef\u5f97\uff1a<span class=\"katex math inline\">I_A = I_C \\space \u03b2(\u03bb) \u03b3(\u03b8) \\space T(CP) \\space T(PA) \\sum_{P\u2208AB} \u03c1(h) ds<\/span><\/p>\n<h3>\u5927\u6c14\u900f\u5c04\u7387<\/h3>\n<p>\u63a5\u4e0b\u6765\u4f18\u5316<span class=\"katex math inline\">T(CP) T(PA)<\/span><\/p>\n<p>\u56e0\u4e3a\u5927\u6c14\u6563\u5c04\u7387\u516c\u5f0f\u4e3a<span class=\"katex math inline\">T_{CP} = exp(-\u03b2(\u03bb) D(CP))<\/span><\/p>\n<p>\u90a3\u4e48\u53ef\u62c6\u5206\u4e3a\uff1a<\/p>\n<p><span class=\"katex math inline\">exp(-\u03b2(\u03bb) D(CP)) \\space exp(-\u03b2(\u03bb) D(PA))<\/span><\/p>\n<p><span class=\"katex math inline\">exp(-\u03b2(\u03bb) (D(CP) + D(PA)))<\/span><\/p>\n<p>\u5176\u4e2dOpticalDepth <span class=\"katex math inline\">D(CP)=\\sum_{Q\u2208CP} \u03c1(h_Q) ds = \\sum_{Q\u2208CP} exp(-\\frac{h_Q}{H}) ds<\/span><\/p>\n<h3>\u79ef\u5206<\/h3>\n<p>\u76ee\u524d\u5f97\u5230\u7684\u6e32\u67d3\u65b9\u7a0b\u5982\u4e0b<\/p>\n<p><span class=\"katex math inline\">I_A = I_C \\space \u03b2(\u03bb) \u03b3(\u03b8) \\space T(CP) \\space T(PA) \\sum_{P\u2208AB} \u03c1(h) ds<\/span><\/p>\n<p><span class=\"katex math inline\">T(CP) T(PA) = exp(-\u03b2(\u03bb) (D(CP) + D(PA)))<\/span>\uff0c\u5176\u4e2d\u5149\u5b66\u6df1\u5ea6<span class=\"katex math inline\">D(CP) = \\sum_{Q\u2208CP} exp(-\\frac{h_Q}{H}) ds<\/span><\/p>\n<p>\u6839\u636e\u8fd9\u4e2a\u65b9\u7a0b\u53ef\u4ee5\u5c06\u5176\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u4e00\u90e8\u5206\u662f\u5e38\u91cf\uff0c\u7531CPU\u7aef\u63d0\u524d\u4f20\u5165\uff1b\u53e6\u4e00\u90e8\u5206\u662f\u9700\u8981\u5b9e\u65f6\u8ba1\u7b97\u7684<\/p>\n<p>\u771f\u6b63\u9700\u8981\u4f18\u5316\u7684\u662f\u9700\u8981\u5b9e\u65f6\u8ba1\u7b97\u7684\u90e8\u5206\uff0c\u76ee\u524d\u5b58\u5728\u4e09\u4e2a\u79ef\u5206\u9879<\/p>\n<ul>\n<li>\u7b2c\u4e00\u4e2a\u79ef\u5206\uff1aAB\u4e0a\u5b58\u5728\u8bb8\u591a\u9897\u7c92\u4ea7\u751f\u6563\u5c04<\/li>\n<li>\u7b2c\u4e8c\u4e2a\u79ef\u5206\uff1a\u5927\u6c14\u900f\u5c04\u7387\uff0cOpticalDepth CP<\/li>\n<li>\u7b2c\u4e09\u4e2a\u79ef\u5206\uff1a\u5927\u6c14\u900f\u5c04\u7387\uff0cOpticalDepth PA<\/li>\n<\/ul>\n<p>\u8bf4\u4eba\u8bdd\u5c31\u662f\u53d6AB\u4e0a\u7684\u4e00\u4e2a\u9897\u7c92\u70b9P\uff0c\u8ba1\u7b97CP\u7684\u5927\u6c14\u900f\u5c04\u7387\u8fdb\u5e76\u7d2f\u52a0\uff0c\u518d\u8ba1\u7b97PA\u7684\u5927\u6c14\u900f\u5c04\u7387\u5e76\u7d2f\u52a0\uff0c\u5e76\u8ba1\u7b97AB\u4e0a\u5176\u4ed6\u6240\u6709\u7684\u9897\u7c92<\/p>\n<p>\u8fd9\u91cc\u8fd8\u9614\u4ee5\u8fdb\u4e00\u6b65\u4f18\u5316\u4e3a\u4e24\u4e2a\u79ef\u5206\uff0c\u4e5f\u5c31\u662f\u4f18\u5316<span class=\"katex math inline\">D(PA)<\/span>\uff0c\u56e0\u4e3a\u70b9P\u662f\u5728AB\u4e0a\u7684\uff0c\u90a3\u4e48\u4e0a\u4e00\u6b21\u79ef\u5206\u5f97\u5230\u7684<span class=\"katex math inline\">D(P_{i-1}A)<\/span>\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u4e8e\u4e0b\u6b21\u79ef\u5206<span class=\"katex math inline\">D(P_iA)<\/span><\/p>\n<h1>\u5b9e\u73b0<\/h1>\n<h2>\u601d\u8def<\/h2>\n<p>\u4e3b\u8981\u601d\u8def\uff1a\u76f8\u673a\u770b\u5411\u5929\u7a7a\uff0c\u82e5\u5c04\u7ebf\u88ab\u7269\u4f53\u906e\u6321\uff0c\u5219\u8fd4\u56de0\uff1b\u82e5\u672a\u88ab\u6321\u5230\uff0c\u5219\u8fd4\u56de<strong>\u5355\u6b21\u5927\u6c14\u6563\u5c04\u7684\u503c<\/strong><\/p>\n<p>\u540e\u7eed\u5b9e\u73b0\u4e3b\u8981\u56f4\u7ed5\u6e32\u67d3\u65b9\u7a0b\u5c55\u5f00\uff0c\u5177\u4f53\u5f62\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p><span class=\"katex math inline\">I_A = I_C \\space \u03b2(\u03bb) \u03b3(\u03b8) \\space T(CP) \\space T(PA) \\sum_{P\u2208AB} \u03c1(h) ds<\/span><\/p>\n<p><span class=\"katex math inline\">T(CP) T(PA) = exp(-\u03b2(\u03bb) (D(CP) + D(PA)))<\/span>\uff0c\u5176\u4e2d\u5149\u5b66\u6df1\u5ea6<span class=\"katex math inline\">D(CP) = \\sum_{Q\u2208CP} exp(-\\frac{h_Q}{H}) ds<\/span><\/p>\n<p>\u8fd9\u91cc\u4e3a\u4e86\u65b9\u4fbf\u4f7f\u7528URP\u7684Render Feature\u5b9e\u73b0\uff0c\u9700\u8981\u6ce8\u610f\u5927\u6c14\u6563\u5c04\u7684pass\u5728\u6e32\u67d3\u7ba1\u7ebf\u4e2d\u7684\u4f4d\u7f6e\u662f\u4f4d\u4e8e<strong>\u534a\u900f\u660e\u4e4b\u524d<\/strong>\u7684<\/p>\n<h2>\u91cd\u6784\u4e16\u754c\u5750\u6807<\/h2>\n<p>\u8fd9\u4e2a\u65e0\u9700\u591a\u814c\uff0c\u5f88\u7b80\u5355<\/p>\n<pre><code class=\"line-numbers\">\/\/ positionVP : uv\n\/\/ depth      : deviceDepth\nfloat3 ReBuildPosWS(float2 positionVP, float depth)\n{\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    \/\/ \u53d8\u6362\u5230 NDC space\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    float3 positionNDC = float3(positionVP * 2.f - 1.f, depth);\n    #if defined (UNITY_UV_STARTS_AT_TOP)\n    positionNDC.y = - positionNDC.y;\n    #endif\n\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    \/\/ \u53d8\u6362\u5230 world space\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    float4 positionWS = mul(UNITY_MATRIX_I_VP, float4(positionNDC, 1.f));\n    positionWS.xyz \/= positionWS.w;\n\n    return positionWS;\n}\n<\/code><\/pre>\n<p>\u5728render feature\u4e2d\u7684RenderPassEvent\u8bbe\u4e3a<strong>RenderPassEvent.BeforeRenderingTransparents<\/strong><\/p>\n<p>Debug\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u7ed3\u679c\uff1a<img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a39f90d9c307b7e9a80141.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a39f90d9c307b7e9a80141.png\" alt=\"\" \/><\/p><\/noscript>\n<h2>\u786e\u5b9a\u5750\u6807\u7cfb<\/h2>\n<p>\u4e3a\u4e86\u914d\u5408\u5176\u4ed6\u6e32\u67d3\u6548\u679c\uff0c\u5982\u96fe\u6548\uff0c\u9700\u8981\u786e\u5b9a\u4e00\u4e2a\u9002\u5408\u7684\u5750\u6807\u7cfb\uff0c\u907f\u514d\u989d\u5916\u7684\u8ba1\u7b97<\/p>\n<p>\u56e0\u4e3a\u5927\u6c14\u5c42\u662f\u5305\u56f4\u5730\u7403\u7684\uff0c\u6240\u4ee5\u5c06\u5730\u7403\u9876\u90e8\u4f5c\u4e3a\u539f\u70b9\u2014\u2014<strong>\u4f7f\u7528unity\u7684\u4e16\u754c\u5750\u6807<\/strong>\u5373\u53ef<\/p>\n<h2>\u5c04\u7ebf\u548c\u5927\u6c14\u5c42\u6c42\u4ea4<\/h2>\n<p>\u5047\u8bbe\u76f8\u673a\u5728A\u70b9\uff0c\u5b83\u53d1\u51fa\u7684\u5c04\u7ebf\u4e0e\u5927\u6c14\u5c42\u7684\u4ea4\u70b9\u4e3aC\u70b9\u3002\u5df2\u77e5A\u70b9\uff0c\u9700\u8981\u6c42\u4ea4\u70b9C\uff0c\u4f7f\u7528\u4e00\u5143\u4e8c\u6b21\u65b9\u7a0b\u5373\u53ef<\/p>\n<pre><code class=\"line-numbers\">\/\/\/ ------------------ In\n\/\/ rayOrigin    : \u76f8\u673a\u4f4d\u7f6e\n\/\/ rayDir       : \u76f8\u673a\u671d\u5411\n\/\/ sphereCenter : \u7403\u4f53\u4e2d\u5fc3\u70b9\n\/\/ sphereRadius : \u7403\u4f53\u534a\u5f84\n\n\/\/\/ ------------------ Out\n\/\/ return       : rayLength\nfloat2 RaySphereIntersection(float3 rayOrigin, float3 rayDir, float3 sphereCenter, float3 sphereRadius)\n{\n    float3 oc = rayOrigin - sphereCenter;\n\n    float a = dot(rayDir, rayDir);\n    float b = 2.f * dot(rayOrigin, oc);\n    float c = dot(oc, oc) - Pow2(sphereRadius);\n    float delta = Pow2(b) - 4 * a * c;\n\n    if(delta &lt; 0.f)\n    {\n        return -1.f;\n    }\n    else\n    {\n        return float2(-b - sqrt(delta), -b + sqrt(delta)) * rcp(2 * a);\n    }\n}\n<\/code><\/pre>\n<h2>\u6c42\u89e3<span class=\"katex math inline\">T(CP) T(PA) \\sum_{P\u2208AB} \u03c1(h) ds<\/span><\/h2>\n<p>\u63a5\u4e0b\u6765\u4e00\u6b65\u4e00\u6b65\u5730\u6c42\u89e3\u5927\u6c14\u6e32\u67d3\u65b9\u7a0b\uff1a<span class=\"katex math inline\">I_A = I_C \\space \u03b2(\u03bb) \u03b3(\u03b8) \\space T(CP) \\space T(PA) \\sum_{P\u2208AB} \u03c1(h) ds<\/span><\/p>\n<p>\u9996\u5148\u6765\u89e3<span class=\"katex math inline\">T(CP) T(PA) = exp(-\u03b2(\u03bb) (D(CP) + D(PA)))<\/span>\u4e2d\u7684<span class=\"katex math inline\">D(CP) + D(PA)<\/span><\/p>\n<p>\u56e0\u4e3a<span class=\"katex math inline\">D(CP) = \\sum_{Q\u2208CP} exp(-\\frac{h_Q}{H}) ds<\/span>\uff0c\u4e3b\u8981\u662f\u6c42\u89e3<span class=\"katex math inline\">h_Q<\/span><\/p>\n<pre><code class=\"line-numbers\">\/\/\/ ------------------ In\n\/\/  currPos     :   \u91c7\u6837\u70b9P\n\/\/  lightDir    :   \u5149\u6e90\u65b9\u5411\n\n\/\/\/ ------------------ Out\n\/\/  opticalDepthCP  : CP\u7684\u5149\u5b66\u6df1\u5ea6\nvoid LightSampling(float3 currPos, float3 lightDir, float3 planetCenter,\n    inout float2 opticalDepthCP)\n{\n    float3 rayOrigin = currPos;\n    float3 rayDir    = -lightDir;\n\n    float2 intersection = RaySphereIntersection(rayOrigin, rayDir, planetCenter, _PlanetRadius + _SkyAtmosphereHeight);\n    float3 rayEnd = rayOrigin + rayDir * intersection.y;\n\n    float3 step = (rayEnd - rayOrigin) \/ _SampleCounts;\n    float stepLength = length(step);\n    float2 density = 0;\n\n    for(float s = 0.5; s &lt; _SampleCounts; ++s)\n    {\n        float3 pos   = rayOrigin + step * s;\n        float height = abs(length(pos - planetCenter) - _PlanetRadius);\n        float2 currDensity = exp(-(height.xx \/ float2(_SeaLevelHeight_R, _SeaLevelHeight_M)));  \/\/ \u745e\u4e3d\u548c\u7c73\u6c0f\u90fd\u5b9e\u73b0\n\n        density += currDensity * stepLength;\n    }\n\n    opticalDepthCP = density;\n}\n<\/code><\/pre>\n<p>\u7136\u540e\u518d\u6c42DCP + DPA<\/p>\n<pre><code class=\"line-numbers\">\/\/\/ ------------------ In\n\/\/  currPos     :   \u91c7\u6837\u70b9P\n\/\/  lightDir    :   \u5149\u6e90\u65b9\u5411\n\n\/\/\/ ------------------ Out\n\/\/  opticalDepth CP &amp; opticalDepth PA\nvoid GetAtmosphereOpticalDepth(float3 currPos, float3 lightDir, float3 planetCenter,\n    inout float2 dpa, inout float2 dpc)\n{\n    float height = length(currPos - planetCenter) - _PlanetRadius;\n    dpa = exp(- height.xx \/ float2(_SeaLevelHeight_R, _SeaLevelHeight_M));\n\n    LightSampling(currPos, lightDir, planetCenter, dpc);\n}\n<\/code><\/pre>\n<p>\u56e0\u4e3a\u6c42\u89e3DPA\u65f6\u53ef\u4ee5\u505a\u4f18\u5316\uff0c\u7d2f\u52a0\u4e4b\u524d\u7684DPA\uff08<span class=\"katex math inline\">DPA_{i-1}<\/span>\uff09\uff0c\u6240\u4ee5\u6bcf\u6b21\u53ea\u9700\u8ba1\u7b97\u5f53\u524d\u7684DPA<\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u53ef\u4ee5\u89e3<span class=\"katex math inline\">T(CP) \\space T(PA) \\sum_{P\u2208AB} \u03c1(h) ds<\/span>\u8fd9\u4e2a\u65b9\u7a0b\u4e86<\/p>\n<pre><code class=\"line-numbers\">\/\/\/ ------------------ In\n\/\/  localDensity :    rho(h)\n\n\/\/\/ ------------------ Out\n\/\/  localInscatter_R : \u745e\u5229\u6563\u5c04\u76f8\u5173\n\/\/  localInscatter_M : \u7c73\u6c0f\u6563\u5c04\u76f8\u5173\nvoid CalcLocalInscatter(float2 localDensity, float2 D_PA, float2 D_CP,\n    inout float3 localInscatter_R, inout float3 localInscatter_M)\n{\n    float2 D_CPA = D_PA + D_CP;\n\n    \/\/ _Extinction_R:\u745e\u4e3d\u6563\u5c04\u7cfb\u6570\n    \/\/ _Extinction_M:\u7c73\u6c0f\u6563\u5c04\u7cfb\u6570\n    float3 T_R = D_CPA.x * _Extinction_R;\n    float3 T_M = D_CPA.y * _Extinction_M;\n\n    float3 extinction = exp(-(T_M + T_R));\n\n    localInscatter_R = localDensity.x * extinction;\n    localInscatter_M = localDensity.y * extinction;\n}\n<\/code><\/pre>\n<p>\u6700\u540e\u53ea\u9700\u6c42\u89e3\u524d\u4e09\u4e2a\u7cfb\u6570<span class=\"katex math inline\">I_C \\space \u03b2(\u03bb) \u03b3(\u03b8)<\/span><\/p>\n<p><span class=\"katex math inline\">I_C<\/span>\u5373\u5149\u6e90\u80fd\u91cf\uff0c\u800c<span class=\"katex math inline\">\u03b2(\u03bb)<\/span>\u662f\u6563\u5c04\u7cfb\u6570\uff0c\u4e00\u4e2a\u5e38\u91cf\u3002\u56e0\u6b64\u53ea\u9700\u6c42\u89e3\u76f8\u4f4d\u51fd\u6570<span class=\"katex math inline\">\u03b3(\u03b8)<\/span><\/p>\n<pre><code class=\"line-numbers\">\/\/\/ ------------------ In\n\/\/  cosAngle : \u6563\u5c04\u89d2\n\n\/\/\/ ------------------ Out\n\/\/  scatter_R : \u4e58\u4e0a\u745e\u4e3d\u76f8\u4f4d\u51fd\u6570\n\/\/  scatter_M : \u4e58\u4e0a\u7c73\u6c0f\u76f8\u4f4d\u51fd\u6570\nvoid GetPhaseFun(float cosAngle,\n    inout float3 scatter_R, inout float3 scatter_M)\n{\n    float phase = 3.f * rcp(16.f * PI) * (1.f + Pow2(cosAngle));\n    scatter_R  *= phase;\n\n    float g   = _MieG;\n    float g2  = Pow2(g);\n    phase     = rcp(4.f * PI) * 3.f * (1.f - g2) * rcp(2.f * (2.f + g2)) * (1.f + Pow2(cosAngle)) * rcp(pow(1.f + g2 - 2 * g * cosAngle, 1.5f));\n    scatter_M *= phase;\n}\n<\/code><\/pre>\n<p>\u6700\u540e\u6574\u5408\u8fd9\u4e9b\u51fd\u6570<\/p>\n<pre><code class=\"line-numbers\">\/\/\/ ------------------ In\n\/\/  rayOrigin     : \u76f8\u673a\u4f4d\u7f6e\n\/\/  rayDir        : \u76f8\u673a\u671d\u5411\n\/\/  rayLength     : AB\u957f\u5ea6\n\/\/  planetCenter  : \u5730\u7403\u4e2d\u5fc3\u4f4d\u7f6e\n\/\/  lightDir      : \u5149\u6e90\u65b9\u5411\n\/\/  sampleCounts  : AB\u91c7\u6837\u6b21\u6570\n\/\/  distanceScale : \u4e16\u754c\u5750\u6807\u5c3a\u5bf8\n\n\/\/\/ ------------------ Out\n\/\/  intensity   :   \u6563\u5c04\u540e\u7684\u80fd\u91cf\n\/\/  extinction  :   \u900f\u5c04\u7387\nvoid CalcSkyAtmosphereIntensity(float3 rayOrigin, float3 rayDir, float rayLength, float3 planetCenter, float3 lightDir, float sampleCounts, float distanceScale,\n    inout float4 intensity, inout float4 extinction)\n{\n    float3 step = rayDir * (rayLength \/ sampleCounts);\n    float stepLength = length(step) * distanceScale;\n\n    float2 D_PA = 0;\n    float3 scatter_R = 0;\n    float3 scatter_M = 0;\n\n    float2 localDensity = 0;\n    float2 D_CP = 0;\n\n    \/\/ \u5b58\u50a8\u4e0a\u4e00\u4e2aDPA\n    float2 preLocalDensity = 0;\n    float3 preLocalInscatter_R, preLocalInscatter_M = 0;\n\n    GetAtmosphereOpticalDepth(rayOrigin, lightDir, planetCenter, preLocalDensity, D_CP);\n    CalcLocalInscatter(preLocalDensity, D_PA, D_CP, preLocalInscatter_R, preLocalInscatter_M);\n\n    [loop]\n    for(float i = 1; i &lt; sampleCounts; ++i)\n    {\n        float3 currPos = rayOrigin + i * step;\n\n        GetAtmosphereOpticalDepth(currPos, lightDir, planetCenter, localDensity, D_CP);\n        D_PA += (localDensity + preLocalDensity) * (stepLength \/ 2.f);\n        float3 localInscatter_R, localInscatter_M = 0;\n        CalcLocalInscatter(localDensity, D_PA, D_CP, localInscatter_R, localInscatter_M);\n\n        scatter_R += (localInscatter_R + preLocalInscatter_R) * (stepLength \/ 2.f);\n        scatter_M += (localInscatter_M + preLocalInscatter_M) * (stepLength \/ 2.f);\n\n        preLocalInscatter_R = localInscatter_R;\n        preLocalInscatter_M = localInscatter_M;\n\n        preLocalDensity = localDensity;\n    }\n\n    GetPhaseFun(dot(rayDir, -lightDir), scatter_R, scatter_M);\n\n    intensity  = float4((scatter_R * _Scattering_R + scatter_M * _Scattering_M) * _LightColor, 1.f);\n    extinction = exp(-(D_CP.x * _Extinction_R + D_CP.y * _Extinction_M));\n    extinction.w = 0.f;\n}\n<\/code><\/pre>\n<h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<p>\u4e3a\u4e86\u4f7f\u5f97\u5927\u6c14\u6563\u5c04\u4e0d\u51fa\u9519\uff0c\u9700\u8981\u4fdd\u8bc1\u5f53\u7269\u4f53\u906e\u6321skybox\uff0c\u8be5\u5904\u91c7\u6837\u503c\u8fd4\u56de0\uff0c\u6ca1\u6709\u88ab\u906e\u6321\u5219\u8ba1\u7b97\u5927\u6c14\u6563\u5c04\u503c<\/p>\n<pre><code class=\"line-numbers\">PSOutput SkyAtmosphere_PS(PSInput i)\n{\n    PSOutput o = (PSOutput)0;\n\n    \/\/ \u91cd\u5efa\u4e16\u754c\u5750\u6807\n    float2 uv    = (i.positionCS.xy - 0.5f) * _RTSize.zw;\n    float deviceDepth  = _CameraDepthTexture.SampleLevel(sampler_LinearClamp, uv, 0).r;\n    float3 posWS = ReBuildPosWS(uv, deviceDepth);\n\n    \/\/ \u76f8\u673a\u76f8\u5173\n    \/\/ A\u70b9\u5373\u4e3a\u76f8\u673a\u8d77\u70b9\n    float3 rayOrigin = GetCameraPositionWS();\n    float3 rayDir    = posWS - rayOrigin;\n    float  rayLength = length(rayDir);\n    rayDir          \/= rayLength;\n    float3 planetCenter = float3(0, -_PlanetRadius, 0);\n\n    \/\/ \u88ab\u906e\u6321\u8fd4\u56de\u9ed1\u8272\n    if(deviceDepth &gt; 0.000001f)\n    {\n        rayLength = 1e20;\n    }\n\n    float2 intersection = RaySphereIntersection(rayOrigin, rayDir, planetCenter, _PlanetRadius + _SkyAtmosphereHeight);\n    rayLength = min(rayLength, intersection.y);\n\n    float4 skyAtmosphereExtinction = 0;\n    float4 skyAtmosphereIntensity = 0;  \n    if(deviceDepth &lt; 0.000001f)\n    {\n        CalcSkyAtmosphereIntensity(rayOrigin, rayDir, rayLength, planetCenter, _MainLightDir, _SampleCounts, _DistanceScale, skyAtmosphereIntensity, skyAtmosphereExtinction);\n    }\n\n    o.color = skyAtmosphereIntensity + _Source_RT.SampleLevel(sampler_LinearClamp, uv, 0);\n\n    return o;\n}\n<\/code><\/pre>\n<h2>\u6548\u679c<\/h2>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a60ea4d9c307b7e9a9c851.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a60ea4d9c307b7e9a9c851.png\" alt=\"\" \/><\/p><\/noscript>\n<h1>\u4f18\u5316<\/h1>\n<p>\u5176\u5b9e\u6bcf\u6b21\u6c42DPA\u65f6\uff0c\u90fd\u4f1a\u91c7\u6837\u5f88\u591a\u6bb5CP\uff0c\u5f00\u9500\u633a\u5927\u7684\uff0c\u7b14\u8005\u6d4b\u8bd5\u4e86\u4e0b\uff0c\u6027\u80fd\u8017\u65f6\u5f97\u67090.8ms\u3002\u82e5\u4e0d\u662f\u57fa\u4e8e\u7269\u7406\u7684\u5927\u6c14\u6563\u5c04\uff0c\u53ef\u4ee5\u628a\u5bf9CP\u7684\u79ef\u5206\u780d\u6389\uff0c\u53ea\u8ba1\u7b97DPA<\/p>\n<pre><code class=\"line-numbers\">void GetAtmosphereOpticalDepth(float3 currPos, float3 lightDir, float3 planetCenter,\n    inout float2 dpa, inout float2 dpc)\n{\n    float height = length(currPos - planetCenter) - _PlanetRadius;\n    dpa = exp(- height.xx \/ float2(_SeaLevelHeight_R, _SeaLevelHeight_M));\n\n    \/\/LightSampling(currPos, lightDir, planetCenter, dpc);\n}\n<\/code><\/pre>\n<p>\u8fd9\u6837\u6027\u80fd\u8017\u65f6\u4ec5\u67090.1ms\uff0c\u4e5f\u53ef\u4ee5\u5f97\u5230\u4e0d\u9519\u7684\u6548\u679c<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/pic.imgdb.cn\/item\/66a7159ad9c307b7e9c1d08e.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\" \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/pic.imgdb.cn\/item\/66a7159ad9c307b7e9c1d08e.png\" alt=\"\" \/><\/p><\/noscript>\n<h1>\u4ee3\u7801\u4ed3\u5e93<\/h1>\n<p>https:\/\/github.com\/chenglixue\/unity-SkyAtmosphere\/tree\/main<\/p>\n<h1>Reference<\/h1>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.alanzucconi.com\/2017\/10\/10\/atmospheric-scattering-1\/\" target=\"_blank\"  rel=\"nofollow\" >Volumetric Atmospheric Scattering<\/a><\/p>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/zhuanlan.zhihu.com\/p\/237502022\" target=\"_blank\"  rel=\"nofollow\" >\u4ece\u96f6\u5b9e\u73b0\u4e00\u5957\u5b8c\u6574\u5355\u6b21\u5927\u6c14\u6563\u5c04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662f\u5927\u6c14\u6563\u5c04 \u5927\u6c14\u6563\u5c04\u6a21\u62df\u592a\u9633\u5149\u5728\u5927\u6c14\u5c42\u7a7f\u884c\u65f6\u53d1\u751f\u7684\u4e00\u7cfb\u5217\u590d\u6742\u7684\u5149\u5b66\u73b0\u8c61\uff0c\u8fdb\u800c\u6a21\u62df\u51fa\u5927\u81ea\u7136\u4e2d\u4ee4\u4eba\u60ca\u8273\u7684\u89c6\u89c9\u6548\u679c\u3002UE\u63d0\u4f9b\u4e86\u4e00\u4e2a\u73b0 &#8230;<\/p>","protected":false},"author":1,"featured_media":183,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/posts\/202"}],"collection":[{"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/chenglixue.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202"}],"version-history":[{"count":4,"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":206,"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions\/206"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/chenglixue.top\/index.php?rest_route=\/wp\/v2\/media\/183"}],"wp:attachment":[{"href":"http:\/\/chenglixue.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/chenglixue.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/chenglixue.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}