{"id":3605,"date":"2021-01-24T13:32:54","date_gmt":"2021-01-24T05:32:54","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=3605"},"modified":"2021-01-24T13:32:54","modified_gmt":"2021-01-24T05:32:54","slug":"%e8%af%91real-shading-in-unreal-engine-4%ef%bc%88ue4%e4%b8%ad%e7%9a%84%e7%9c%9f%e5%ae%9e%e6%b8%b2%e6%9f%93-1","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=3605","title":{"rendered":"[\u8bd1]Real Shading in Unreal Engine 4\uff08UE4\u4e2d\u7684\u771f\u5b9e\u6e32\u67d3-1)"},"content":{"rendered":"\n<p><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/121719442\">https:\/\/zhuanlan.zhihu.com\/p\/121719442<\/a><\/p>\n\n\n\n<p>\u6700\u8fd1\u6309\u7167\u5b66\u4e60\u5c0f\u7ec4\u5185\u7684\u5206\u5de5\uff0c\u6211\u4e00\u76f4\u5728\u7814\u7a76Unreal\uff0c\u88ab\u641e\u5f97\u6709\u70b9\u75db\u82e6\u3002unreal\u7531\u4e8e\u5f00\u53d1\u65f6\u95f4\u592a\u957f\uff0c\u6e90\u4ee3\u7801\u8fc7\u4e8e\u5e9e\u5927\uff0c\u800c\u4e14\uff0c\u4f53\u7cfb\u5316\u7684\u4e2d\u6587\u6587\u6863\u4e5f\u6bd4\u8f83\u5c11\uff0c\u6240\u4ee5\uff0c\u5c31\u51b3\u5b9a\u82b1\u4e00\u4e9b\u65f6\u95f4\u6765\u505a\u82f1\u6587\u8d44\u6599\u7684\u642c\u8fd0\u5de5\u3002<\/p>\n\n\n\n<p>\u8fd9\u6b21\u6765\u7ffb\u8bd1\u4e00\u4e0b2013\u5e74Epics Games\u5de5\u7a0b\u5e08\u505a\u7684\u5206\u4eab\u300aReal Shading in Unreal Engine 4\u300b\u8fd9\u7bc7\u6587\u7ae0\uff0c\u8fd9\u4e2a\u4f5c\u4e3aUnreal Engine\u5411\u771f\u5b9e\u6e32\u67d3\u8f6c\u53d8\u7684\u91cd\u8981\u5206\u6790\u6587\u6863\uff0c\u5bf9\u73b0\u5728\u800c\u8a00\uff0c\u8fd8\u662f\u6709\u4e00\u4e9b\u501f\u9274\u610f\u4e49\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Real Shading in Unreal Engine 4<\/strong><\/h2>\n\n\n\n<p>by Brian Karis, Epic Games<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-df1522212ca4b72eb672479094cf7ac0_720w.jpg\" alt=\"\"\/><figcaption>\u56fe1\uff1aUE4\u7684\u6e17\u900f\u8005Demo<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u4ecb\u7ecd-Introduction<\/strong><\/h2>\n\n\n\n<p>\u5927\u7ea6\u5728\u4e00\u5e74\u524d\uff082012\u5e74\uff09\uff0c\u6211\u4eec\u51b3\u5b9a\u6295\u5165\u4e00\u4e9b\u65f6\u95f4\u53bb\u63d0\u5347\u6211\u4eec\u7684\u7740\u8272\u6a21\u578b\u5e76\u4e14\u5305\u542b\u4e00\u4e2a\u66f4\u52a0\u57fa\u4e8e\u7269\u7406\u7684\u6750\u8d28\u5de5\u4f5c\u6d41\u3002\u5b83\u90e8\u5206\u9a71\u52a8\u81ea\u6e32\u67d3\u66f4\u771f\u5b9e\u7684\u56fe\u50cf\u7684\u9700\u6c42\uff0c\u4f46\u662f\u6211\u4eec\u4e5f\u5bf9\u6211\u4eec\u901a\u8fc7\u66f4\u57fa\u4e8e\u7269\u7406\u7684\u65b9\u6cd5\u8fdb\u884c\u6750\u8d28\u521b\u5efa\u3001\u4f7f\u7528\u5206\u5c42\u6750\u8d28\u53ef\u80fd\u8fbe\u5230\u7684\u76ee\u6807\u611f\u5174\u8da3\u3002\u827a\u672f\u5bb6\u611f\u89c9\u8fd9\u53ef\u80fd\u662f\u5bf9\u5de5\u4f5c\u6d41\u548c\u8d28\u91cf\u7684\u4e00\u4e2a\u5de8\u5927\u7684\u63d0\u5347\uff0c\u5e76\u4e14\u6211\u5df2\u7ecf\u5728\u53e6\u4e00\u4e2a\u5de5\u4f5c\u5ba4\u7b2c\u4e00\u65f6\u95f4\u770b\u5230\u4e86\u8fd9\u4e9b\u6210\u6548\uff0c\u5728\u90a3\u91cc\u6211\u4eec\u5df2\u7ecf\u8fc7\u6e21\u5230\u79bb\u7ebf\u6df7\u5408\u7684\u6750\u8d28\u5c42\u3002\u6211\u4eec\u7684\u5176\u4e2d\u4e00\u4f4d\u6280\u672f\u7f8e\u672f\u5728Epic\u5728\u7740\u8272\u5668\u4e2d\u505a\u5206\u5c42\u7684\u5b9e\u9a8c\uff0c\u5b9e\u73b0\u4e86\u7ed3\u679c\u5f88\u6709\u5e0c\u671b\uff0c\u8fd9\u6210\u4e3a\u4e86\u4e00\u4e2a\u989d\u5916\u7684\u9700\u6c42\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u652f\u6301\u8fd9\u4e2a\u65b9\u5411\uff0c\u6211\u4eec\u77e5\u9053\u6750\u8d28\u7684\u5206\u5c42\u9700\u8981\u7b80\u5355\uff0c\u5e76\u4e14\u9ad8\u6548\u3002\u8fea\u58eb\u5c3c\u7684\u6f14\u8bb2\u6765\u7684\u65f6\u95f4\u5341\u5206\u5b8c\u7f8e[2]\uff0c\u6d89\u53ca\u5230\u4e86\u4ed6\u4eec\u7684\u57fa\u4e8e\u7269\u7406\u7684\u7740\u8272\u548c\u4f7f\u7528Wreck-It Ralph\u7684\u6750\u8d28\u6a21\u578b\u3002Brent Burley \u5c55\u793a\u4e86\u4e00\u4e2a\u975e\u5e38\u5c0f\u7684\u6750\u8d28\u53c2\u6570\u96c6\u5408\u53ef\u4ee5\u8db3\u591f\u7cbe\u81f4\u7684\u8868\u73b0\u79bb\u7ebf\u7279\u6027\u7684\u7535\u5f71\u6e32\u67d3\u3002\u4ed6\u7ae5\u8c23\u5c55\u793a\u4e86\u4e00\u4e2a\u76f8\u5f53\u5b9e\u7528\u7684\u7740\u8272\u6a21\u578b\u53ef\u4ee5\u7d27\u5bc6\u7684\u9002\u7528\u4e8e\u5927\u591a\u6570\u91c7\u6837\u7684\u6750\u8d28\u3002\u4ed6\u4eec\u7684\u5de5\u4f5c\u6210\u4e3a\u4e86\u6211\u4eec\u7684\u4e00\u4e2a\u7075\u611f\u548c\u57fa\u7840\uff0c\u5e76\u4e14\u50cf\u4ed6\u4eec\u7684\u201c\u89c4\u5219\u201d\u76f8\u4f3c\uff0c\u6211\u4eec\u4e5f\u51b3\u5b9a\u53bb\u5b9a\u4e49\u4e00\u4e2a\u6211\u4eec\u81ea\u5df1\u7684\u7cfb\u7edf\u7684\u76ee\u6807\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5b9e\u65f6\u6027\u80fd-Real-Time Performance<\/strong><\/h3>\n\n\n\n<ul><li>\u9996\u8981\u7684\u662f\uff0c\u5b83\u9700\u8981\u5728\u6bcf\u6b21\u8bb8\u591a\u53ef\u89c1\u706f\u5149\u7684\u6761\u4ef6\u4e0b\u9ad8\u6548\u5730\u4f7f\u7528\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7b80\u5316\u590d\u6742\u5ea6-Reduced Complexity<\/strong><\/h3>\n\n\n\n<ul><li>\u53c2\u6570\u5c3d\u53ef\u80fd\u7684\u5c11\u3002\u5927\u6279\u7684\u53c2\u6570\u4e0d\u4ec5\u4f1a\u5bfc\u81f4\u5f88\u96be\u6765\u505a\u4e00\u4e2a\u51b3\u5b9a\uff0c\u9700\u8981\u53cd\u590d\u8bd5\u9a8c\u548c\u8bd5\u9519\uff0c\u6216\u8005\u76f8\u4e92\u5173\u8054\u7684\u5c5e\u6027\u5bf9\u4e8e\u4e00\u4e2a\u9884\u671f\u6548\u679c\u9700\u8981\u8bb8\u591a\u7684\u503c\u6765\u6539\u53d8\u3002<\/li><li>\u6211\u4eec\u9700\u8981\u80fd\u591f\u4f7f\u7528\u57fa\u4e8e\u56fe\u50cf\u7684\u5149\u7167\uff08IBL\uff09\u548c\u4ea4\u4e92\u5f0f\u5730\u53ef\u5206\u6790\u5149\u6e90\uff0c\u6240\u4ee5\u53c2\u6570\u5fc5\u987b\u5728\u591a\u6709\u7684\u5149\u7167\u7c7b\u578b\u4e2d\u8868\u73b0\u4e00\u81f4\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u76f4\u89c2\u7684\u754c\u9762-Intuitive Interface<\/strong><\/h3>\n\n\n\n<ul><li>\u6211\u4eec\u66f4\u503e\u5411\u6613\u4e8e\u7406\u89e3\u7684\u503c\uff0c\u800c\u4e0d\u662f\u50cf\u6298\u5c04\u7387\uff08index of refraction\uff09\u8fd9\u6837\u7684\u7269\u7406\u53c2\u6570\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u611f\u77e5\u7ebf\u6027-Perceptually Linear<\/strong><\/h3>\n\n\n\n<ul><li>\u6211\u4eec\u5e0c\u671b\u901a\u8fc7\u8499\u7248\u652f\u6301\u5206\u5c42\uff0c\u4f46\u662f\u6211\u4eec\u53ea\u80fd\u627f\u53d7\u9010\u50cf\u7d20\u4e00\u6b21\u7740\u8272\u7684\u8d1f\u62c5\u3002\u8fd9\u610f\u5473\u7740\u6df7\u5408\u53c2\u6570\u7740\u8272\u5fc5\u987b\u5c3d\u53ef\u80fd\u7684\u5339\u914d\u7740\u8272\u7ed3\u679c\u7684\u6df7\u5408\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7b80\u5355\u638c\u63e1-Easy to Master<\/strong><\/h3>\n\n\n\n<ul><li>\u6211\u4eec\u60f3\u8981\u907f\u514d\u9700\u8981\u7535\u4ecb\u8d28\u548c\u5bfc\u4f53\u7684\u6280\u672f\u7406\u89e3\uff0c\u540c\u65f6\u6700\u5c0f\u5316\u521b\u5efa\u57fa\u672c\u7684\u8c8c\u4f3c\u7269\u7406\u7684\u6750\u8d28\u6240\u9700\u8981\u7684\u52aa\u529b\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5065\u58ee-Robust<\/strong><\/h3>\n\n\n\n<ul><li>\u9519\u8bef\u7684\u521b\u5efa\u7269\u7406\u4e0a\u4e0d\u53ef\u4fe1\u7684\u6750\u8d28\u5f88\u56f0\u96be\u3002<\/li><li>\u6240\u6709\u53c2\u6570\u7684\u7ed3\u5408\u7684\u5e94\u8be5\u5c3d\u53ef\u80fd\u7684\u5065\u58ee\u548c\u53ef\u4fe1\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5177\u6709\u8868\u73b0\u529b-Expressive<\/strong><\/h3>\n\n\n\n<ul><li>\u5ef6\u8fdf\u6e32\u67d3\u9650\u5236\u4e86\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u7684\u7740\u8272\u6a21\u578b\u7684\u6570\u91cf\uff0c\u6240\u4ee5\u6211\u4eec\u7684\u57fa\u672c\u7740\u8272\u6a21\u578b\u9700\u8981\u8db3\u591f\u63cf\u8ff0\u8986\u76d6\u73b0\u5b9e\u4e16\u754c\u4e2d99%\u7684\u6750\u8d28\u3002<\/li><li>\u4e3a\u4e86\u80fd\u591f\u6df7\u5408\u6240\u6709\u53ef\u5206\u5c42\u7684\u6750\u8d28\uff0c\u6240\u4ee5\uff0c\u4ed6\u4eec\u4e4b\u95f4\u9700\u8981\u5171\u4eab\u76f8\u540c\u7684\u53c2\u6570\u96c6\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7075\u6d3b-Flexible<\/strong><\/h3>\n\n\n\n<ul><li>\u5176\u4ed6\u7684\u9879\u76ee\u6216\u8005\u88ab\u6388\u6743\u5f00\u53d1\u7684\u9879\u76ee\uff0c\u53ef\u80fd\u4e0d\u662f\u4ee5\u7167\u7247\u7ea7\u771f\u5b9e\u6e32\u67d3\u4e3a\u76ee\u6807\uff0c\u6240\u4ee5\u4e5f\u9700\u8981\u8db3\u591f\u7075\u6d3b\u6765\u5141\u8bb8\u975e\u771f\u5b9e\u611f\u6e32\u67d3\u3002<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001<strong>\u7740\u8272\u6a21\u578b-<\/strong>Shading Model<\/h2>\n\n\n\n<p><strong>2.1\u3001\u6f2b\u53cd\u5c04\u53cc\u5411\u53cd\u5c04\u5206\u5e03\u51fd\u6570-Diffuse BRDF<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u8bc4\u4f30\u4e86Burley\u7684\u6f2b\u53cd\u5c04\u6a21\u578b\uff0c\u4f46\u662f\u53ea\u89c2\u5bdf\u5230\u4e0eLambertain\u6a21\u578b\u76f8\u6bd4\u8f7b\u5fae\u7684\u5dee\u522b\uff08\u7b49\u5f0f1\uff09\uff0c\u6240\u4ee5\u6211\u4eec\u4e0d\u80fd\u5224\u65ad\u989d\u5916\u7684\u5f00\u9500\u7684\u5408\u7406\u6027\u548c\u5fc5\u8981\u6027\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u4efb\u4f55\u66f4\u590d\u6742\u7684\u6f2b\u53cd\u5c04\u6a21\u578b\u5f88\u96be\u9ad8\u6548\u7684\u4f7f\u7528\u57fa\u4e8e\u56fe\u50cf\u6216\u7403\u9762\u8c10\u8c03\u7684\u5149\u7167\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u4e0d\u5728\u8bc4\u4f30\u5176\u4ed6\u9009\u62e9\u4e0a\u6295\u5165\u7cbe\u529b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-3129685a628fe3a0c4c3de663adf01f3_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u8fd9\u91ccCdiff\u662f\u6750\u8d28\u7684\u6f2b\u53cd\u5c04\u7387\uff08diffuse albedo\uff09\u3002<\/p>\n\n\n\n<p>UE4.21\u7684\u5f53\u524d\u5b9e\u73b0\uff0c\u8bf7\u53c2\u8003BRFD.usf\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>float3 Diffuse_Lambert( float3 DiffuseColor ) { \n\treturn DiffuseColor * (1 \/ PI); \n}\n<\/code><\/pre>\n\n\n\n<p><strong>2.2\u3001\u5fae\u8868\u9762\u955c\u9762\u53cd\u5c04\u53cc\u5411\u53cd\u5c04\u5206\u5e03\u51fd\u6570-Microfacet Specular BRDF<\/strong><\/p>\n\n\n\n<p>\u5e38\u89c4\u7684Cook-Torrance[5,6]\u5fae\u8868\u9762\u955c\u9762\u53cd\u5c04\u7740\u8272\u6a21\u578b\u662f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-01a4328a05c136955f79c81f2a1d9746_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u8bf7\u67e5\u9605[9]\u6765\u83b7\u53d6\u66f4\u591a\u6269\u5c55\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u4ece\u8fea\u58eb\u5c3c\u4f7f\u7528\u7684\u6a21\u578b\u5f00\u59cb\uff0c\u5728\u4e0e\u5176\u4ed6\u66f4\u9ad8\u6548\u7684\u5b9e\u73b0\u65b9\u5f0f\u5bf9\u6bd4\u7684\u60c5\u51b5\u4e0b\uff0c\u8bc4\u4f30\u4e86\u516c\u5f0f\u4e2d\u6bcf\u4e00\u9879\u7684\u91cd\u8981\u6027\u3002\u8fd9\u4e2a\u5de5\u4f5c\u8fdc\u6bd4\u542c\u8d77\u6765\u8981\u56f0\u96be\u7684\u591a\uff1b\u5df2\u7ecf\u516c\u5e03\u7684\u516c\u5f0f\u4e2d\u7684\u6bcf\u9879\u8f93\u5165\u4e0d\u4e00\u5b9a\u4f7f\u7528\u4e86\u76f8\u540c\u7684\u53c2\u6570\uff0c\u4f46\u8fd9\u5bf9\u4e8e\u6b63\u786e\u7684\u6bd4\u8f83\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.2.1\u3001\u955c\u9762\u53cd\u5c04D-Specular D<\/strong><\/h3>\n\n\n\n<p>\u5bf9\u4e8e\u6cd5\u7ebf\u5206\u5e03\u51fd\u6570\uff08NDF\uff09\uff0c\u6211\u4eec\u53d1\u73b0\u8fea\u58eb\u5c3c\u9009\u62e9\u7684GGX\/Trowbridge-Reitz\u7684\u6210\u672c\u662f\u503c\u5f97\u7684\u3002\u76f8\u6bd4\u4e8eBlinn-Phong\u7684\u516c\u5f0f\uff0c\u989d\u5916\u7684\u6d88\u8017\u76f8\u5f53\u7684\u5c0f\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u66f4\u597d\u7684\u201c\u957f\u5c3e\u6548\u679c\u201d\uff0c\u8fd9\u4e2a\u957f\u5c3e\u6548\u679c\u7684\u8868\u73b0\u5438\u5f15\u4e86\u6211\u4eec\u7684\u827a\u672f\u5bb6\u3002\u6211\u4eec\u4e5f\u91c7\u7528\u4e86\u8fea\u58eb\u5c3c\u91cd\u65b0\u5b9a\u4e49\u7684\u53c2\u6570\u03b1=Roughness^2\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-c7d56692dace3d01beffa04a0b30951e_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u8bd1\u8005\u6ce8\uff1a<strong>\u6cd5\u7ebf\u5206\u5e03\u51fd\u6570D(Normal Distribution Function)<\/strong>\uff1a\u6216\u8005\u8bf4\u955c\u9762\u5206\u5e03\uff0c\u4ece\u7edf\u8ba1\u5b66\u4e0a\u8fd1\u4f3c\u7684\u8868\u793a\u4e86\u4e0e\u5411\u91cfh\u53d6\u5411\u4e00\u81f4\u7684\u5fae\u5e73\u9762\u7684\u6bd4\u7387\u3002<br>\u4e3e\u4f8b\u6765\u8bf4\uff0c\u5047\u8bbe\u7ed9\u5b9a\u4e00\u4e2a\u5411\u91cfv\uff0c\u5982\u679c\u6211\u4eec\u7684\u5fae\u5e73\u9762\u4e2d\u670935%\u4e0e\u5411\u91cfv\u53d6\u5411\u4e00\u81f4\uff0c\u5219\u6b63\u6001\u5206\u5e03\u51fd\u6570\u6216\u8005\u8bf4NDF\u5c06\u4f1a\u8fd4\u56de0.35\u3002<br>\u6211\u4eec\u6765\u589e\u52a0\u4e00\u4e2a\u9488\u5bf9NDF\u5728\u957f\u5c3e\u6548\u679c\u65b9\u9762\u7684\u5c55\u793a\u548c\u5bf9\u6bd4\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-df0ee88371609e0cd1d0da94c79b7c4c_720w.jpg\" alt=\"\"\/><figcaption>\u6ce8\uff1a\u4e3b\u6d41NDF\u51fd\u6570\u9ad8\u5149\u957f\u5c3e\u6548\u679c\u7684\u5bf9\u6bd4\uff0cGGX\u62e5\u6709\u6700\u597d\u7684\u957f\u5c3e\u8868\u73b0\u3002<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>UE4.21\u4e2d\u7684\u4ee3\u7801\u5b9e\u73b0\uff1a<em>\u4ece\u4ee3\u7801\u4e2d\u770b\uff0c\u8ddfD(h)\u7684\u5b9e\u73b0\u662f\u5b8c\u5168\u4e00\u81f4\u7684\u3002<\/em><\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>float D_GGX( float Roughness, float NoH )\n{\n\tfloat a = Roughness * Roughness;\n\tfloat a2 = a * a;\n\tfloat d = ( NoH * a2 - NoH ) * NoH + 1;\t\/\/ 2 mad\n\treturn a2 \/ ( PI*d*d );\t\t\t\/\/ 4 mul, 1 rcp\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u5728UE4\u4e2d\uff0c\u6709\u53e6\u5916\u4e00\u4e2a\u5173\u4e8e\u5404\u9879\u5f02\u6027\u7684GGX\u5b9e\u73b0\uff0c\u4e3b\u8981\u7684\u5b9e\u73b0\u601d\u8def\u662f\u5728X\u8f74\u3001Y\u8f74\u4e24\u4e2a\u65b9\u5411\u4e0a\u5206\u522b\u8fdb\u884c\u8ba1\u7b97roughness\u3002<strong>Anisotropic GGX, Burley 2012, &#8220;Physically-Based Shading at Disney&#8221;<\/strong><\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>float D_GGXaniso( float RoughnessX, float RoughnessY, float NoH, float3 H, float3 X, float3 Y )\n{\n\tfloat ax = RoughnessX * RoughnessX;\n\tfloat ay = RoughnessY * RoughnessY;\n\tfloat XoH = dot( X, H );\n\tfloat YoH = dot( Y, H );\n\tfloat d = XoH*XoH \/ (ax*ax) + YoH*YoH \/ (ay*ay) + NoH*NoH;\n\treturn 1 \/ ( PI * ax*ay * d*d );\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.2.2\u3001\u955c\u9762\u53cd\u5c04G-Specular G<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.zhihu.com\/equation?tex=%5Cfrac%7BRoughness%2B1%7D%7B2%7D\" alt=\"[\u516c\u5f0f]\"\/><\/figure>\n\n\n\n<p>\u6211\u4eec\u8bc4\u4f30\u4e86\u955c\u9762\u51e0\u4f55\u8870\u51cf\u9879\u7684\u591a\u79cd\u9009\u62e9\u3002 \u5230\u6700\u540e\uff0c\u6211\u4eec\u9009\u62e9\u4f7f\u7528Schlick\u6a21\u578b[19]\uff0c\u4f46k =\u03b1\/ 2\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u62df\u5408Smith\u6a21\u578bGGX [21]\u3002 \u901a\u8fc7\u8fd9\u79cd\u4fee\u6539\uff0cSchlick\u6a21\u578b\u4e0e\u03b1= 1\u7684Smith\u5b8c\u5168\u5339\u914d\uff0c\u5e76\u4e14\u76f8\u5f53[0\uff0c1]\u8303\u56f4\u5185\u7684\u8fd1\u4f3c\u903c\u8fd1\uff08\u5982\u56fe2\u6240\u793a\uff09\u3002 \u6211\u4eec\u8fd8\u9009\u62e9\u4f7f\u7528\u8fea\u58eb\u5c3c\u7684\u4fee\u6539\u901a\u8fc7\u5728\u5e73\u65b9\u4e4b\u524d\u4f7f\u7528&nbsp;&nbsp;\u91cd\u65b0\u6620\u5c04\u7c97\u7cd9\u5ea6\u4ee5\u51cf\u5c11\u201c\u70ed\u5ea6hotness\u201d\u3002 \u8bf7\u52a1\u5fc5\u6ce8\u610f\u8be5\u8c03\u6574\u4ec5\u7528\u4e8e\u5149\u6e90\u8ba1\u7b97\uff1b\u5982\u679c\u5e94\u7528\u4e8e\u57fa\u4e8e\u56fe\u50cf\u7684\u7167\u660e\uff08IBL\uff09\uff0c\u5219\u5728\u63a0\u5c04\u89d2\u5ea6\u90e8\u5206\u7684\u989c\u8272\u592a\u6697\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-1cf3733209506de97af2c58d5b8dd5ef_720w.jpg\" alt=\"\"\/><figcaption>\u56fe2\uff1a\u4f7f\u7528k=\u03b1\/2\u7684Schlick\u975e\u5e38\u63a5\u8fd1Smith\u5339\u914d<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-9775ee33691cb0a42e6c80cf1c1d0e75_720w.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><strong>\u6ce8\uff1a<\/strong>\u5728\u57fa\u4e8e\u7269\u7406\u7684\u6e32\u67d3\u4e2d\uff0c\u51e0\u4f55\u51fd\u6570\uff08Geometry Function\uff09\u662f\u4e00\u4e2a0\u52301\u4e4b\u95f4\u7684\u6807\u91cf\uff0c\u63cf\u8ff0\u4e86\u5fae\u5e73\u9762\u81ea\u9634\u5f71\u7684\u5c5e\u6027\uff0c\u8868\u793a\u4e86\u5177\u6709\u534a\u77e2\u91cf\u6cd5\u7ebf\u7684\u5fae\u5e73\u9762\uff08microfacet\uff09\u4e2d\uff0c\u540c\u65f6\u88ab\u5165\u5c04\u65b9\u5411\u548c\u53cd\u5c04\u65b9\u5411\u53ef\u89c1\uff08\u6ca1\u6709\u88ab\u906e\u6321\u7684\uff09\u7684\u6bd4\u4f8b\uff0c\u5373\u672a\u88ab\u906e\u6321\u7684m= h\u5fae\u8868\u9762\u7684\u767e\u5206\u6bd4\u3002\u51e0\u4f55\u51fd\u6570\uff08Geometry Function\uff09\u5373\u662f\u5bf9\u80fd\u987a\u5229\u5b8c\u6210\u5bf9\u5149\u7ebf\u7684\u5165\u5c04\u548c\u51fa\u5c04\u4ea4\u4e92\u7684\u5fae\u5e73\u9762\u6982\u7387\u8fdb\u884c\u5efa\u6a21\u7684\u51fd\u6570\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-28371cce17d9dfa10175690e6064a7ef_720w.jpg\" alt=\"\"\/><figcaption>\u6ce8\uff1a\u51e0\u4f55\u51fd\u6570G(x)\u7684\u5149\u5b66\u6db5\u4e49<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-b863e241e49fc5a1fe68325c9bc35178_720w.jpg\" alt=\"\"\/><figcaption>\u6ce8\uff1a\u767d\u8272\u8868\u793a\u6ca1\u6709\u5fae\u5e73\u9762\u7684\u9634\u5f71\uff0c\u9ed1\u8272\u8868\u793a\u5fae\u5e73\u9762\u5f7b\u5e95\u88ab\u906e\u853d<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.zhihu.com\/equation?tex=4%28n%5Ccirc+l%29%28n%5Ccirc+v%29\" alt=\"[\u516c\u5f0f]\"\/><\/figure>\n\n\n\n<p>\u5728UE4\u8001\u7684\u5b9e\u73b0\u4ee3\u7801\u4e2d\uff0cUE4\u5c06G(l,v)\u9879\u548c&nbsp;&nbsp;\u5408\u5e76\u4e3aVis(l, v)\uff0cSchlick\u6a21\u578b\u7684\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>float Vis_Schlick( float Roughness, float NoV, float NoL )\n{\n\tfloat k = Square( Roughness ) * 0.5;\n\tfloat Vis_SchlickV = NoV * (1 - k) + k;\n\tfloat Vis_SchlickL = NoL * (1 - k) + k;\n\treturn 0.25 \/ ( Vis_SchlickV * Vis_SchlickL );\n}\n<\/code><\/pre>\n\n\n\n<p>\u4f46\u662f\uff0c\u5728UE4.21\u7684\u4ee3\u7801\u4e2d\uff0c\u5b9e\u9645\u7684\u5b9e\u73b0\u4ee3\u7801\u53c8\u53d1\u751f\u4e86\u6539\u53d8\u3002\u5982\u4e0b\u6240\u793a\u3002\u4f3c\u4e4e\u662f\u53c8\u671d\u7740Smith\u7684\u5b9e\u73b0\u53bb\u8fdb\u884c\u4e86\u8c03\u6574\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Tuned to match behavior of Vis_Smith\nfloat Vis_Schlick( float a2, float NoV, float NoL )\n{\n\tfloat k = sqrt(a2) * 0.5;\n\tfloat Vis_SchlickV = NoV * (1 - k) + k;\n\tfloat Vis_SchlickL = NoL * (1 - k) + k;\n\treturn 0.25 \/ ( Vis_SchlickV * Vis_SchlickL );\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.2.3\u3001\u955c\u9762\u53cd\u5c04F-Specular F<\/strong><\/h3>\n\n\n\n<p>\u5bf9\u4e8e\u83f2\u6d85\u5c14\uff0c\u6211\u4eec\u505a\u51fa\u4f7f\u7528Schlick\u8fd1\u4f3c\u7684\u7ecf\u5178\u9009\u62e9 [19]\uff0c\u4f46\u662f\u6709\u4e00\u70b9\u4fee\u6539\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u7403\u9762\u9ad8\u65afSpherical Gaussian\u8fd1\u4f3c[10]\u6765\u4ee3\u66ffpower\u8ba1\u7b97\u3002\u8fd9\u7a0d\u5fae\u63d0\u9ad8\u4e86\u8ba1\u7b97\u6548\u7387\uff0c\u5e76\u4e14\u5dee\u5f02\u5fae\u4e0d\u53ef\u5bdf\uff0c\u516c\u5f0f\u4e3a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-159a7c00ebd7cd4244d01c2963b891a2_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-70155d2cc9026c533cf0aaff8a65de92_720w.png\" alt=\"\"\/><figcaption>Schlick\u8fd1\u4f3c\u7684\u7ecf\u5178\u516c\u5f0f<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u91c7\u7528\u7403\u9762\u9ad8\u65af\u7684\u8fd1\u4f3c\u6765\u4ee3\u66ffPower\u7684\u9009\u62e9\uff0c\u4e3b\u8981\u662f\u8003\u8651\u5728GPU\u4e0a\u8fd0\u7b97\u7684\u6548\u7387\u6765\u8003\u8651\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-c13ba53a87feb4237278609b625f0fd0_720w.jpg\" alt=\"\"\/><figcaption>\u6ce8\uff1aGPU\u6307\u4ee4\u51cf\u5c11\u4e8650%<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-96a2aca899092a8a39e888e0e85084fb_720w.jpg\" alt=\"\"\/><figcaption>\u6ce8\uff1a\u53ef\u4ee5\u770b\u5230\uff0c\u8fd9\u4e2a\u62df\u5408\u51e0\u4e4e\u662f\u5b8c\u7f8e\u7684\u3002<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u4f46\u662f\uff0c\u4eceUE4.21\u7684\u4ee3\u7801\u6765\u770b\uff0c\u4f3c\u4e4e\u5e76\u6ca1\u6709\u91c7\u7528\u8fd9\u4e2a\u7403\u9762\u9ad8\u65af\u8d8b\u8fd1\uff0c\u800c\u662f\u91c7\u7528\u4e86\u4e00\u79cd\u66f4\u9ad8\u6548\u7684\u65b9\u5f0f\u3002\u6309\u7167\u5b9e\u73b0\u5e94\u8be5\u662fFc + (1-Fc) * SpecularColor\uff0c\u4f46\u662f\uff0c\u5728\u7b2c\u4e00\u4e2aFc\u524d\u9762\u589e\u52a0\u4e86\u4e00\u4e2a 50 * SpecularColor.g\uff0c\u4f46\u662f\uff0cFc\u8fd8\u662f\u91c7\u7528\u4e86Pow5\u7684\u5904\u7406\u3002\uff08\u54ea\u4f4d\u670b\u53cb\u4e86\u89e3\u539f\u56e0\uff0c\u53ef\u4ee5\u4e0b\u9762\u8bc4\u8bba\u4e2d\u5e2e\u5fd9\u89e3\u91ca\u4e00\u4e0b\u3002\uff09<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>float3 F_Schlick( float3 SpecularColor, float VoH )\n{\n\tfloat Fc = Pow5( 1 - VoH );\t\t\t\t\t\/\/ 1 sub, 3 mul\n\t\/\/ Anything less than 2% is physically impossible and is instead considered to be shadowing\n\treturn saturate( 50.0 * SpecularColor.g ) * Fc + (1 - Fc) * SpecularColor;\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u8bd1\u8005\u6ce8\uff1a\u4e0b\u9762\u7684\u90e8\u5206\u4ecb\u7ecd\u7684\u5c31\u662fIBL\u4e86\uff0c\u4f46\u662f\uff0c\u4eceBRDF\u7684\u6574\u4f53\u6027\u89d2\u5ea6\u6765\u8bf4\uff0c\u8fd8\u7f3a\u5931\u4e86\u4e00\u4e2a\u73af\u5883\u5149\u7684\u6f2b\u53cd\u5c04\u90e8\u5206\uff0c\u4e3a\u4e86\u8ba9\u8bfb\u8005\u6709\u4e00\u4e2a\u66f4\u5b8c\u6574\u7684\u7406\u89e3\uff0c\u6211\u8fd9\u91cc\u975e\u5e38\u7b80\u5355\u5730\u6765\u4ecb\u7ecd\u4e00\u4e0b\u8fd9\u90e8\u5206\u3002<br>\u6f2b\u53cd\u5c04\u73af\u5883\u5149\u7167\u90e8\u5206\u4e00\u822c\u91c7\u7528\u4f20\u7edfIBL\u4e2d\u8f89\u5ea6\u73af\u5883\u6620\u5c04\uff08Irradiance Environment Mapping\uff09\u6280\u672f\uff0c\u5e76\u4e0d\u662f\u57fa\u4e8e\u7269\u7406\u7684\u7279\u6709\u65b9\u6848\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-8f88fce87d4b729e79c14773f34ebc53_720w.jpg\" alt=\"\"\/><figcaption>\u73af\u5883\u5149\u6f2b\u53cd\u5c04\u90e8\u5206\u7684\u8ba1\u7b97\u516c\u5f0f<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u8fd9\u4e2a\u4e1c\u897f\u662f\u6ca1\u529e\u6cd5\u76f4\u63a5\u4f7f\u7528\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u4f7f\u7528\u8499\u7279\u5361\u6d1b\u79ef\u5206\u7684\u671f\u671b\u6cd5\u6765\u8fdb\u884c\u79ef\u5206\u3002\u5177\u4f53\u63a8\u5bfc\u8fc7\u7a0b\u5982\u4e0b\u6240\u793a\uff1a<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-7d8422eb42869a060ecc3b8758e4c187_720w.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u5728\u5199\u4ee3\u7801\u5b9e\u73b0\u7684\u65f6\u5019\uff0c\u7528\u8499\u7279\u5361\u6d1b\u79ef\u5206\u6c42\u7cfb\u6570\u7684\u8fc7\u7a0b\u5927\u6982\u5c31\u662f\u4e00\u7cfb\u5217\u7684\u76f8\u4e58\u4e0e\u6c42\u548c\uff0c\u4f2a\u4ee3\u7801\uff1a<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>void SH_Coefficients()\n{\n    double weight =4.0 * PI;\n    \/\/\u751f\u6210n\u6761\u5149\u7ebf\u8fdb\u884c\u91c7\u6837\n    for(int i=0; i&lt;n_samples; ++i) \n    {\n        \/\/\u751f\u6210\u5e26\u6296\u52a8\u7684\u65e0\u504f\u91c7\u6837\u65b9\u5411(\u03b8,\u03d5)\n        for(int n=0; n&lt;n_coeff; ++n)\n        {\n        \/\/\u5bf9\u4e8e\u67d0\u4e00\u4e2alight probe\uff0c\u5b83\u7684\u6bcf\u4e2a\u7403\u8c10\u5c55\u5f00\u7cfb\u6570c_i\u5c31\u8981\u7d2f\u52a0\u8d77\u6240\u6709\u7684\u3010\u67d0\u65b9\u5411\u4e0a\u7684irradiance * \u8fd9\u4e2a\u65b9\u5411\u4e0aSH\u51fd\u6570\u503c\u3011\n        result[n] += light(\u03b8,\u03d5)* samples[i].SH_basis_coeff[n];\n        }\n    }\n    \/\/ \u628a\u8499\u7279\u5361\u6d1b\u79ef\u5206\u7684\u5e38\u6570\u9879\u4e58\u4e0a\u53bb\uff08\u6052\u5b9a\u7684\u91c7\u6837\u6743\u91cd\uff0c\u603b\u91c7\u6837\u6570\uff09\n    double factor = weight \/ n_samples;\n    for(i=0; i&lt;n_coeff; ++i)\n    {\n        result[i] = result[i] * factor;\n    }\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u4e0a\u9762\u7684result[i]\u5c31\u662f\u67d0\u4e2a\u70b9\u4e0a\u5149\u7167\u5206\u5e03\u7684\u7403\u9762\u51fd\u6570\u7ecf\u8fc7\u201d\u7f16\u7801\u201d\u4e4b\u540e\u5f97\u5230\u7684\u7403\u8c10\u7cfb\u6570\u3002\u6211\u4eec\u53ef\u4ee5\u7528\u79bb\u7ebf\u9884\u8ba1\u7b97\u7684\u7cfb\u6570\uff0c\u5728runtime\u901a\u8fc7\u6548\u7387\u6bd4\u8f83\u9ad8\u7684\u65b9\u5f0f\u8fd1\u4f3c\u91cd\u6784\u51fa\u539f\u6765\u7684\u5149\u7167\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-8984da62fa2e0dbdb1cd5b707b3f4f8c_720w.jpg\" alt=\"\"\/><figcaption>\u901a\u8fc7\u4e0a\u9762\u7684\u4f2a\u4ee3\u7801\uff0c\u5c06\u5de6\u8fb9\u7684\u73af\u5883\u8d34\u56fe\uff0c\u8ba1\u7b97\u6210\u8f89\u5ea6\u73af\u5883\u6620\u5c04\uff0c\u4ece\u800c\u7528\u4e8e\u8fd0\u884c\u65f6\u523b\u7684\u8fd0\u7b97<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2.2.4\u3001\u57fa\u4e8e\u56fe\u50cf\u7684\u5149\u7167-Image-Based Lighting<\/strong><\/h2>\n\n\n\n<p>\u4e3a\u4e86\u5728\u57fa\u4e8e\u56fe\u50cf\u7684\u5149\u7167\u4f7f\u7528\u8fd9\u4e2a\u7740\u8272\u6a21\u578b\uff0c\u9700\u8981\u89e3\u51b3\u8f90\u5c04\u7387\u79ef\u5206\uff0c\u8fd9\u901a\u5e38\u4f7f\u7528\u91cd\u8981\u6027\u91c7\u6837\u6765\u5b8c\u6210\u3002\uff08\u6ce8\uff1a\u5173\u4e8e\u8f90\u5c04\u5ea6\u8fd9\u90e8\u5206\u5185\u5bb9\u76f8\u5f53\u4e30\u5bcc\u548c\u590d\u6742\uff0c\u8fd9\u91cc\u5c31\u4e0d\u89e3\u91ca\u4e86\u3002\u8bfb\u8005\u53ef\u4ee5\u53bb\u67e5\u627e\u8f90\u5c04\u5ea6\u7684\u76f8\u5173\u6587\u7ae0\u3002\uff09\u4e0b\u9762\u7684\u7b49\u5f0f\u63cf\u8ff0\u4e86\u8fd9\u4e2a\u6570\u503c\u79ef\u5206\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-0fe70e5b212b0c35cf971653edaa93bb_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><strong>\u91cd\u8981\u6027\u91c7\u6837<\/strong>\uff08Importance Sample\uff09\u5373\u901a\u8fc7\u73b0\u6709\u7684\u4e00\u4e9b\u5df2\u77e5\u6761\u4ef6\uff08\u5206\u5e03\u51fd\u6570\uff09\uff0c\u60f3\u529e\u6cd5\u96c6\u4e2d\u4e8e\u88ab\u79ef\u51fd\u6570\u5206\u5e03\u53ef\u80fd\u6027\u8f83\u9ad8\u7684\u533a\u57df(\u91cd\u8981\u7684\u533a\u57df)\u8fdb\u884c\u91c7\u6837\uff0c\u8fdb\u800c\u53ef\u9ad8\u6548\u5730\u8ba1\u7b97\u51c6\u786e\u7684\u4f30\u7b97\u7ed3\u679c\u7684\u7684\u4e00\u79cd\u7b56\u7565\u3002<\/p><\/blockquote>\n\n\n\n<p>\u4e0b\u9762\u7684HLSL\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u5728\u6211\u4eec\u7684\u7740\u8272\u6a21\u578b\u4e2d\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\uff08\u4ee5\u4e0b\u4e0e\u539f\u6587\u7565\u4e0d\u4e00\u81f4\uff0c\u4f7f\u7528\u4e864.21\u7684\u4ee3\u7801\u66ff\u6362\uff09<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>float4 ImportanceSampleGGX( float2 E, float Roughness )\n{\n    float m = Roughness * Roughness;\n    float m2 = m * m;\n\n    float Phi = 2 * PI * E.x;\n    float CosTheta = sqrt( (1 - E.y) \/ ( 1 + (m2 - 1) * E.y ) );\n    float SinTheta = sqrt( 1 - CosTheta * CosTheta );\n\n    float3 H;\n    H.x = SinTheta * cos( Phi );\n    H.y = SinTheta * sin( Phi );\n    H.z = CosTheta;\n    \n    float d = ( CosTheta * m2 - CosTheta ) * CosTheta + 1;\n    float D = m2 \/ ( PI*d*d );\n    float PDF = D * CosTheta;\n\n    return float4( H, PDF );\n}\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>float4 ImportanceSampleGGX( float2 E, float Roughness )\n{\n    float m = Roughness * Roughness;\n    float m2 = m * m;\n\n    float Phi = 2 * PI * E.x;\n    float CosTheta = sqrt( (1 - E.y) \/ ( 1 + (m2 - 1) * E.y ) );\n    float SinTheta = sqrt( 1 - CosTheta * CosTheta );\n\n    float3 H;\n    H.x = SinTheta * cos( Phi );\n    H.y = SinTheta * sin( Phi );\n    H.z = CosTheta;\n    \n    float d = ( CosTheta * m2 - CosTheta ) * CosTheta + 1;\n    float D = m2 \/ ( PI*d*d );\n    float PDF = D * CosTheta;\n\n    return float4( H, PDF );\n}\n<\/code><\/pre>\n\n\n\n<p>\u5373\u4f7f\u6709\u91cd\u8981\u6027\u91c7\u6837\uff0c\u8bb8\u591a\u7684\u6837\u672c\u4ecd\u7136\u9700\u8981\u88ab\u91c7\u96c6\u3002\u6837\u672c\u6570\u91cf\u53ef\u4ee5\u901a\u8fc7mip maps\u663e\u8457\u7684\u51cf\u5c11\uff0c\u4f46\u662f\u6570\u91cf\u4ecd\u7136\u9700\u8981\u5927\u4e8e16\u4ee5\u6ee1\u8db3\u8db3\u591f\u7684\u6570\u91cf\uff08\u6ce8\uff1a\u539f\u65871024\u6b21\u91c7\u6837\uff0c4.20\u4e3a32\u6b21\u91c7\u6837\uff09\u3002\u56e0\u4e3a\u6211\u4eec\u4e3a\u4e86\u83b7\u5f97\u5c40\u90e8\u7684\u53cd\u5c04\u4fe1\u606f\uff0c\u9700\u8981\u5728\u8bb8\u591a\u5f20\u73af\u5883\u8d34\u56fe\u4e2d\u8fdb\u884c\u9010\u50cf\u7d20\u7684\u6df7\u5408\uff0c\u6211\u4eec\u5b9e\u8df5\u4e2d\u53ea\u80fd\u652f\u6301\u9488\u5bf9\u6bcf\u5f20\u8d34\u56fe\u8fdb\u884c\u4e00\u6b21\u6837\u672c\u91c7\u6837\u3002\uff08\u6ce8\uff1a\u539f\u6587\u5728\u8fd9\u91cc\u5199\u5f97\u5e76\u4e0d\u6e05\u695a\uff0c\u5176\u5b9e\uff0c\u60f3\u8868\u8fbe\u7684\u610f\u601d\u662f\u8bf4\uff1a\u6240\u4ee5\u5462\uff0c\u54b1\u4eec\u8fd8\u5f97\u60f3\u5176\u4ed6\u529e\u6cd5\u3002\uff09<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.2.4.1\u3001\u5206\u89e3\u6c42\u548c\u8fd1\u4f3c-Split Sum Approximation<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.zhihu.com\/equation?tex=L_%7Bi%7D%28l%29\" alt=\"[\u516c\u5f0f]\"\/><\/figure>\n\n\n\n<p>\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u4e2a\uff0c\u6211\u4eec\u901a\u8fc7\u5c06\u4e0a\u9762\u7684\u516c\u5f0f6\u5206\u89e3\u6210\u4e3a\u4e24\u4e2a\u6c42\u548c\u90e8\u5206\u6765\u8fd1\u4f3c\u6c42\u89e3\u3002\u6bcf\u4e00\u4e2a\u5206\u79bb\u51fa\u6765\u7684\u6c42\u548c\u516c\u5f0f\u53ef\u4ee5\u88ab\u8fdb\u884c\u63d0\u524d\u7684\u9884\u8ba1\u7b97\u3002\u5bf9\u4e8e\u4e00\u4e2a\u5e38\u6570&nbsp;\u8fd9\u4e2a\u8fd1\u4f3c\u662f\u51c6\u786e\u7684\uff0c\u5e76\u4e14\u5bf9\u4e8e\u5e38\u89c4\u7684\u73af\u5883\u6765\u8bf4\uff0c\u6b64\u516c\u5f0f\u4e5f\u76f8\u5f53\u7684\u7cbe\u786e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-fd9199ee5c26d29b70c76362d6047a83_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.2.4.2\u3001\u9884\u79ef\u5206\u73af\u5883\u8d34\u56fe-Pre-Filtered Environment Map<\/strong><\/h3>\n\n\n\n<p>\u6211\u4eec\u5bf9\u4e8e\u4e0d\u540c\u7684\u7c97\u7cd9\u5ea6\u503c\uff0c\u9884\u8ba1\u7b97\u7b2c\u4e00\u4e2a\u6c42\u548c\u9879\u5e76\u4e14\u5c06\u7ed3\u679c\u4fdd\u5b58\u5728CubeMap\u7684mip-map\u5c42\u7ea7\u4e2d\u3002\u8fd9\u662f\u5728\u6e38\u620f\u5de5\u4e1a\u4f7f\u7528\u7684\u5178\u578b\u65b9\u5f0f[1,9]\u3002\u4e00\u4e2a\u8f83\u5c0f\u7684\u533a\u522b\u662f\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u91cd\u8981\u6027\u91c7\u6837\u548c\u6211\u4eec\u7684\u7740\u8272\u6a21\u578b\u4e2d\u7684GGX\u5206\u5e03\u5bf9\u73af\u5883\u8d34\u56fe\u505a\u4e86\u5377\u79ef\u8ba1\u7b97\u3002<\/p>\n\n\n\n<p>\u56e0\u4e3a\u8fd9\u662f\u5fae\u8868\u9762\u6a21\u578b\uff0c\u5206\u5e03\u7684\u5f62\u72b6\u6539\u53d8\u4f9d\u8d56\u4e8e\u5230\u8868\u9762\u4e0a\u7684\u89c2\u5bdf\u89d2\u5ea6\uff0c\u6240\u4ee5<strong>\u6211\u4eec\u5047\u8bbe\u8fd9\u4e2a\u89d2\u5ea6\u662f0<\/strong>\uff0c\u4f8b\u5982\uff0cn=v=r\u3002<\/p>\n\n\n\n<p><strong>\u5404\u5411\u540c\u6027\u7684\u5047\u8bbe<\/strong>\u662f\u8fd1\u4f3c\u7684\u7b2c\u4e8c\u4e2a\u6765\u6e90\uff0c\u5e76\u4e14\u5b83\u4e0d\u5e78\u5730\u610f\u5473\u7740\u6211\u4eec\u4e0d\u4f1a\u5728\u63a0\u5c04\u89d2\u83b7\u5f97\u6f2b\u957f\u7684\u53cd\u5c04\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.zhihu.com\/equation?tex=cos%CE%B8_%7Blk%7D\" alt=\"[\u516c\u5f0f]\"\/><\/figure>\n\n\n\n<p>\u6bd4\u8d77\u5206\u79bb\u7684\u548c\u8fd1\u4f3c\uff0c\u5b9e\u9645\u4e0a\u8fd9\u662f\u6211\u4eecIBL\u89e3\u51b3\u65b9\u6848\u4e2d\u66f4\u5927\u7684\u9519\u8bef\u6765\u6e90\u3002\u6b63\u5982\u4e0b\u9762\u4ee3\u7801\u5c55\u793a\u7684\uff0c\u6211\u4eec\u5df2\u7ecf\u53d1\u73b0\u4f7f\u7528&nbsp;&nbsp;\u53ef\u4ee5\u5b9e\u73b0\u66f4\u4f73\u7684\u7ed3\u679c\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u7684\u4ee3\u7801\uff0c\u9009\u81eaUE4.21\u7248\u672c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>float3 PrefilterEnvMap( uint2 Random, float Roughness, float3 R )\n{\n\tfloat3 FilteredColor = 0;\n\tfloat Weight = 0;\n\t\t\n\tconst uint NumSamples = 64;\n\tfor( uint i = 0; i &lt; NumSamples; i++ )\n\t{\n\t\tfloat2 E = Hammersley( i, NumSamples, Random );\n\t\tfloat3 H = TangentToWorld( ImportanceSampleGGX( E, Pow4(Roughness) ).xyz, R );\n\t\tfloat3 L = 2 * dot( R, H ) * H - R;\n\n\t\tfloat NoL = saturate( dot( R, L ) );\n\t\tif( NoL > 0 )\n\t\t{\n\t\t\tFilteredColor += AmbientCubemap.SampleLevel( AmbientCubemapSampler, L, 0 ).rgb * NoL;\n\t\t\tWeight += NoL;\n\t\t}\n\t}\n\n\treturn FilteredColor \/ max( Weight, 0.001 );\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u8bd1\u8005\u6ce8\uff1a\u4ece\u4ee3\u7801\u4e0a\u770b\uff0c\u4e24\u4e2a\u4ee3\u7801\u4e3b\u8981\u6709\u4e24\u4e2a\u53d8\u5316\uff0c\u4e00\u4e2a\u662f\u5728\u539f\u6765\u7684\u4ee3\u7801\u4e2d\u8fdb\u884c\u4e861024\u6b21\u91c7\u6837\uff0c\u800c\u6700\u65b0\u7684\u4ee3\u7801\u4e2d\uff0c\u53ea\u8fdb\u884c\u4e8664\u6b21\u91c7\u6837\uff1b\u7b2c\u4e8c\u4e2a\u53d8\u5316\uff0c\u9488\u5bf9\u6700\u540e\u8fdb\u884c\u7684\u9664\u6cd5\u8fdb\u884c\u4e86\u4e00\u4e2a\u4fdd\u62a4\uff0c\u4f7f\u7528max( Weight, 0.001 )\u66ff\u4ee3\u4e86\u539f\u6765\u7684Weight\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-6c60c9acbe3fc5010df0ad119c2e696f_720w.jpg\" alt=\"\"\/><figcaption>\u9884\u79ef\u5206\u73af\u5883\u8d34\u56fe<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u4e0a\u56fe\u4e2d\u7684\u9884\u79ef\u5206\u73af\u5883\u8d34\u56fe\uff0c\u662f\u901a\u8fc7PrefilterEvnMap\u6765\u8fdb\u884c\u79bb\u7ebf\u8ba1\u7b97\u5e76\u751f\u6210\u7684\u3002\u56e0\u4e3a\u5b83\u662f\u79bb\u7ebf\u6e32\u67d3\u7684\uff0c\u6240\u4ee5\uff0c\u4f7f\u75281024\u6b21\u91c7\u6837\uff0c\u8fd8\u662f64\u6b21\u91c7\u6837\uff0c\u57fa\u672c\u4e0a\u6ca1\u4ec0\u4e48\u592a\u5927\u7684\u5dee\u8ddd\u3002\u81f3\u4e8e\u4e3a\u4ec0\u4e48UE\u7684\u6700\u65b0\u4ee3\u7801\uff0c\u964d\u4f4e\u4e86\u5927\u91cf\u7684\u91c7\u6837\uff0c\u6211\u5c31\u4e0d\u5f97\u800c\u77e5\u4e86\u3002<br>\u5728\u8fd9\u4e2a\u8f93\u5165\u7684\u53c2\u6570\u4e2d\uff0c\u6709\u4e00\u4e2aRoughness\u7684\u53c2\u6570\uff0c\u8fd9\u4e2a\u5c31\u662f\u4e3a\u4ec0\u4e48\u4f1a\u4f7f\u75285\u7ea7\u7684mipmap\u7684\u539f\u56e0\u3002\u6bd5\u7adf\u9488\u5bf9\u4e0d\u540c\u7684roughness\uff0c\u4f1a\u4ece\u4e0d\u540c\u7684mipmap\u6765\u8fdb\u884c\u91c7\u6837\uff0c\u8fd9\u6837\u4e5f\u5c31\u83b7\u5f97\u4e86\u4e0d\u540c\u7684\u8f90\u7167\u5ea6\u4fe1\u606f\u3002<br>\u8bf4\u767d\u4e86\uff0c\u8fd9\u8fd8\u662f\u4e00\u79cd\u5728\u4e0d\u80fd\u8fdb\u884c\u5149\u7ebf\u8ffd\u8e2a\u60c5\u51b5\u4e0b\u8fdb\u884c\u7684\u4e00\u4e2a\u6a21\u62df\u5b9e\u73b0\u3002\u5c06\u751f\u6210\u7684Cubemap\u89c6\u4e3a\u8f90\u7167\u5ea6\u4fe1\u606f\uff0c\u5c06\u4e0d\u540c\u7b49\u7ea7\u7684MipMap\u4f5c\u4e3a\u4e0d\u540cRoughness\u7684\u8f90\u7167\u8d34\u56fe\u3002\u8fd9\u79cd\u65b9\u6848\u65e2\u8003\u8651\u5230\u4e86\u5b9e\u65f6\u6e32\u67d3\u7684\u6548\u7387\u95ee\u9898\uff0c\u4e5f\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u4fdd\u8bc1\u4e86\u8fd9\u4e2a\u6e32\u67d3\u7684\u771f\u5b9e\u6027\u3002<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.2.4.3\u3001\u73af\u5883\u53cc\u5411\u53cd\u5c04\u5206\u5e03\u51fd\u6570-Environment BRDF<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.zhihu.com\/equation?tex=L_%7Bi%7D%28I_%7Bk%7D%29+%3D+1\" alt=\"[\u516c\u5f0f]\"\/><\/figure>\n\n\n\n<p>\u7b2c\u4e8c\u4e2a\u6c42\u548c\u9879\u5305\u542b\u4e86\u5176\u4ed6\u6240\u6709\u7684\u90e8\u5206\u3002\u8fd9\u4e0e\u7528\u4e00\u4e2a\u7eaf\u767d\u8272\u7684\u73af\u5883\u5bf9\u955c\u9762\u53cd\u5c04\u53cc\u5411\u53cd\u5c04\u5206\u5e03\u51fd\u6570\u8fdb\u884c\u79ef\u5206\u64cd\u4f5c\u662f\u4e00\u6837\u7684\uff0c\u4f8b\u5982\uff0c&nbsp;&nbsp;\u3002\u901a\u8fc7Schlick\u7684\u83f2\u6d85\u5c14\u4ee3\u66ff\uff1aF(v,h)=F0+(1-F0)(1-v\u00b7h)^5\uff0c\u6211\u4eec\u53d1\u73b0F0\u53ef\u4ee5\u56e0\u5f0f\u5206\u89e3\u5230\u79ef\u5206\u5916\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-ed57116123d3265a93ba7c19a3381447_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u8fd9\u4f59\u4e0b\u4e86\u4e24\u4e2a\u8f93\u5165\uff08\u7c97\u7cd9\u5ea6Roughness\u548ccos\u03b8v\uff09\uff0c\u548c\u4e24\u4e2a\u8f93\u51fa\uff08F0\u7684\u7f29\u653e\u548c\u504f\u79fb\uff09\uff0c\u6240\u6709\u7684\u503c\u90fd\u5728[0,1]\u7684\u8303\u56f4\u5185\u3002\u6211\u4eec\u9884\u8ba1\u7b97\u8fd9\u4e2a\u51fd\u6570\u7684\u7ed3\u679c\uff0c\u5e76\u4e14\u4fdd\u5b58\u5230\u4e00\u4e2a2D\u7684\u67e5\u627e\u8868\u4e2d\uff08\u56e0\u4e3a\u7cbe\u786e\u5ea6\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u6240\u4ee5\uff0c\u5728\u8fd9\u91cc\u4f7f\u7528R16G16\u7684\u683c\u5f0f\uff09\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u4e0a\u5f0f\u7559\u4e0b\u4e86\u4e24\u4e2a\u8f93\u5165\uff08Roughness \u548c cos \u03b8v\uff09\u548c\u4e24\u4e2a\u8f93\u51fa\uff08\u7f29\u653e\u548c\u5411F0\u7684\u504f\u5dee\uff08a scale and bias to F0\uff09\uff09\uff0c\u5373\u628a\u4e0a\u8ff0\u65b9\u7a0b\u770b\u6210\u662fF0 * Scale + Offset\u7684\u5f62\u5f0f\u3002 \u6211\u4eec\u9884\u5148\u8ba1\u7b97\u6b64\u51fd\u6570\u7684\u7ed3\u679c\u5e76\u5c06\u5176\u5b58\u50a8\u57282D\u67e5\u627e\u7eb9\u7406\uff08LUT\uff0clook-up texture\uff09\u4e2d\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-58ec69289fdae29282ba9dbf312aaf6c_720w.jpg\" alt=\"\"\/><figcaption>\u56fe3\uff1a2D\u7eb9\u7406\u67e5\u627e\u8868<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u8fd9\u5f20\u7ea2\u7eff\u8272\u7684\u8d34\u56fe\uff0c\u8f93\u5165roughness\u3001cos\u03b8\uff0c\u8f93\u51fa\u73af\u5883BRDF\u955c\u9762\u53cd\u5c04\u7684\u5f3a\u5ea6\u3002\u8fd9\u4e2a\u662f\u5173\u4e8eroughness\u3001cos\u03b8\u4e0e\u73af\u5883BRDF\u955c\u9762\u53cd\u5c04\u5f3a\u5ea6\u7684\u56fa\u6709\u6620\u5c04\u5173\u7cfb\u3002\u8fd9\u4e2a\u4e8b\u53ef\u4ee5\u8fdb\u884c\u79bb\u7ebf\u9884\u8ba1\u7b97\u3002<br>\u5177\u4f53\u7684\u53d6\u51fa\u65b9\u5f0f\u4e3a\uff1a<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-46debfad6ce0cf7c770e9dc8a1c8fa40_720w.png\" alt=\"\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u5373UE4\u662f\u901a\u8fc7\u628aFresnel\u516c\u5f0f\u7684F0\u63d0\u51fa\u6765\uff0c\u7ec4\u6210F0 * Scale +Offset\u7684\u65b9\u5f0f\uff0c\u518d\u5c06Scale\u548cOffset\u7684\u7d22\u5f15\u5b58\u5230\u4e00\u5f202D LUT\u4e0a\u3002\u9760roughness\u548c NdotV\u8fdb\u884c\u67e5\u627e\u3002\u4e0b\u9762\u662f\u4eceUE4.21\u4ee3\u7801\u4e2d\u627e\u5230\u7684\u5236\u4f5c\u8fd9\u5f20LUT\u8d34\u56fe\u7684\u51fd\u6570\u3002\u8bf7\u6ce8\u610f\u5728\u4ee3\u7801\u4e2d\uff0c\u9488\u5bf9A\uff0cB\u7684\u4e24\u4e2a\u53d8\u91cf\u7684\u8d4b\u503c\u3002<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>float3 IntegrateBRDF( uint2 Random, float Roughness, float NoV )\n{\n\tfloat3 V;\n\tV.x = sqrt( 1.0f - NoV * NoV );\t\/\/ sin\n\tV.y = 0;\n\tV.z = NoV;\t\t\t\t\t\t\/\/ cos\n\n\tfloat A = 0;\n\tfloat B = 0;\n\tfloat C = 0;\n\n\tconst uint NumSamples = 64;\n\tfor( uint i = 0; i &lt; NumSamples; i++ )\n\t{\n\t\tfloat2 E = Hammersley( i, NumSamples, Random );\n\n\t\t{\n\t\t\tfloat3 H = ImportanceSampleGGX( E, Pow4(Roughness) ).xyz;\n\t\t\tfloat3 L = 2 * dot( V, H ) * H - V;\n\n\t\t\tfloat NoL = saturate( L.z );\n\t\t\tfloat NoH = saturate( H.z );\n\t\t\tfloat VoH = saturate( dot( V, H ) );\n\n\t\t\tif( NoL > 0 )\n\t\t\t{\n\t\t\t\tfloat a = Square( Roughness );\n\t\t\t\tfloat a2 = a*a;\n\t\t\t\tfloat Vis = Vis_SmithJointApprox( a2, NoV, NoL );\n\t\t\t\tfloat Vis_SmithV = NoL * sqrt( NoV * (NoV - NoV * a2) + a2 );\n\t\t\t\tfloat Vis_SmithL = NoV * sqrt( NoL * (NoL - NoL * a2) + a2 );\n\t\t\t\t\/\/float Vis = 0.5 * rcp( Vis_SmithV + Vis_SmithL );\n\n\t\t\t\t\/\/ Incident light = NoL\n\t\t\t\t\/\/ pdf = D * NoH \/ (4 * VoH)\n\t\t\t\t\/\/ NoL * Vis \/ pdf\n\t\t\t\tfloat NoL_Vis_PDF = NoL * Vis * (4 * VoH \/ NoH);\n\n\t\t\t\tfloat Fc = pow( 1 - VoH, 5 );\n\t\t\t\tA += (1 - Fc) * NoL_Vis_PDF;\n\t\t\t\tB += Fc * NoL_Vis_PDF;\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tfloat3 L = CosineSampleHemisphere( E ).xyz;\n\t\t\tfloat3 H = normalize(V + L);\n\n\t\t\tfloat NoL = saturate( L.z );\n\t\t\tfloat NoH = saturate( H.z );\n\t\t\tfloat VoH = saturate( dot( V, H ) );\n\n\t\t\tfloat FD90 = ( 0.5 + 2 * VoH * VoH ) * Roughness;\n\t\t\tfloat FdV = 1 + (FD90 - 1) * pow( 1 - NoV, 5 );\n\t\t\tfloat FdL = 1 + (FD90 - 1) * pow( 1 - NoL, 5 );\n\t\t\tC += FdV * FdL * ( 1 - 0.3333 * Roughness );\n\t\t}\n\t}\n\n\treturn float3( A, B, C ) \/ NumSamples;\n}\n<\/code><\/pre>\n\n\n\n<p>\u5728\u5b8c\u6210\u8fd9\u9879\u5de5\u4f5c\u4e4b\u540e\uff0c\u6211\u4eec\u53d1\u73b0\u76ee\u524d\u7684\u548c\u540c\u65f6\u8fdb\u884c\u7684\u7814\u7a76\uff0c\u51e0\u4e4e\u90fd\u662f\u548c\u6211\u4eec\u4e00\u81f4\u7684\u7ed3\u679c\u3002Whilst Gotanda\u4f7f\u7528\u4e863D\u67e5\u627e\u8868[8]\uff0cDrobot\u4f18\u5316\u5b83\u52302D\u7684\u67e5\u627e\u8868[7]\uff0c\u5c31\u548c\u6211\u4eec\u6240\u505a\u7684\u90a3\u6837\u3002\u53e6\u5916\uff0c\u4f5c\u4e3a\u8fd9\u4e2a\u8bfe\u9898\u7684\u4e00\u5458\u2014\u2014Lazarov\u53c8\u5411\u524d\u8fc8\u8fdb\u4e86\u4e00\u6b65[11]\uff0c\u5c55\u793a\u4e86\u76f8\u4f3c\u79ef\u5206\u7684\u4e00\u5bf9\u89e3\u6790\u8fd1\u4f3c\uff08\u8fd9\u4e2a\u65b9\u6848\u4e2d\u4f7f\u7528\u4e86\u4e0d\u540c\u7684D\u548cG\u51fd\u6570\uff09\u3002<\/p>\n\n\n\n<p>\u6700\u540e\uff0c\u4e3a\u4e86\u8fd1\u4f3c\u91cd\u8981\u6027\u91c7\u6837\u7684\u5f15\u7528\uff0c\u6211\u4eec\u5c06\u8fd9\u4e24\u4e2a\u9884\u8ba1\u7b97\u7684\u6c42\u548c\u8fdb\u884c\u76f8\u4e58\u7684\u64cd\u4f5c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>float3 ApproximateSpecularIBL( uint2 Random, float3 SpecularColor, float Roughness, float3 N, float3 V )\n{\n\t\/\/ Function replaced with prefiltered environment map sample\n\tfloat3 R = 2 * dot( V, N ) * N - V;\n\tfloat3 PrefilteredColor = PrefilterEnvMap( Random, Roughness, R );\n\t\/\/float3 PrefilteredColor = FilterEnvMap( Random, Roughness, N, V );\n\n\t\/\/ Function replaced with 2D texture sample\n\tfloat NoV = saturate( dot( N, V ) );\n\tfloat2 AB = IntegrateBRDF( Random, Roughness, NoV ).xy;\n\n\treturn PrefilteredColor * ( SpecularColor * AB.x + AB.y );\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u6ce8\uff1a\u8fd9\u4e2a\u51fd\u6570\uff0c\u53ea\u662f\u8bf4\u660e\u4e86\u6574\u4e2a\u7b97\u6cd5\u800c\u5df2\uff0c\u5728\u771f\u6b63\u53bb\u8fdb\u884c\u8ba1\u7b97\u7684\u65f6\u5019\uff0c\u662f\u4e0d\u4f1a\u91c7\u7528\u8fd9\u4e2a\u65b9\u6cd5\u7684\uff0c\u800c\u662f\uff0c\u9009\u62e9\u76f4\u63a5\u8fdb\u884c\u9488\u5bf9\u9884\u79ef\u5206\u8d34\u56fe\u91c7\u6837\u7684\u7b97\u6cd5\u3002\u5982\u4e0b\u9762\u7684\u4ee3\u7801\u6240\u793a\u3002<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>void MainPS(in noperspective float4 UVAndScreenPos : TEXCOORD0, float4 SvPosition : SV_POSITION, out float4 OutColor : SV_Target0)\n{\n        ......\n\t{\n\t\tfloat Mip = ComputeCubemapMipFromRoughness( GBuffer.Roughness, AmbientCubemapMipAdjust.w );\n\t\tfloat3 SampleColor = TextureCubeSampleLevel( AmbientCubemap, AmbientCubemapSampler, R, Mip ).rgb;\n\t\tSpecularContribution += SampleColor * EnvBRDF( GBuffer.SpecularColor, GBuffer.Roughness, NoV );\n\t\t\/\/SpecularContribution += ApproximateSpecularIBL( Random, GBuffer.SpecularColor, GBuffer.Roughness, GBuffer.WorldNormal, -ScreenVector );\n\t}\n}\n\nhalf3 EnvBRDF( half3 SpecularColor, half Roughness, half NoV )\n{\n\t\/\/ Importance sampled preintegrated G * F\n\tfloat2 AB = Texture2DSampleLevel( PreIntegratedGF, PreIntegratedGFSampler, float2( NoV, Roughness ), 0 ).rg;\n\n\t\/\/ Anything less than 2% is physically impossible and is instead considered to be shadowing \n\tfloat3 GF = SpecularColor * AB.x + saturate( 50.0 * SpecularColor.g ) * AB.y;\n\treturn GF;\n}\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-bc7b65b2f87860126944e9752bec372e_720w.jpg\" alt=\"\"\/><figcaption>\u56fe4\uff1a\u6700\u4e0a\u65b9\u4e3a\u53c2\u8003\uff08\u91cd\u8981\u6027\u91c7\u6837\u65b9\u6848\uff09\uff0c\u5206\u89e3\u6c42\u548c\u8fd1\u4f3c\uff08Split sum approxmation\uff09\u4f4d\u4e8e\u4e2d\u95f4\uff0c\u5305\u542bn=v\u5047\u8bbe\u7684Complete Approximation\u5728\u6700\u5e95\u90e8\u3002\u5f84\u5411\u5bf9\u79f0\u5047\u8bbe\u5f15\u5165\u4e86\u8bef\u5dee\u6700\u5927\uff0c\u4f46\u662f\u7ec4\u5408\u8fd1\u4f3c\u4f9d\u7136\u548c\u53c2\u8003\u5341\u5206\u76f8\u4f3c\u3002<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2021\/01\/v2-e56002f2b2f6fe336a0470684448ab94_720w.jpg\" alt=\"\"\/><figcaption>\u56fe5\uff1a\u7535\u4ecb\u8d28\u7684\u5bf9\u6bd4\u56fe\uff08\u5bf9\u6bd4\u9879\u4e0e\u56fe4\u76f8\u540c\uff09<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8003\uff1a<\/h2>\n\n\n\n<p>Shading Model\u8fd9\u90e8\u5206\u5230\u8fd9\u91cc\u57fa\u672c\u4e0a\u5c31\u7b97\u662f\u5b8c\u6210\u4e86\uff0c\u5269\u4e0b\u7684Material Model\u548cLighting\u90e8\u5206\uff0c\u653e\u5728\u4e0b\u4e00\u7bc7\u5427\u3002<\/p>\n\n\n\n<p>\u9488\u5bf9\u8fd9\u90e8\u5206\u8fdb\u884c\u7ffb\u8bd1\u540e\uff0c\u6211\u4e2a\u4eba\u5bf9UE Shading Model\u6709\u4e00\u4e9b\u611f\u53d7\uff0c\u8ddf\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<p>1\u3001\u5bf9\u4e8eUE4\u7684\u521d\u5b66\u8005\u6765\u8bf4\uff0c\u6211\u4eec\u4e5f\u4e0d\u8981\u628aUE4\u60f3\u5f97\u592a\u795e\u5316\u3002\u5475\u5475\uff0c\u4ece\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u6bd4\u8f83\u6e05\u6670\u5730\u770b\u51fa\uff0c\u4eceUE3\u5411UE4\u8f6c\u6362\u7684\u4e3b\u4f53\u601d\u8def\u3002<\/p>\n\n\n\n<p>2\u3001\u5f15\u64ce\u8fd9\u4e2a\u5c42\u9762\u8fd8\u662f\u9488\u5bf9\u7406\u8bba\u5b66\u754c\u7684\u5404\u79cd\u7b97\u6cd5\u6765\u8fdb\u884c\u5b9e\u73b0\u7684\uff0c\u4e0b\u9762\u5217\u4e3e\u7684\u53c2\u8003\u6587\u732e\uff0c\u5176\u5b9e\uff0c\u624d\u662f\u6211\u4eec\u6df1\u5165\u8981\u53bb\u7406\u89e3\u548c\u5206\u6790\u7684\u3002\u5982\u679c\u8fd9\u4e9b\u57fa\u672c\u7684\u7406\u8bba\u4f9d\u636e\u4e0d\u80fd\u7406\u89e3\uff0c\u5bf9UE4\u7684\u5b9e\u73b0\u4e5f\u5c31\u53ea\u80fd\u505c\u7559\u5728\u8868\u9762\u3002\u5f53\u7136\uff0c\u8fd9\u91cc\u9762\u6d89\u53ca\u7684\u77e5\u8bc6\u5b9e\u5728\u662f\u592a\u591a\u4e86\uff0c\u5982\u679c\u6211\u4eec\u4e0d\u505a\u5b66\u672f\u7684\u8bdd\uff0c\u6709\u4e00\u4e9b\u7406\u8bba\u81f3\u5c11\u5f97\u7406\u89e3\u3002<\/p>\n\n\n\n<p>3\u3001UE4\u4e5f\u662f\u6709\u5f88\u591a\u6298\u4e2d\u548c\u59a5\u534f\u7684\uff0c\u6bd4\u5982\uff0cSpecular\u8fd9\u4e2a\u6982\u5ff5\u3002\u5728\u6587\u4e2d\uff0c\u4f5c\u8005\u662f\u5f88\u4e0d\u884c\u4fdd\u7559\u8fd9\u4e2a\u6982\u5ff5\u4e86\uff0c\u4f46\u662f\uff0c\u300a\u5821\u5792\u4e4b\u591c\u300b\u5927\u91cf\u4f7f\u7528\u4e86\u8fd9\u4e2a\u6750\u8d28\u5c5e\u6027\uff0c\u4f30\u8ba1\u6700\u540e\u4f5c\u4e3a\u5f15\u64ce\u5f00\u53d1\u8005\uff0c\u4e5f\u53ea\u80fd\u59a5\u534f\u3002<\/p>\n\n\n\n<p>4\u3001UE4\u4f9d\u7136\u662f\u4e0d\u65ad\u5728\u8fdb\u5316\u7684\uff0c\u4ece\u6587\u7ae0\u4e2d\u7ed9\u51fa\u7684\u53c2\u8003\u5b9e\u73b0\u4ee3\u7801\uff0c\u5230UE4.21\u7684\u6700\u65b0\u4ee3\u7801\u4e0d\u540c\u8fd9\u4e00\u70b9\u5c31\u80fd\u770b\u51fa\u6765\u3002\u8fd9\u4e3b\u8981\u8fd8\u662f\u56e0\u4e3a\uff0c\u56fe\u5f62\u5b66\u662f\u5728\u4e0d\u65ad\u6f14\u53d8\u548c\u8fdb\u5316\u7684\uff0c\u5927\u5bb6\u5728\u5b66\u4e60\u7684\u65f6\u5019\uff0c\u8981\u6709\u4e00\u4e2a\u8ba4\u77e5\u3002<\/p>\n\n\n\n<p>5\u3001\u5bf9\u4e8e\u5b9e\u65f6\u6e32\u67d3\u800c\u8a00\uff0c\u4e00\u4e2a\u91cd\u70b9\u8981\u8003\u8651\u7684\u95ee\u9898\u5c31\u662f\u6548\u7387\u95ee\u9898\u3002\u5728\u4e0a\u9762\u7684\u5404\u79cd\u7b97\u6cd5\u4f18\u5316\u8fc7\u7a0b\u4e2d\uff0c\u4e3b\u8981\u5c31\u662f\u9488\u5bf9\u8fd9\u79cd\u601d\u8def\u6765\u5b9e\u73b0\u3002\u4f18\u5316\u7684\u65b9\u6848\u4e3b\u8981\u6709\u4e24\u79cd\uff1a1\u4e2a\u5c31\u662f\u5728\u7eaf\u7cb9\u5728\u6570\u5b66\u4e0a\u8fdb\u884c\u62df\u5408\uff0c\u6bd4\u5982\u7403\u9762\u9ad8\u65af\u62df\u5408\uff1b\u7b2c2\u4e2a\u65b9\u6848\u5c31\u662f\u589e\u52a0\u5047\u8bbe\u6761\u4ef6\uff0c\u6bd4\u5982\uff0c\u9884\u79ef\u5206\u73af\u5883\u8d34\u56fe\u751f\u6210\u7684\u4e24\u4e2a\u91cd\u8981\u5047\u8bbe\u3002\u7b2c\u4e00\u4e2a\u8fdb\u884c\u6570\u5b66\u903c\u8fd1\u8fd8\u597d\uff0c\u7b2c\u4e8c\u4e2a\u5c31\u662f\u6574\u4f53\u5e26\u6765\u504f\u5dee\u7684\u4e3b\u8981\u539f\u56e0\u4e86\u3002<\/p>\n\n\n\n<p>6\u3001\u4ece\u672a\u6765\u7684\u89d2\u5ea6\u8bb2\uff0c\u80af\u5b9a\u8fd8\u662f\u4f1a\u51fa\u73b0\u5404\u79cd\u65b9\u6848\u6765\u4f18\u5316\u5404\u79cdD\uff0cG\uff0cF\u51fd\u6570\uff0c\u4ee5\u53ca\u9488\u5bf9\u73af\u5883\u5149\u7684\u5404\u79cd\u4f18\u5316\u7b97\u6cd5\u3002\u5982\u679c\u56e0\u4e3a\u6548\u7387\u8fd8\u4e0d\u80fd\u4f7f\u7528\u5149\u8ffd\u7684\u8bdd\uff0c\u5728\u7b2c5\u90e8\u5206\u7684\u5404\u79cd\u4f18\u5316\u8fd8\u662f\u4f1a\u4e0d\u65ad\u8fdb\u884c\u3002<\/p>\n\n\n\n<p>7\u3001\u4e0d\u8fc7\uff0c\u53ef\u559c\u7684\u662f\uff0c\u201d\u5149\u7ebf\u8ffd\u8e2a\u201c\u4f3c\u4e4e\u5c31\u8981\u6765\u4e86\uff0c\u4e0d\u5149\u82f1\u4f1f\u8fbe\uff0cAMD\u4e5f\u57fa\u672c\u4e0a\u80fd\u591f\u505a\u51fa\u201d\u5149\u7ebf\u8ffd\u8e2a\u201c\u7684\u663e\u5361\u4e86\u3002\u5728\u8fd9\u6837\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u6574\u4e2a\u4e00\u5957\u6e32\u67d3\u65b9\u6848\uff0c\u4f1a\u4ea7\u751f\u4e00\u4e2a\u66f4\u5927\u7684\u53d8\u5316\u4e86\u3002\u5f53\u7136\uff0c\u79fb\u52a8\u8bbe\u5907\u4e0a\u53ef\u80fd\u8fd8\u4e0d\u884c\uff0c\u6240\u4ee5\uff0c\u8fd9\u5957\u601d\u8def\u8fd8\u662f\u9700\u8981\u8fdb\u4e00\u6b65\u7814\u7a76\u548c\u53d1\u5c55\u4e0b\u53bb\u3002<\/p>\n\n\n\n<p><strong>\u53c2\u8003\u6587\u732e\uff1a<\/strong><\/p>\n\n\n\n<p>[1] AMD, CubeMapGen: Cubemap Filtering and Mipchain Generation Tool.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/developer.amd\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/developer.amd<\/a>. com\/resources\/archive\/archived-tools\/gpu-tools-archive\/cubemapgen\/<\/p>\n\n\n\n<p>[2] Burley, Brent, \u201cPhysically-Based Shading at Disney\u201d, part of \u201cPractical Physically Based Shading in Film and Game Production\u201d, SIGGRAPH 2012 Course Notes.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/blog.selfshadow.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/blog.selfshadow.com\/<\/a>&nbsp;publications\/s2012-shading-course\/<\/p>\n\n\n\n<p>[3] Colbert, Mark, and Jaroslav Krivanek, \u201cGPU-based Importance Sampling\u201d, in Hubert Nguyen, ed., GPU Gems 3, Addison-Wesley, pp. 459\u2013479, 2007.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/http.developer.nvidia.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/http.developer.nvidia.com\/<\/a>&nbsp;GPUGems3\/gpugems3_ch20.html<\/p>\n\n\n\n<p>[4] Coffin, Christina, \u201cSPU Based Deferred Shading in Battlefield 3 for Playstation 3\u201d, Game Developers Conference, March 2011.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.slideshare.net\/DICEStudio\/spubased-deferred-\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.slideshare.net\/DICEStudio\/spubased-deferred-<\/a>&nbsp;shading-in-battlefield-3-for-playstation-3<\/p>\n\n\n\n<p>[5] Cook, Robert L., and Kenneth E. Torrance, \u201cA Reflectance Model for Computer Graphics\u201d, Computer Graphics (SIGGRAPH \u201981 Proceedings), pp. 307\u2013316, July 1981.<\/p>\n\n\n\n<p>[6] Cook, Robert L., and Kenneth E. Torrance, \u201cA Reflectance Model for Computer Graphics\u201d, ACM Transactions on Graphics, vol. 1, no. 1, pp. 7\u201324, January 1982.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/graphics.pixar\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/graphics.pixar<\/a>. com\/library\/ReflectanceModel\/<\/p>\n\n\n\n<p>[7] Drobot, Michal , \u201cLighting Killzone: Shadow Fall\u201d, Digital Dragons, April 2013.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www<\/a>.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/guerrilla-games.com\/publications\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/guerrilla-games.com\/publications\/<\/a><\/p>\n\n\n\n<p>[8] Gotanda, Yoshiharu, \u201cPractical Implementation of Physically-Based Shading Models at tri-Ace\u201d, part of \u201cPhysically-Based Shading Models in Film and Game Production\u201d, SIGGRAPH 2010 Course Notes.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/renderwonk.com\/publications\/s2010-shading-course\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/renderwonk.com\/publications\/s2010-shading-course\/<\/a><\/p>\n\n\n\n<p>[9] Hoffman, Naty, \u201cBackground: Physics and Math of Shading\u201d, part of \u201cPhysically Based Shad- ing in Theory and Practice\u201d, SIGGRAPH 2013 Course Notes.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/blog.selfshadow.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/blog.selfshadow.com\/<\/a>&nbsp;publications\/s2013-shading-course\/<\/p>\n\n\n\n<p>[10] Lagarde, S \u0301ebastien, \u201cSpherical Gaussian approximation for Blinn-Phong, Phong and Fresnel\u201d, June 2012.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/seblagarde.wordpress.com\/2012\/06\/03\/spherical-gaussien-approximation-\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/seblagarde.wordpress.com\/2012\/06\/03\/spherical-gaussien-approximation-<\/a>&nbsp;for-blinn-phong-phong-and-fresnel\/<\/p>\n\n\n\n<p>[11] Lazarov, Dimitar, \u201cGetting More Physical in Call of Duty: Black Ops II\u201d, part of \u201cPhysi- cally Based Shading in Theory and Practice\u201d, SIGGRAPH 2013 Course Notes.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/blog\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/blog<\/a>.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/selfshadow.com\/publications\/s2013-shading-course\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/selfshadow.com\/publications\/s2013-shading-course\/<\/a><\/p>\n\n\n\n<p>[12] Martinez, Adam, \u201cFaster Photorealism in Wonderland: Physically-Based Shading and Lighting at Sony Pictures Imageworks\u201d, part of \u201cPhysically-Based Shading Models in Film and Game Pro- duction\u201d, SIGGRAPH 2010 Course Notes.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/renderwonk.com\/publications\/s2010-shading-\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/renderwonk.com\/publications\/s2010-shading-<\/a>&nbsp;course\/<\/p>\n\n\n\n<p>[13] Mittring, Martin, and Bryan Dudash, \u201cThe Technology Behind the DirectX 11 Unreal Engine Samaritan Demo\u201d, Game Developer Conference 2011.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/udn.epicgames.com\/Three\/rsrc\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/udn.epicgames.com\/Three\/rsrc\/<\/a>&nbsp;Three\/DirectX11Rendering\/MartinM_GDC11_DX11_presentation.pdf<\/p>\n\n\n\n<p>[14] Mittring, Martin, \u201cThe Technology Behind the Unreal Engine 4 Elemental demo\u201d, part of \u201cAd- vances in Real-Time Rendering in 3D Graphics and Games Course\u201d, SIGGRAPH 2012. http: \/\/<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.unrealengine.com\/files\/misc\/The_Technology_Behind_the_Elemental_Demo_16x9_%282%29\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.unrealengine.com\/files\/misc\/The_Technology_Behind_the_Elemental_Demo_16x9_(2)<\/a>.pdf<\/p>\n\n\n\n<p>[15] Oat, Chris, \u201cAmbient Aperture Lighting\u201d, SIGGRAPH 2006.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/developer.amd.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/developer.amd.com\/<\/a>&nbsp;wordpress\/media\/2012\/10\/Oat-AmbientApetureLighting.pdf<\/p>\n\n\n\n<p>[16] Picott, Kevin P., \u201cExtensions of the Linear and Area Lighting Models\u201d, Computers and Graphics, Volume 12 Issue 2, March 1992, pp. 31-38.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/dx.doi.org\/10.1109\/38.124286\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/dx.doi.org\/10.1109\/38.124286<\/a><\/p>\n\n\n\n<p>[17] Poulin, Pierre, and John Amanatides, \u201cShading and Shadowing with Linear Light Sources\u201d, IEEE Computer Graphics and Applications, 1991.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.cse.yorku.ca\/~amana\/research\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.cse.yorku.ca\/~amana\/research\/<\/a><\/p>\n\n\n\n<p>[18] Quilez, Inigo, \u201cSpherical ambient occlusion\u201d, 2006.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.iquilezles.org\/www\/articles\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.iquilezles.org\/www\/articles\/<\/a>&nbsp;sphereao\/sphereao.htm<\/p>\n\n\n\n<p>[19] Schlick, Christophe, \u201cAn Inexpensive BRDF Model for Physically-based Rendering\u201d, Computer Graphics Forum, vol. 13, no. 3, Sept. 1994, pp. 149\u2013162.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/dept-info.labri.u-bordeaux.fr\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/dept-info.labri.u-bordeaux.fr\/<\/a>&nbsp;~schlick\/DOC\/eur2.html<\/p>\n\n\n\n<p>[20] Snow, Ben, \u201cTerminators and Iron Men: Image-based lighting and physical shading at ILM\u201d, part of \u201cPhysically-Based Shading Models in Film and Game Production\u201d, SIGGRAPH 2010 Course Notes.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/renderwonk.com\/publications\/s2010-shading-course\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/renderwonk.com\/publications\/s2010-shading-course\/<\/a><\/p>\n\n\n\n<p>[21] Walter, Bruce, Stephen R. Marschner, Hongsong Li, Kenneth E. Torrance, \u201cMicrofacet Models for Refraction through Rough Surfaces\u201d, Eurographics Symposium on Rendering (2007), 195\u2013206, June 2007.&nbsp;<a href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.cs.cornell.edu\/~srm\/publications\/EGSR07-btdf.html\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.cs.cornell.edu\/~srm\/publications\/EGSR07-btdf.html<\/a><\/p>\n\n\n\n<p>[22] Wang, Lifeng, Zhouchen Lin, Wenle Wang, and Kai Fu, \u201cOne-Shot Approximate Local Shading\u201d 2006.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/zhuanlan.zhihu.com\/p\/121719442 \u6700\u8fd1\u6309\u7167\u5b66\u4e60\u5c0f\u7ec4\u5185\u7684\u5206\u5de5\uff0c\u6211\u4e00\u76f4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/3605"}],"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=3605"}],"version-history":[{"count":1,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/3605\/revisions"}],"predecessor-version":[{"id":3630,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/3605\/revisions\/3630"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}