{"id":4828,"date":"2022-03-14T22:52:00","date_gmt":"2022-03-14T14:52:00","guid":{"rendered":"https:\/\/www.yumefx.com\/?p=4828"},"modified":"2022-03-04T15:19:59","modified_gmt":"2022-03-04T07:19:59","slug":"%e8%92%99%e7%89%b9%e5%8d%a1%e6%b4%9b%e8%b7%af%e5%be%84%e8%bf%bd%e8%b8%aa%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/www.yumefx.com\/?p=4828","title":{"rendered":"\u8499\u7279\u5361\u6d1b\u8def\u5f84\u8ffd\u8e2a\u57fa\u7840"},"content":{"rendered":"\n<h1 style=\"text-align: center;\">\u524d\u8a00<\/h1>\n<p><a href=\"https:\/\/www.yumefx.com\/?p=4740&amp;preview=true\">\u524d\u6587<\/a>\u4ecb\u7ecd\u4e86\u57fa\u4e8e\u7269\u7406\u6e32\u67d3\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u5305\u62ec\u8f90\u5c04\u5ea6\u91cf\u5b66\u3001BRDF\u4ee5\u53ca\u6e32\u67d3\u65b9\u7a0b\uff0c\u4f46\u5e76\u6ca1\u6709\u7ed9\u51fa\u89e3\u6e32\u67d3\u65b9\u7a0b\u7684\u65b9\u6cd5\uff0c\u6216\u8005\u8bf4\u5982\u4f55\u901a\u8fc7\u8be5\u6e32\u67d3\u65b9\u7a0b\u8ba1\u7b97\u51fa\u5c4f\u5e55\u4e0a\u6bcf\u4e00\u4e2a\u5750\u6807\u7684\u50cf\u7d20\u503c\u3002<\/p>\n<p>\u672c\u6587\u5c31\u4ecb\u7ecd\u901a\u8fc7\u8499\u7279\u5361\u6d1b\u8def\u5f84\u8ffd\u8e2a\u6765\u89e3\u6e32\u67d3\u65b9\u7a0b\u7684\u65b9\u6cd5\u3002<\/p>\n<h1>&nbsp;<\/h1>\n<h1 style=\"text-align: center;\">\u8499\u7279\u5361\u6d1b\u79ef\u5206<b>(Monte Carlo Integration)<\/b><\/h1>\n<p>\u9996\u5148\u770b\u4e0b\u9762\u7684\u56fe\uff0c\u5982\u4f55\u53bb\u6c42\u66f2\u7ebf\u5728a\u3001b\u4e4b\u95f4\u56f4\u6210\u7684\u9762\u79ef\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4829 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_01.jpg\" alt=\"\" width=\"1134\" height=\"617\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_01.jpg 1134w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_01-300x163.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_01-1024x557.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_01-768x418.jpg 768w\" sizes=\"(max-width: 1134px) 100vw, 1134px\" \/><\/p>\n<p data-pid=\"e7z0xCjz\">\u6c42\u66f2\u7ebf\u5728a\u3001b\u533a\u57df\u5185\u9762\u79ef\u4e5f\u5c31\u662f\u6c42\u66f2\u7ebf\u7684\u51fd\u6570\u5728[a, b]\u5185\u7684<strong>\u5b9a\u79ef\u5206<\/strong>\uff0c\u4f46\u5bf9\u4e8e\u8fd9\u6837\u4e00\u4e2a\u66f2\u7ebf\uff0c\u5f88\u96be\u7528\u4e00\u4e2a\u6570\u5b66\u51fd\u6570\u53bb\u8868\u793a\uff0c\u56e0\u6b64\u65e0\u6cd5\u7528\u4e00\u822c\u89e3\u6790\u7684\u65b9\u6cd5\u76f4\u63a5\u6c42\u5f97\u79ef\u5206\u503c\uff0c\u53ef\u4ee5\u91c7\u7528\u9ece\u66fc\u79ef\u5206\u7684\u601d\u8def\u3002<\/p>\n<p data-pid=\"e7z0xCjz\">\u4e5f\u5c31\u662f\u5bf9\u4e0a\u56fe\u8fd9\u4e2a\u56fe\u5f62\u7eb5\u5411\u5747\u5300\u5730\u5207\u5272\uff0c\u5206\u6210\u591a\u4e2a\u5bbd\u5ea6\u76f8\u540c\u7684\u6761\u5f62\uff0c\u90a3\u4e48\u8fd9\u4e9b\u6761\u5f62\u5c31\u53ef\u4ee5\u8fd1\u4f3c\u4e3a\u957f\u65b9\u5f62\uff0c\u53d6\u6761\u5f62\u4e2d\u7ebf\u7684\u9ad8\u5ea6\u4f5c\u4e3a\u8fd1\u4f3c\u957f\u65b9\u5f62\u7684\u9ad8\u5ea6\uff0c\u5c06\u8fd9\u4e9b\u8fd1\u4f3c\u5c0f\u957f\u65b9\u5f62\u7684\u9762\u79ef\u5168\u90e8\u52a0\u8d77\u6765\u5c31\u80fd\u5f97\u5230\u6574\u4e2a\u56fe\u5f62\u8fd1\u4f3c\u7684\u9762\u79ef\u3002<\/p>\n<p data-pid=\"e7z0xCjz\">\u663e\u7136\u5207\u5272\u7684\u6570\u91cf\u8d8a\u591a\u4e5f\u5c31\u662f\u91c7\u6837\u8d8a\u591a\uff0c\u5f97\u5230\u7684\u7ed3\u679c\u8d8a<strong>\u903c\u8fd1<\/strong>\u771f\u5b9e\u7684\u6570\u503c\u3002<\/p>\n<p data-pid=\"e7z0xCjz\">\u800c\u76f8\u6bd4\u8d77\u9ece\u66fc\u79ef\u5206\u7684<b>\u5747\u5300\u91c7\u6837<\/b>\uff0c\u8499\u7279\u5361\u6d1b\u79ef\u5206\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a<strong>\u968f\u673a\u5206\u5e03<\/strong>\u6765\u5bf9\u88ab\u79ef\u5206\u7684\u503c\u8fdb\u884c\u91c7\u6837\uff0c\u56e0\u6b64\u66f4\u52a0\u901a\u7528\uff0c\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<p data-pid=\"pWkwZ7kW\"><img loading=\"lazy\" class=\"size-full wp-image-4831 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_02.jpg\" alt=\"\" width=\"1214\" height=\"538\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_02.jpg 1214w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_02-300x133.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_02-1024x454.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_02-768x340.jpg 768w\" sizes=\"(max-width: 1214px) 100vw, 1214px\" \/><\/p>\n<p data-pid=\"pMD-E_FE\">\u5982\u56fe\u6240\u793a\uff0c\u6211\u4eec\u5e0c\u671b\u6c42\u51fa\u4e00\u4e2a\u51fd\u6570<strong>f(x)<\/strong>\u5728\u79ef\u5206\u57df<strong>[a,b]<\/strong>\u4e0a\u7684\u79ef\u5206\u503c\uff0c\u9009\u5b9a\u4e00\u4e2a\u91c7\u6837\u7684\u5206\u5e03<strong>p(x)<\/strong>\uff0c\u901a\u8fc7\u5bf9\u8be5\u5206\u5e03\u6765\u8fdb\u884c\u591a\u6b21\u7684\u51fd\u6570\u503c\u91c7\u6837\uff0c\u6700\u540e\u8fd1\u4f3c\u7684\u79ef\u5206\u503c\u5982\u56fe\u4e2d\u6700\u4e0b\u65b9\u5f0f\u5b50\u6240\u793a\u3002<\/p>\n<p data-pid=\"pMD-E_FE\">\u6ce8\u610f\u516c\u5f0f\u4e2d\u76841\/N\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e0d\u5c06\u56fe\u5f62\u5206\u5272\uff0c\u800c\u662f\u6bcf\u6b21\u91c7\u6837\u90fd\u8fd1\u4f3c\u4e3a\u4e00\u4e2a\u9ad8\u4e3a\u91c7\u6837\u5bf9\u5e94\u7684\u51fd\u6570\u503c\u7684\u957f\u65b9\u5f62\uff0c\u5c06\u591a\u6b21\u91c7\u6837\u8fd1\u4f3c\u7684\u957f\u65b9\u5f62\u9762\u79ef\u7d2f\u52a0\u6c42\u5747\u503c\uff0c\u5982\u4e0b\u56fe\u662f\u91c7\u6837\u6b21\u6570\u4e3a4\u65f6\u7684\u3002<\/p>\n<p data-pid=\"pMD-E_FE\"><img loading=\"lazy\" class=\"size-full wp-image-4856 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_16.png\" alt=\"\" width=\"1000\" height=\"290\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_16.png 1000w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_16-300x87.png 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_16-768x223.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p data-pid=\"pWqDZZTz\">\u8fd9\u91cc\u5bf9\u524d\u9762\u7684\u516c\u5f0f\u8fdb\u884c\u4e00\u4e2a\u7b80\u5355\u7684\u63a8\u5bfc\uff0c\u4ece\u6982\u7387\u8bba\u7684\u89d2\u5ea6\u7406\u89e3\uff0c\u6c42\u5747\u503c\u7684\u505a\u6cd5\u5176\u5b9e\u4e5f\u662f\u5bf9\u671f\u671b\u7684\u903c\u8fd1\uff0c\u56e0\u6b64\uff1a<\/p>\n<p data-pid=\"pWqDZZTz\"><img loading=\"lazy\" class=\"size-full wp-image-4833 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_03.jpg\" alt=\"\" width=\"497\" height=\"129\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_03.jpg 497w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_03-300x78.jpg 300w\" sizes=\"(max-width: 497px) 100vw, 497px\" \/><\/p>\n<p>\u90a3\u4e48\u5bf9\u4e8e\u8fd9\u6837\u4e00\u4e2a\u670d\u4ece\u67d0\u4e00\u5206\u5e03\u7684\u671f\u671b\u7684\u8ba1\u7b97\u5957\u516c\u5f0f\u76f4\u63a5\u8ba1\u7b97\u5f97\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4834 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_04.jpg\" alt=\"\" width=\"585\" height=\"220\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_04.jpg 585w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_04-300x113.jpg 300w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/p>\n<p data-pid=\"G46-AeAh\">\u901a\u8fc7\u4ee5\u4e0a\u63a8\u5bfc\u5373\u53ef\u660e\u767d\u8499\u7279\u5361\u6d1b\u7684\u8fd1\u4f3c\u6b63\u662f\u5bf9\u79ef\u5206\u503c\u7684\u4e00\u4e2a\u65e0\u504f\u4f30\u8ba1\uff0c\u4e5f\u5c31\u662f\u91c7\u6837\u6b21\u6570\u8d8a\u591a\uff0c\u8fd1\u4f3c\u503c\u4e0e\u79ef\u5206\u503c\u8d8a\u63a5\u8fd1\u3002<\/p>\n<p data-pid=\"VPpo64pr\">\u4e3a\u4e86\u65b9\u4fbf\uff0c\u4e00\u822c\u90fd\u4f7f\u7528\u5747\u5300\u91c7\u6837\uff0c\u56e0\u6b64\u5f88\u5bb9\u6613\u63a8\u51fa\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4835 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_05.jpg\" alt=\"\" width=\"1215\" height=\"528\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_05.jpg 1215w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_05-300x130.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_05-1024x445.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_05-768x334.jpg 768w\" sizes=\"(max-width: 1215px) 100vw, 1215px\" \/><\/p>\n<p data-pid=\"GQpBqDyX\">\u56e0\u6b64\uff0c<b>\u8499\u7279\u5361\u6d1b\u5c31\u662f\u5bf9\u51fd\u6570\u503c\u8fdb\u884c\u591a\u6b21\u91c7\u6837\u6c42\u5747\u503c\uff0c\u4ece\u800c\u5e2e\u52a9\u6c42\u5f97\u56f0\u96be\u79ef\u5206\u503c\u7684\u8fd1\u4f3c\u7684\u65b9\u6cd5<\/b>\u3002<\/p>\n<p data-pid=\"GQpBqDyX\">\u9664\u4e86\u4e0a\u8ff0\u7684\u671f\u671b\u6cd5\u4ee5\u5916\uff0c\u8499\u7279\u5361\u6d1b\u8fd8\u53ef\u4ee5\u7528\u6295\u70b9\u6cd5\u8ba1\u7b97\u5b9a\u79ef\u5206\u3002<\/p>\n<p data-pid=\"GQpBqDyX\"><img loading=\"lazy\" class=\"size-full wp-image-4858 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_17.png\" alt=\"\" width=\"462\" height=\"422\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_17.png 462w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_17-300x274.png 300w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/p>\n<p data-pid=\"GQpBqDyX\">\u5411\u533a\u57df\u5185<strong>\u968f\u673a<\/strong>\u6295\u4e0b\u5927\u91cf\u7684\u70b9\uff0c<strong>\u6574\u4e2a\u533a\u57df\u7684\u9762\u79ef x \u56fe\u5f62\u5185\u7684\u70b9\u5360\u5168\u90e8\u70b9\u7684\u6bd4\u4f8b<\/strong>\u5f97\u5230\u7684\u5c31\u662f\u8fd1\u4f3c\u79ef\u5206\u503c\uff0c\u4ece\u6982\u7387\u8bba\u7684\u89d2\u5ea6\u5f88\u597d\u7406\u89e3\uff0c\u540c\u6837\u662f\u6295\u70b9\u8d8a\u591a\uff0c\u7ed3\u679c\u8d8a\u51c6\u786e\u3002<\/p>\n<h1>&nbsp;<\/h1>\n<h1 style=\"text-align: center;\"><b>\u8499\u7279\u5361\u6d1b\u8def\u5f84\u8ffd\u8e2a(Monte Carlo Path Tracing)<\/b><\/h1>\n<p data-pid=\"Hw0ejZka\">\u56de\u987e\u4e00\u4e0b<a href=\"https:\/\/www.yumefx.com\/?p=4740&amp;preview=true\">\u524d\u6587<\/a>\u4e2d\u6240\u5f97\u5230\u7684\u6e32\u67d3\u65b9\u7a0b\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4821 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/Radiant_38.jpg\" alt=\"\" width=\"918\" height=\"89\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/Radiant_38.jpg 918w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/Radiant_38-300x29.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/Radiant_38-768x74.jpg 768w\" sizes=\"(max-width: 918px) 100vw, 918px\" \/><\/p>\n<p data-pid=\"4VkK4D0y\">\u8981\u60f3\u89e3\u51fa\u4ee5\u4e0a\u65b9\u7a0b\u7684\u89e3\u4e3b\u8981\u6709\u4e24\u4e2a\u96be\u70b9\uff1a<\/p>\n<ol>\n<li data-pid=\"hdeeYS2k\">\u79ef\u5206\u7684\u8ba1\u7b97<\/li>\n<li data-pid=\"a8hzz4bn\">\u9012\u5f52\u5f62\u5f0f<\/li>\n<\/ol>\n<p data-pid=\"WvbJw6H9\">\u5bf9\u4e8e\u8fd9\u79cd\u590d\u6742\u79ef\u5206\u7684\u8ba1\u7b97\u81ea\u7136\u5c31\u8981\u5229\u7528\u524d\u9762\u6240\u63d0\u5230\u7684\u8499\u7279\u5361\u6d1b\u79ef\u5206\u65b9\u6cd5\u4e86\u3002<\/p>\n<p data-pid=\"jWALbCyS\">\u4e0d\u8fc7\u5728\u8fdb\u5165\u5177\u4f53\u8ba1\u7b97\u4e4b\u524d\uff0c\u5148\u5bf9\u6e32\u67d3\u65b9\u7a0b\u505a\u51fa\u4e00\u70b9\u4fee\u6539\uff0c\u820d\u5f03\u81ea\u53d1\u5149\u9879(\u56e0\u4e3a\u9664\u4e86\u5149\u6e90\u5176\u4ed6\u7269\u4f53\u4e0d\u4f1a\u53d1\u5149)\uff0c\u4ece\u800c\u65b9\u4fbf\u8fdb\u884c\u8ba1\u7b97\u63a8\u5bfc\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4836 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06.jpg\" alt=\"\" width=\"1040\" height=\"137\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06.jpg 1040w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06-300x40.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06-1024x135.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06-768x101.jpg 768w\" sizes=\"(max-width: 1040px) 100vw, 1040px\" \/><\/p>\n<p>\u4fee\u6539\u8fc7\u4e4b\u540e\u7684\u65b9\u7a0b\u5176\u5b9e\u5c31\u53ea\u662f\u4e00\u4e2a\u5355\u7eaf\u7684\u79ef\u5206\u8ba1\u7b97\u4e86\uff0c\u5176\u7269\u7406\u542b\u4e49\u4e3a\u7740\u8272\u70b9p\u5230\u6444\u50cf\u673a\u6216\u4eba\u773c\u7684<strong>Radiance<\/strong>\u503c\u3002<\/p>\n<p>\u4ece\u5177\u4f53\u4f8b\u5b50\u51fa\u53d1\uff0c\u9996\u5148\u4ec5\u4ec5\u8003\u8651\u8868\u9762\u4e00\u70b9p\u7684\u76f4\u63a5\u5149\u7167\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-4868\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_19.jpg\" alt=\"\" width=\"1018\" height=\"557\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_19.jpg 1018w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_19-300x164.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_19-768x420.jpg 768w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/p>\n<p data-pid=\"84f1gUFg\">\u5176\u4e2d<strong>\u03c90<\/strong>\u4e3a\u773c\u775b\u7684\u89c2\u5bdf\u65b9\u5411\uff0c<strong>\u03c9i<\/strong>\u5219\u662f\u5404\u4e2a\u65b9\u5411\u5f39\u5c04\u5230\u70b9p\u7684\u5149\u7ebf\uff08\u8fd9\u91cc\u7bad\u5934\u65b9\u5411\u4e0e\u5149\u7ebf\u5b9e\u9645\u65b9\u5411\u76f8\u53cd\u662f\u56e0\u4e3a\u6e32\u67d3\u65b9\u7a0b\u4e2d\u6240\u6709\u65b9\u5411\u90fd\u4ee5\u8868\u9762\u5411\u5916\u4e3a\u6b63\u65b9\u5411\uff09\u3002<\/p>\n<p data-pid=\"KeO6nK9_\">\u56de\u60f3\u524d\u9762\u6240\u63d0\u5230\u7684\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u56f0\u96be\u79ef\u5206\u53ea\u8981\u9009\u5b9a\u4e00\u4e2a\u88ab\u79ef\u5206\u53d8\u91cf\u7684\u91c7\u6837\u5206\u5e03\u5373\u53ef\u901a\u8fc7\u8499\u7279\u5361\u6d1b\u7684\u65b9\u6cd5\u5f97\u5230\u79ef\u5206\u7ed3\u679c\u7684\u8fd1\u4f3c\u503c\uff0c\u800c\u6b64\u65f6\u7684\u88ab\u79ef\u5206\u503c\u4e3a\u5165\u5c04\u5149\u7ebf\u65b9\u5411<strong>\u03c9i<\/strong>\uff0c\u9009\u5b9a\u91c7\u6837\u5206\u5e03<strong>p(\u03c9i)<\/strong>\u4e3a\u5728p\u70b9\u7684<strong>\u534a\u7403\u65b9\u5411\u5185\u5bf9\u03c9i\u8fdb\u884c\u5747\u5300\u53d6\u6837<\/strong>\uff08\u53ea\u8003\u8651\u4ece\u5e73\u9762\u4e0a\u65b9\u5165\u5c04\u7684\u5149\u7ebf\uff0c\u534a\u7403\u7684\u7acb\u4f53\u89d2\u4e3a<strong>2\u03c0<\/strong>\uff09\uff0c\u4e0d\u96be\u5f97\u51fa\u79ef\u5206\u8fd1\u4f3c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<p data-pid=\"KeO6nK9_\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-4840\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_08.jpg\" alt=\"\" width=\"1054\" height=\"311\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_08.jpg 1054w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_08-300x89.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_08-1024x302.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_08-768x227.jpg 768w\" sizes=\"(max-width: 1054px) 100vw, 1054px\" \/><\/p>\n<p>\u56e0\u4e3a\u53ea\u8003\u8651\u76f4\u63a5\u5149\u7167\uff0c\u6240\u4ee5\u53ea\u6709\u5f53\u91c7\u6837\u7684\u65b9\u5411<strong>\u03c9i<\/strong>\u51fb\u4e2d\u5149\u6e90\u7684\u65f6\u5019\uff0c\u5149\u6e90\u624d\u4f1a\u5bf9\u8be5\u7740\u8272\u70b9\u6709\u8d21\u732e\uff0c\u8ba1\u7b97\u4f2a\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre><span>shade(p, wo)<\/span>\n<span>    Randomly choose N directions p(\u03c9i)<\/span>\n<span>    Lo = 0.0<\/span>\n<span>    For each wi<\/span>\n<span>        Trace a ray r(p, wi)<\/span>\n<span>        If ray r hit the light<\/span>\n<span>            Lo += (1 \/ N) * L_i * f_r * cosine \/ p(\u03c9i)     \/\/L_i\u4ee3\u8868\u5149\u6e90\u4eae\u5ea6\uff0cf_r\u4ee3\u8868BRDF<\/span>\n<span>    Return Lo<\/span>\n<span><\/span><\/pre>\n\n\n\n<p>\u663e\u800c\u6613\u89c1\u7684\uff0c\u5355\u72ec\u4ec5\u4ec5\u8003\u8651\u76f4\u63a5\u5149\u7167\u81ea\u7136\u662f\u4e0d\u591f\u7684\uff0c\u8fd8\u9700\u8981\u95f4\u63a5\u5149\u7167\uff0c\u5373\u5f53\u91c7\u6837\u7684<strong>\u03c9i<\/strong>\u65b9\u5411\u78b0\u649e\u5230\u4e86\u522b\u7684\u7269\u4f53\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4841 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_09.jpg\" alt=\"\" width=\"1152\" height=\"519\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_09.jpg 1152w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_09-300x135.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_09-1024x461.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_09-768x346.jpg 768w\" sizes=\"(max-width: 1152px) 100vw, 1152px\" \/><\/p>\n<p>\u6b64\u65f6\u91c7\u6837\u7684\u5149\u7ebf<strong>\u03c9i<\/strong>\u78b0\u649e\u5230\u4e86\u53e6\u4e00\u4e2a\u7269\u4f53\u7684Q\u70b9\uff0c\u5982\u679c\u8fd9\u6761\u5149\u7ebf\u5728Q\u70b9\u53cd\u5c04\u540e\u6ca1\u6709\u78b0\u5230\u5149\u6e90\uff0c\u8fd9\u6761\u8def\u5f84\u81ea\u7136\u6ca1\u6709\u8d21\u732e\uff1b\u5982\u679c\u5149\u7ebf\u5728Q\u70b9\u53cd\u5c04\u540e\u78b0\u5230\u4e86\u5149\u6e90\uff0c\u90a3\u4e48\u8be5\u6761\u8def\u5f84\u5bf9\u7740\u8272\u70b9P\u7684\u8d21\u732e\u662f\u591a\u5c11\u5462\uff1f<\/p>\n<p>\u6b64\u65f6\u53ef\u4ee5\u7406\u89e3\u4e3a<strong>\u03c9i<\/strong>\u65b9\u5411\u4e3aQ\u70b9\u7684\u89c2\u5bdf\u65b9\u5411\uff0c\u6c42Q\u70b9\u5230<strong>\u03c9i<\/strong>\u65b9\u5411\u7684<strong>Radiance<\/strong>\u503c\uff0c\u4e5f\u5c31\u662f\u5149\u6e90\u5728\u70b9Q\u7684\u76f4\u63a5\u5149\u7167\u518d\u4e58\u4e0aQ\u70b9\u53d1\u5c04\u5230<strong>\u03c9i<\/strong>\u65b9\u5411\u7684\u6bd4\u4f8b\u3002<\/p>\n<p>\u663e\u7136\u8fd9\u662f\u4e00\u4e2a\u7c7b\u4f3c\u5149\u7ebf\u8ffd\u8e2a\u7684\u9012\u5f52\u8fc7\u7a0b\uff0c\u4e0d\u540c\u70b9\u662f\u8be5\u65b9\u6cd5\u901a\u8fc7\u5bf9\u5149\u7ebf\u65b9\u5411\u7684\u91c7\u6837\u4ece\u800c\u627e\u51fa\u4e00\u6761\u6761\u53ef\u4ee5\u8fde\u63a5\u773c\u775b\u548c\u5149\u6e90\u7684\u7684\u5149\u7ebf\u8def\u5f84\uff0c\u8fd9\u4e5f\u6b63\u662f\u4e3a\u4ec0\u4e48\u53eb\u8def\u5f84\u8ffd\u8e2a\u7684\u539f\u56e0\uff0c\u4f2a\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre><span>shade(p, wo)<\/span>\n<span>    Randomly choose N directions p(\u03c9i)<\/span>\n<span>    Lo = 0.0<\/span>\n<span>    For each wi<\/span>\n<span>        Trace a ray r(p, wi)<\/span>\n<span>        If ray r hit the light<\/span>\n<span>            Lo += (1 \/ N) * L_i * f_r * cosine \/ p(\u03c9i)<\/span>\n<span>        Else If ray r hit an object at q<\/span>\n<span>            Lo += (1 \/ N) * shade(q, -wi) * f_r * cosine \/ p(\u03c9i)<\/span>\n<span>    Return Lo<\/span>\n<\/pre>\n\n\n\n<p>\u81f3\u6b64\uff0c\u6211\u4eec\u6210\u529f\u901a\u8fc7\u8499\u7279\u5361\u6d1b\u7684\u65b9\u5f0f\u89e3\u51fa\uff08\u8fd1\u4f3c\uff09\u4e86\u6e32\u67d3\u65b9\u7a0b\u7684\u79ef\u5206\u503c\uff0c\u4e5f\u901a\u8fc7\u8003\u8651\u76f4\u63a5\u5149\u7167\u4e0e\u95f4\u63a5\u5149\u7167\u89e3\u51b3\u4e86\u9012\u5f52\u7684\u95ee\u9898\u3002\u4f46\u8be5\u65b9\u6cd5\u6709\u4e00\u4e2a\u975e\u5e38\u81f4\u547d\u7684\u7f3a\u9677\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4842 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_10.jpg\" alt=\"\" width=\"1203\" height=\"552\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_10.jpg 1203w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_10-300x138.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_10-1024x470.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_10-768x352.jpg 768w\" sizes=\"(max-width: 1203px) 100vw, 1203px\" \/><\/p>\n<p>\u6211\u4eec\u901a\u8fc7\u6bcf\u6b21\u5bf9\u5149\u7ebf\u65b9\u5411\u7684\u91c7\u6837\u4ece\u800c\u89e3\u51fa\u65b9\u7a0b\uff0c\u5047\u8bbe\u6bcf\u6b21\u91c7\u6837100\u6761\uff0c\u90a3\u4e48\u4ece\u4eba\u773c\u51fa\u53d1\u7684\u7b2c\u4e00\u6b21\u91c7\u6837\u5c31\u662f100\u6761\uff0c\u5728\u8fdb\u884c\u7b2c\u4e8c\u6b21\u53cd\u5c04\u4e4b\u540e\u5c31\u662f10000\u6761\uff0c\u4f9d\u6b21\u7c7b\u63a8\uff0c\u53cd\u5c04\u8d8a\u591a\u6b21\u5149\u7ebf\u6570\u91cf\u4fbf\u4f1a\u6307\u6570\u7ea7\u7206\u70b8\u589e\u957f\uff0c\u8ba1\u7b97\u91cf\u5b8c\u5168\u65e0\u6cd5\u63a5\u53d7\uff0c\u90a3\u4e48\u5982\u4f55\u624d\u80fd\u4f7f\u5f97\u5149\u7ebf\u6570\u91cf\u4e0d\u7206\u70b8\u589e\u957f\u5462\uff1f<\/p>\n<p><b>\u552f\u6709\u6bcf\u6b21\u53ea\u91c7\u6837\u4e00\u4e2a\u65b9\u5411\uff01N = 1\u3002<\/b>\uff08N = 1\u65f6\u5c31\u662f\u901a\u5e38\u6240\u8bf4\u7684\u8def\u5f84\u8ffd\u8e2a\uff0c\u4f5c\u4e3a\u533a\u5206N != 1\u65f6\uff0c\u4e00\u822c\u79f0\u4e3a\u5206\u5e03\u5f0f\u8def\u5f84\u8ffd\u8e2a\u3002\uff09<\/p>\n\n\n\n<pre><span>shade(p, wo)<\/span>\n<span>    Randomly choose ONE direction p(wi)<\/span>\n<span>    Trace a ray r(p, wi)<\/span>\n<span>    If ray r hit the light<\/span>\n<span>        Return L_i * f_r * cosine \/ p(wi)<\/span>\n<span>    Else If ray r hit an object at q<\/span>\n<span>        Return shade(q, -wi) * f_r * cosine \/ p(wi)<\/span>\n<\/pre>\n\n\n\n<p>\u5982\u679c\u53ea\u91c7\u6837\u4e00\u4e2a\u65b9\u5411\u90a3\u4e48\u6240\u5e26\u6765\u7684\u95ee\u9898\u4e5f\u662f\u663e\u800c\u6613\u89c1\u7684\uff0c\u79ef\u5206\u8ba1\u7b97\u7684\u7ed3\u679c\u4f1a\u975e\u5e38\u7684\u968f\u673a\uff0c\u867d\u7136\u8499\u7279\u5361\u6d1b\u79ef\u5206\u662f\u65e0\u504f\u4f30\u8ba1\uff0c\u4f46\u6837\u672c\u8d8a\u5c11\u663e\u7136\u504f\u5dee\u8d8a\u5927\u3002<\/p>\n<p>\u4f46\u8be5\u95ee\u9898\u4e5f\u597d\u89e3\u51b3\uff0c\u5982\u679c\u6bcf\u6b21\u53ea\u53bb\u5bfb\u627e\u4e00\u6761\u8def\u5f84\u7ed3\u679c\u4e0d\u51c6\u786e\uff0c\u90a3\u4e48\u5c31\u53bb\u5bfb\u627e\u591a\u6761\u8def\u5f84\uff01\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4843 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_11.jpg\" alt=\"\" width=\"968\" height=\"441\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_11.jpg 968w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_11-300x137.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_11-768x350.jpg 768w\" sizes=\"(max-width: 968px) 100vw, 968px\" \/><\/p>\n<p>\u4ece\u6444\u50cf\u673a\u5411\u6bcf\u4e2a\u50cf\u7d20\u7684\u533a\u57df\u5185\u53d1\u5c04\u591a\u6761\u8def\u5f84\uff0c\u8ffd\u8e2a\u6bcf\u6761\u8def\u5f84\u7684\u53cd\u5c04\u5e76\u8ba1\u7b97\uff0c\u6700\u540e\u5c06\u591a\u6761\u8def\u5f84\u7684\u7ed3\u679c\u6c42\u5e73\u5747\u5373\u53ef\u3002<\/p>\n<p>\u6539\u826f\u4e4b\u540e\u7684Path Tracing\u4f2a\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre><span>ray_generation(camPos, pixel)<\/span>\n<span>    Uniformly choose N sample positions within the pixel<\/span>\n<span>    pixel_radiance = 0.0<\/span>\n<span>    For each sample in the pixel<\/span>\n<span>        Shoot a ray r(camPos, cam_to_sample)<\/span>\n<span>        If ray r hit the scene at p<\/span>\n<span>            pixel_radiance += 1 \/ N * shade(p, sample_to_cam)<\/span>\n<span>    Return pixel_radiance<\/span>\n<\/pre>\n\n\n\n<p data-pid=\"o0gYSdSE\">\u901a\u8fc7\u5bf9\u7ecf\u8fc7\u5355\u4e2a\u50cf\u7d20\u7684\u5149\u7ebf\u591a\u6b21\u91cd\u590d\u91c7\u6837\uff0c\u6bcf\u6b21\u5728\u53cd\u5c04\u7684\u65f6\u5019\u53ea\u968f\u673a\u9009\u53d6\u4e00\u4e2a\u65b9\u5411\uff0c\u89e3\u51b3\u4e86\u5bf9\u7ecf\u8fc7\u5355\u4e2a\u50cf\u7d20\u7684\u5149\u7ebf\u91c7\u6837\u4e00\u6b21\uff0c\u800c\u5bf9\u53cd\u5c04\u5149\u7ebf\u6309\u5206\u5e03\u591a\u6b21\u91c7\u6837\u6240\u5bfc\u81f4\u7684\u5149\u7ebf\u7206\u70b8\u95ee\u9898\u3002<\/p>\n<p data-pid=\"DuO2Sy2b\">\u4f46\u95ee\u9898\u8fd8\u6ca1\u6709\u5f7b\u5e95\u89e3\u51b3\uff0c\u56e0\u4e3ashade\u51fd\u6570\u7684\u9012\u5f52\u6ca1\u6709\u51fa\u53e3\uff0c\u6c38\u8fdc\u4e0d\u4f1a\u505c\u4e0b\u3002 \u4f46\u8fd9\u91cc\u5e76\u4e0d\u4f1a\u91c7\u7528\u5149\u7ebf\u8ffd\u8e2a\u7b97\u6cd5\u4e2d\u8bbe\u5b9a\u6700\u5927\u53cd\u5c04\u6b21\u6570\u7684\u65b9\u5f0f\uff0c\u800c\u662f\u975e\u5e38\u7cbe\u5999\u7684\u91c7\u7528\u4e86<b>\u4fc4\u7f57\u65af\u8f6e\u76d8\u8d4c(Russian Roulette)<\/b>\u3002<\/p>\n<p data-pid=\"DuO2Sy2b\"><img loading=\"lazy\" class=\"size-full wp-image-4879 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_20.jpg\" alt=\"\" width=\"749\" height=\"372\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_20.jpg 749w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_20-300x149.jpg 300w\" sizes=\"(max-width: 749px) 100vw, 749px\" \/><\/p>\n<p data-pid=\"nbPSPjvT\">\u4e00\u628a\u5f39\u4ed36\u53d1\u7684\u5de6\u8f6e\u624b\u67aa\uff0c\u968f\u673a\u586b\u5145\u4e24\u53d1\u5b50\u5f39\uff0c\u6309\u4e0b\u6273\u673a\u65f6\uff0c\u76ee\u6807\u67094\/6\u7684\u6982\u7387\u6d3b\u4e0b\u6765\uff0c\u8fd9\u5c31\u662f\u4fc4\u7f57\u65af\u8f6e\u76d8\u8d4c\u7684\u6982\u5ff5\u3002<\/p>\n<p data-pid=\"oIWlynZX\">\u5c06\u5176\u5e94\u7528\u5728\u8def\u5f84\u8ffd\u8e2a\u5f53\u4e2d\uff0c\u9996\u5148\u8bbe\u5b9a\u4e00\u4e2a\u6982\u7387P, \u6bcf\u6b21\u5149\u7ebf\u53cd\u5c04\u65f6\u6709P\u7684\u6982\u7387\u5149\u7ebf\u4f1a\u7ee7\u7eed\u9012\u5f52\u5e76\u8bbe\u7f6e\u8fd4\u56de\u503c\u4e3aLo\/P\uff0c\u67091-P\u7684\u6982\u7387\u5149\u7ebf\u505c\u6b62\u9012\u5f52\uff0c\u5e76\u8fd4\u56de0\u3002\u8fd9\u6837\u5de7\u5999\u7684\u8bbe\u5b9a\u4e4b\u4e0b\u5149\u7ebf\u4e00\u5b9a\u4f1a\u5728\u67d0\u6b21\u53cd\u5c04\u4e4b\u540e\u505c\u6b62\u9012\u5f52\uff0c\u5e76\u4e14\u8ba1\u7b97\u7684\u7ed3\u679c\u4f9d\u7136\u662f\u65e0\u504f\u7684\uff0c\u56e0\u4e3a\u4ece\u6982\u7387\u8bba\u7684\u89d2\u5ea6\u6765\u770b\uff0cRadiance\u7684\u671f\u671bLo\u4e0d\u53d8\uff0c\u8bc1\u660e\u5982\u4e0b\uff1a<\/p>\n<p data-pid=\"oIWlynZX\"><img loading=\"lazy\" class=\"size-full wp-image-4844 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_12.jpg\" alt=\"\" width=\"651\" height=\"88\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_12.jpg 651w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_12-300x41.jpg 300w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/p>\n<p>shade\u51fd\u6570\u7684\u4f2a\u4ee3\u7801\u53d8\u66f4\u5982\u4e0b\uff0c\u4f7f\u5f97\u53ef\u4ee5\u505c\u6b62\u9012\u5f52\u4e86\uff1a<\/p>\n\n\n\n<pre><span>shade(p, wo)<\/span>\n<span>    Manually specify a probability P_RR<\/span>\n<span>    Randomly select ksi in a uniform dist. in [0, 1]<\/span>\n<span>    If (ksi &gt; P_RR) <\/span>\n<span>        return 0.0;<\/span>\n<span><\/span>\n<span>    Randomly choose ONE direction p(wi)<\/span>\n<span>    Trace a ray r(p, wi)<\/span>\n<span>    If ray r hit the light<\/span>\n<span>        Return L_i * f_r * cosine \/ p(wi) \/ P_RR<\/span>\n<span>    Else If ray r hit an object at q<\/span>\n<span>        Return shade(q, -wi) * f_r * cosine \/ p(wi) \/ P_RR<\/span>\n<\/pre>\n\n\n\n<p>\u81f3\u6b64\uff0c\u8def\u5f84\u8ffd\u8e2a\u7b97\u6cd5\u5df2\u7ecf\u5b8c\u6210\u5927\u534a\uff0c\u53ea\u5dee\u6700\u540e\u4e00\u4e2a\u5c0f\u95ee\u9898\uff01<\/p>\n<p>\u73b0\u5728\u7684\u8def\u5f84\u8ffd\u8e2a\u6548\u7387\u975e\u5e38\u7684\u4f4e\u4e0b\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4889 alignright\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_21.jpg\" alt=\"\" width=\"1239\" height=\"441\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_21.jpg 1239w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_21-300x107.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_21-1024x364.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_21-768x273.jpg 768w\" sizes=\"(max-width: 1239px) 100vw, 1239px\" \/><\/p>\n<p data-pid=\"wH07_hxQ\">\u5728\u6bcf\u6b21\u8ba1\u7b97\u76f4\u63a5\u5149\u7167\u7684\u65f6\u5019\uff0c\u901a\u8fc7\u5747\u5300\u91c7\u6837\u968f\u673a\u65b9\u5411\u6253\u51fa\u5149\u7ebf\uff0c\u4f46\u53ea\u6709\u6781\u5c11\u6570\u7684\u5149\u7ebf\u65b9\u5411\u53ef\u4ee5\u78b0\u5230\u5149\u6e90\uff0c\u5c24\u5176\u5f53\u5149\u6e90\u8d8a\u5c0f\u7684\u65f6\u5019\uff0c\u8fd9\u79cd\u73b0\u8c61\u8d8a\u660e\u663e\uff0c\u5927\u91cf\u91c7\u6837\u7684\u5149\u7ebf\u90fd\u662f\u65e0\u6548\u6d6a\u8d39\u7684\u3002<\/p>\n<p data-pid=\"xqhcBGx0\">\u56e0\u6b64\u5728\u8ba1\u7b97\u76f4\u63a5\u5149\u7167\u7684\u65f6\u5019\u53ef\u4ee5\u6539\u8fdb\u4e3a<strong>\u76f4\u63a5\u5bf9\u5149\u6e90\u8fdb\u884c\u91c7\u6837<\/strong>\uff01\u8fd9\u6837\u6240\u6709\u91c7\u6837\u7684\u5149\u7ebf\u90fd\u4e00\u5b9a\u4f1a\u51fb\u4e2d\u5149\u6e90(\u5982\u679c\u4e2d\u95f4\u6ca1\u6709\u522b\u7684\u7269\u4f53\u906e\u6321)\uff0c\u6ca1\u6709\u5149\u7ebf\u8def\u5f84\u5c31\u4e0d\u4f1a\u88ab\u6d6a\u8d39\u4e86\u3002\u5047\u8bbe\u5149\u6e90\u7684\u9762\u79ef\u4e3aA\uff0c\u90a3\u4e48\u5bf9\u5149\u6e90\u8fdb\u884c\u7684\u91c7\u6837\u5206\u5e03<strong>p(A) = 1\/A<\/strong> \uff0c\u4f46\u539f\u59cb\u7684\u6e32\u67d3\u65b9\u7a0b\uff1a<\/p>\n<p data-pid=\"xqhcBGx0\"><img loading=\"lazy\" class=\"size-full wp-image-4836 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06.jpg\" alt=\"\" width=\"1040\" height=\"137\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06.jpg 1040w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06-300x40.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06-1024x135.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_06-768x101.jpg 768w\" sizes=\"(max-width: 1040px) 100vw, 1040px\" \/><\/p>\n<p>\u5f88\u660e\u663e\u662f\u5bf9\u5149\u7ebf\u65b9\u5411<strong>\u03c9i<\/strong>\u8fdb\u884c\u79ef\u5206\u7684\uff0c\u5982\u679c\u60f3\u8981\u5bf9\u5149\u6e90\u8fdb\u884c\u91c7\u6837\u5e76\u4f9d\u7136\u4f7f\u7528\u8499\u7279\u5361\u6d1b\u7684\u65b9\u6cd5\uff0c\u90a3\u4e48\u4e00\u5b9a\u8981\u5c06\u5176\u4fee\u6539\u4e3a\u5bf9\u5149\u6e90\u9762\u79ef <strong>dA<\/strong> \u7684\u79ef\u5206\uff08\u6539\u53d8\u79ef\u5206\u57df\uff09\uff0c\u6362\u8a00\u4e4b\u5c31\u662f\u9700\u8981\u627e\u5230 <strong>dA <\/strong>\u4e0e <strong>d\u03c9 <\/strong>\u7684\u5173\u7cfb\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4845 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_13.jpg\" alt=\"\" width=\"646\" height=\"502\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_13.jpg 646w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_13-300x233.jpg 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<p><strong>dA <\/strong>\u4e0e <strong>d\u03c9 <\/strong>\u7684\u5173\u7cfb\u5982\u4e0b<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4893 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_22.jpg\" alt=\"\" width=\"381\" height=\"174\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_22.jpg 381w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_22-300x137.jpg 300w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/p>\n<p>\u5173\u7cfb\u5f0f\u4e2d\u7684 <strong>cos\u03b8&#8217; <\/strong>\u662f\u4e3a\u4e86\u8ba1\u7b97\u51fa\u5149\u6e90\u4e0a\u5fae\u5206\u9762\u79ef\u5143\u6b63\u5bf9\u534a\u7403\u7684\u9762\u79ef\uff0c\u4e4b\u540e\u518d\u6309\u7167\u7acb\u4f53\u89d2\u7684\u5b9a\u4e49<strong>d\u03c9 = dA \/ rr<\/strong>\uff0c\u9664\u4ee5\u7740\u8272\u70b9x\u4e0e\u5149\u6e90\u91c7\u6837\u70b9 <strong>x&#8217; <\/strong>\u8ddd\u79bb\u7684\u5e73\u65b9\u5373\u53ef\u3002<\/p>\n<p>\u4e8e\u662f\u6839\u636e\u56fe\u4e2d\u4e8c\u8005\u7684\u5173\u7cfb\u53ef\u5c06\u6e32\u67d3\u65b9\u7a0b\u6539\u5199\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4846 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_14.jpg\" alt=\"\" width=\"980\" height=\"274\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_14.jpg 980w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_14-300x84.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_14-768x215.jpg 768w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><\/p>\n<p>\u8fd9\u6837\u4fbf\u6210\u529f\u4ece\u5bf9\u00a0<strong>\u03c9i <\/strong>\u7684\u79ef\u5206\u8f6c\u5230\u4e86\u5bf9\u5149\u6e90\u9762\u79ef <strong>A<\/strong> \u7684\u79ef\u5206\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u5229\u7528\u8499\u7279\u5361\u6d1b\u7684\u65b9\u6cd5\u5bf9\u5149\u6e90\u8fdb\u884c\u91c7\u6837\u4ece\u800c\u8ba1\u7b97\u76f4\u63a5\u5149\u7167\u7684\u79ef\u5206\u503c\u4e86\uff0c\u5bf9\u4e8e\u95f4\u63a5\u5149\u7167\uff0c\u4f9d\u7136\u91c7\u7528\u5148\u524d\u7684\u65b9\u6cd5\u8fdb\u884c\u5149\u7ebf\u65b9\u5411\u7684\u5747\u5300\u91c7\u6837\u3002\u6700\u7ec8\u4f2a\u4ee3\u7801\u5982\u4e0b\uff0c\u5206\u76f4\u63a5\u5149\u7167\u548c\u95f4\u63a5\u5149\u7167\u4e24\u90e8\u5206\u8ba1\u7b97\uff1a<\/p>\n\n\n\n<pre><span>shade(p, wo)<\/span>\n<span>    # Contribution from the light source.<\/span>\n<span>    Uniformly sample the light at x\u2019 (p(light) = 1 \/ A)<\/span>\n<span>    L_dir = L_i * f_r * cos \u03b8 * cos \u03b8\u2019 \/ |x\u2019 - p|^2 \/ p(light)<\/span>\n<span><\/span>\n<span>    # Contribution from other reflectors.<\/span>\n<span>    L_indir = 0.0<\/span>\n<span>    Test Russian Roulette with probability P_RR<\/span>\n<span>    Uniformly sample the hemisphere toward wi (p(wi) = 1 \/ 2pi)<\/span>\n<span>    Trace a ray r(p, wi)<\/span>\n<span>    If ray r hit a non-emitting object at q<\/span>\n<span>        L_indir = shade(q, -wi) * f_r * cos \u03b8 \/ p(wi) \/ P_RR<\/span>\n<span><\/span>\n<span>    Return L_dir + L_indir<\/span>\n<\/pre>\n\n\n\n<p>\u8ba1\u7b97\u76f4\u63a5\u5149\u7167\u7684\u65f6\u5019\u8fd8\u9700\u8981\u5224\u65ad\u5149\u6e90\u4e0e\u7740\u8272\u70b9\u4e4b\u95f4\u662f\u5426\u6709\u7269\u4f53\u906e\u6321\uff0c\u8be5\u505a\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u4ece\u7740\u8272\u70b9 <strong>x <\/strong>\u5411\u5149\u6e90\u91c7\u6837\u70b9 <strong>x\u2019 <\/strong>\u53d1\u51fa\u4e00\u6761\u68c0\u6d4b\u5149\u7ebf\u5224\u65ad\u662f\u5426\u4e0e\u5149\u6e90\u4e4b\u5916\u7684\u7269\u4f53\u76f8\u4ea4\u5373\u53ef\uff0c\u5982\u56fe\u6240\u793a:<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4847 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_15.jpg\" alt=\"\" width=\"550\" height=\"431\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_15.jpg 550w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_15-300x235.jpg 300w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/p>\n\n\n\n<pre><span># Contribution from the light source.<\/span>\n<span>L_dir = 0.0<\/span>\n<span>Uniformly sample the light at x\u2019 (p(light) = 1 \/ A)<\/span>\n<span>Shoot a ray from p to x\u2019<\/span>\n<span>If the ray is not blocked in the middle<\/span>\n<span>    L_dir = \u2026<\/span>\n<\/pre>\n\n\n\n<p>\u5230\u8fd9\u4e00\u6b65\uff0c\u8def\u5f84\u8ffd\u8e2a\u624d\u771f\u6b63\u5b8c\u6574\u4e86\uff0c\u6700\u540e\u770b\u4e00\u4e0b\u771f\u5b9e\u7167\u7247\u548c\u8def\u5f84\u8ffd\u8e2a\u6548\u679c\u7684\u5bf9\u6bd4\uff0c\u611f\u53d7\u4e00\u4e0b\u7167\u7247\u7ea7\u771f\u5b9e\uff08Photo-Realistic\uff09\u3002<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-4902 aligncenter\" src=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_23.jpg\" alt=\"\" width=\"1221\" height=\"607\" srcset=\"https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_23.jpg 1221w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_23-300x149.jpg 300w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_23-1024x509.jpg 1024w, https:\/\/www.yumefx.com\/wp-content\/uploads\/2022\/03\/PathTracing_23-768x382.jpg 768w\" sizes=\"(max-width: 1221px) 100vw, 1221px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>\u672c\u6587\u53c2\u8003\u81ea\u95eb\u4ee4\u742a\u8001\u5e08\u7684\u300a<a href=\"https:\/\/www.bilibili.com\/video\/BV1X7411F744?p=14\"><span class=\"tit\">GAMES101-\u73b0\u4ee3\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u5165\u95e8<\/span><\/a>\u300b\u548c\u5b59\u6653\u78ca\u7684<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/144403802\">\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u7cfb\u5217\u7b14\u8bb0<\/a>\uff0c\u611f\u8c22\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u4eba\u4eec\u4e4b\u95f4\u8c08\u8bdd\u5931\u8d25\uff0c<br \/>\u5e76\u4e0d\u662f\u56e0\u4e3a\u7f3a\u4e4f\u667a\u6167\uff0c\u800c\u662f\u56e0\u4e3a\u81ea\u8d1f\u3002<br \/>\u6bcf\u4e00\u4e2a\u4eba\u90fd\u5e0c\u671b\u8c08\u8bba\u81ea\u5df1\uff0c<br \/>\u6216\u662f\u81ea\u5df1\u611f\u5174\u8da3\u7684\u8bdd\u9898\u3002<\/p>\n<p style=\"text-align: right;\">\u2014\u2014\u6258\u5c14\u65af\u6cf0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u524d\u6587\u4ecb\u7ecd\u4e86\u57fa\u4e8e\u7269\u7406\u6e32\u67d3\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u5305\u62ec\u8f90\u5c04\u5ea6\u91cf\u5b66\u3001BRDF\u4ee5\u53ca\u6e32\u67d3\u65b9\u7a0b\uff0c\u4f46\u5e76\u6ca1\u6709\u7ed9\u51fa\u89e3\u6e32\u67d3\u65b9\u7a0b\u7684\u65b9\u6cd5\uff0c\u6216 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4849,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,84],"tags":[86,14,83],"_links":{"self":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts\/4828"}],"collection":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4828"}],"version-history":[{"count":0,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts\/4828\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/media\/4849"}],"wp:attachment":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}