{"id":3101,"date":"2023-04-22T13:53:53","date_gmt":"2023-04-22T05:53:53","guid":{"rendered":"https:\/\/www.caiqinyi.cn\/?p=3101"},"modified":"2025-02-26T11:00:45","modified_gmt":"2025-02-26T03:00:45","slug":"viewing_mark","status":"publish","type":"post","link":"https:\/\/www.caiqinyi.cn\/index.php\/2023\/04\/22\/viewing_mark\/","title":{"rendered":"Viewing\u6ce8\u8bb0(\u5148\u5360\u4e2a\u5751\u2026\u2026)"},"content":{"rendered":"<p><script type=\"text\/javascript\" async src=\"https:\/\/www.caiqinyi.cn\/wp-content\/MathJax\/MathJax.js?config=TeX-AMS_CHTML\">\n<\/script><br \/>\n<script type=\"text\/x-mathjax-config\">\n    MathJax.Hub.Config({\n        tex2jax: {inlineMath: [['$','$']]},\n        TeX: {equationNumbers: {autoNumber: [\"AMS\"], useLabelIds: true}},\n        \"HTML-CSS\": {linebreaks: {automatic: true}},\n        SVG: {linebreaks: {automatic: true}}\n    });\n<\/script><\/p>\n<p>\u5b9e\u5728\u662f\u60ed\u6127, \u6700\u8fd1\u51e0\u5468\u5b9e\u5728\u662f\u6709\u70b9\u5fd9(\u4e3b\u8981\u56e0\u4e3a\u5468\u672b\u4e5f\u8fc7\u5b81\u6ce2\u4e86\u2026\u2026), \u5bfc\u81f4\u4e5f\u633a\u4e45\u6ca1\u66f4\u65b0\u535a\u5ba2\u4e86. \u672c\u6765\u60f3\u7740\u4eca\u5929\u7ee7\u7eed\u5199\u4e00\u4e0b\u535a\u5ba2, \u4f46\u7531\u4e8e\u6700\u8fd1\u5728\u79fb\u690dUE5\u7684modeling\u6a21\u5f0f\u7684QEM\u7b97\u6cd5, \u6709\u4e9b\u81ea\u5df1\u5b9e\u73b0\u7684\u7ec6\u8282\u4ecd\u65e7\u5b58\u5728Bug, \u4f7f\u5f97\u6211\u4e00\u76f4\u96be\u4ee5\u91ca\u6000, \u56e0\u6b64\u51b3\u5b9a\u4eca\u5929\u7ee7\u7eed\u9e3d\u535a\u5ba2(\u9003\u03b5=\u03b5=\u03b5=\u250f(\u309c\u30ed\u309c;)\u251b), \u8f6c\u800c\u7ee7\u7eed\u7814\u7a76QEM\u7b97\u6cd5\u7684\u5b9e\u73b0\u7ec6\u8282~ \u4eca\u5929\u5c31\u5148\u5f00\u4e2a\u5751, \u65e5\u540e\u4e00\u5b9a\u8865\u4e0a!(\u6ca1\u9519, \u5c31\u662f\u9171\u7d2b!)<\/p>\n<p><!--more--><\/p>\n<p><strong>\u53c2\u8003\u6750\u6599<\/strong><br \/>\n1. <a href=\"https:\/\/juejin.cn\/post\/6844904066175205383\">\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66\u7b14\u8bb0\u2014\u2014\u89c6\u56fe\uff08viewing\uff09<\/a><br \/>\n2. <a href=\"https:\/\/computergraphics.stackexchange.com\/questions\/8262\/preserving-z-values-during-projection\">preserving z-values during projection?<\/a><br \/>\n3. <a href=\"https:\/\/zhuanlan.zhihu.com\/p\/138844451\">\u56fe\u5f62\u5b66\u5750\u6807\u53d8\u63623. \u6295\u5f71\u53d8\u6362-\u900f\u89c6\u6295\u5f71\u77e9\u9635\u5230Clip\u7a7a\u95f4<\/a><\/p>\n<p><strong>1. Viewing\u53d8\u6362<\/strong><\/p>\n<p><strong>1.1 \u89c6\u53e3\u53d8\u6362<\/strong><\/p>\n<p>\u89c6\u53e3\u53d8\u6362\u5c06\u4e00\u4e2a\u8f74\u5bf9\u9f50\u7684\u77e9\u5f62\u6620\u5c04\u5230\u53e6\u4e00\u4e2a\u77e9\u5f62, \u5176\u53d8\u6362\u8fc7\u7a0b\u5982\u4e0b\u6240\u793a:$$\\begin{bmatrix}<br \/>\nx_{screen} \\\\<br \/>\ny_{screen} \\\\<br \/>\n1<br \/>\n\\end{bmatrix} = \\begin{bmatrix}<br \/>\n\\frac{n_x}{2} &#038; 0 &#038; \\frac{n_x &#8211; 1}{2}\\\\<br \/>\n0 &#038; \\frac{n_y}{2} &#038; \\frac{n_y &#8211; 1}{2}\\\\<br \/>\n0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix} \\begin{bmatrix}<br \/>\nx_{canonical} \\\\<br \/>\ny_{canonical} \\\\<br \/>\n1<br \/>\n\\end{bmatrix}.$$\u4e0a\u8ff0\u77e9\u9635\u5ffd\u7565\u4e86Canonical View Volume(\u4e00\u4e2a\u4e2d\u5fc3\u4f4d\u4e8e\u539f\u70b9, \u8fb9\u957f\u4e3a2\u7684\u7acb\u65b9\u4f53) \u4e2d\u70b9\u7684$z$\u5206\u91cf, \u56e0\u4e3a\u70b9\u4e0e\u6295\u5f71\u9762\u4e4b\u95f4\u6cbf\u7740\u6295\u5f71\u65b9\u5411\u7684\u8ddd\u79bb\u5e76\u4e0d\u4f1a\u5f71\u54cd\u8be5\u70b9\u5728\u56fe\u50cf\u4e2d\u7684\u6295\u5f71\u4f4d\u7f6e. \u4f46\u6211\u4eec\u4f9d\u65e7\u5f80\u4e0a\u8ff0\u77e9\u9635\u4e2d\u6dfb\u52a0\u4e86\u4e00\u884c\u4e0e\u4e00\u5217\u6765\u5f97\u5230\u4e00\u4e2a\u5b8c\u6574\u7684\u89c6\u53e3\u77e9\u9635(\u5982\u4e0b\u6240\u793a), \u8be5\u77e9\u9635\u5e76\u4e0d\u4f1a\u6539\u53d8\u70b9\u7684$z$\u5206\u91cf. \u6700\u7ec8\u6211\u4eec\u4f1a\u9700\u8981\u6295\u5f71\u70b9\u7684$z$\u5206\u91cf, \u56e0\u4e3a\u5b83\u53ef\u7528\u4e8eZ-Buffer\u5254\u9664.$$\\mathbf{M}_{vp} = \\begin{bmatrix}<br \/>\n\\frac{n_x}{2} &#038; 0 &#038; 0 &#038; \\frac{n_x &#8211; 1}{2} \\\\<br \/>\n0 &#038; \\frac{n_y}{2} &#038; 0 &#038; \\frac{n_y &#8211; 1}{2} \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}.$$<br \/>\n<strong>1.2 \u6b63\u4ea4\u6295\u5f71<\/strong><\/p>\n<p>Orthographic View Volume\u662f\u6cbf\u7740\u8d1f$z$\u8f74\u7684, \u4e14$f < n < 0$, \u5982\u4e0b\u56fe\u6240\u793a. \u4eceOrthographic View Volume\u5230Canonical View Volume\u7684\u53d8\u6362\u4e3a\u53e6\u4e00\u4e2a\u7a97\u53e3\u53d8\u6362, \u6613\u5f97\u8be5\u53d8\u6362\u5bf9\u5e94\u7684\u77e9\u9635\u4e3a:$$\\mathbf{M}_{orh} = \\begin{bmatrix}\n\\frac{2}{r - l} &#038; 0 &#038; 0 &#038; -\\frac{r + l}{r - l} \\\\\n0 &#038; \\frac{2}{t - b} &#038; 0 &#038; -\\frac{t + b}{t - b} \\\\\n0 &#038; 0 &#038; \\frac{2}{n - f} &#038; -\\frac{n + f}{n - f} \\\\\n0 &#038; 0 &#038; 0 &#038; 1\n\\end{bmatrix}.$$\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/orthographic_view_volume.png\" alt=\"\" width=\"776\" height=\"332\" class=\"aligncenter size-full wp-image-3124\" srcset=\"https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/orthographic_view_volume.png 776w, https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/orthographic_view_volume-300x128.png 300w, https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/orthographic_view_volume-768x329.png 768w\" sizes=\"(max-width: 776px) 100vw, 776px\" \/><\/p>\n<p>\u4e3a\u4e86\u5728Orthographic View Volume\u4e2d\u7ed8\u52363D\u7ebf\u6bb5, \u6211\u4eec\u5c06\u7ebf\u6bb5\u6295\u5f71\u5230\u5c4f\u5e55\u4e0a, \u5176\u6295\u5f71\u70b9\u7684\u4f4d\u7f6e\u4e0e$z$\u5206\u91cf\u65e0\u5173, \u5176\u6295\u5f71\u8fc7\u7a0b\u5982\u4e0b\u6240\u793a:$$\\begin{bmatrix}<br \/>\nx_{pixel} \\\\<br \/>\ny_{pixel} \\\\<br \/>\nz_{canonical} \\\\<br \/>\n1<br \/>\n\\end{bmatrix} = (\\mathbf{M}_{vp} \\mathbf{M}_{orh})\\begin{bmatrix}<br \/>\nx \\\\<br \/>\ny \\\\<br \/>\nz \\\\<br \/>\n1<br \/>\n\\end{bmatrix}.$$<br \/>\n<strong>1.3 \u76f8\u673a\u53d8\u6362<\/strong><\/p>\n<p>\u4e0d\u59a8\u8bbe$\\mathbf{e}$\u4e3a\u89c6\u70b9\u7684\u4f4d\u7f6e, $\\mathbf{g}$\u4e3a\u89c6\u7ebf\u7684\u65b9\u5411\u5411\u91cf, $\\mathbf{t}$\u4e3a\u7ad6\u76f4\u5411\u4e0a\u7684\u65b9\u5411\u5411\u91cf, \u8fd9\u4e9b\u5411\u91cf\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u8db3\u591f\u7684\u4fe1\u606f\u6765\u5efa\u7acb\u4e00\u4e2a\u4ee5$\\mathbf{e}$\u4e3a\u539f\u70b9, \u4ee5$\\mathbf{u}$, $\\mathbf{v}$\u4e0e$\\mathbf{w}$\u4e3a\u57fa\u7684\u76f8\u673a\u5750\u6807\u7cfb, \u5176\u4e2d, $\\mathbf{u}$, $\\mathbf{v}$\u4e0e$\\mathbf{w}$\u7684\u5b9a\u4e49\u5982\u4e0b\u6240\u793a:$$\\mathbf{w} = -\\frac{\\mathbf{g}}{\\left \\| \\mathbf{g} \\right \\| }, \\\\ \\mathbf{u} = \\frac{\\mathbf{t} \\times \\mathbf{w}}{\\left \\| \\mathbf{t} \\times \\mathbf{w} \\right \\| }, \\\\ \\mathbf{v} = \\mathbf{w} \\times \\mathbf{u}.$$\u4e00\u822c\u6765\u8bf4, \u6a21\u578b\u7684\u5750\u6807\u662f\u5728\u5c40\u90e8\u5750\u6807\u7cfb\u4e0b\u7684, \u4e3a\u4e86\u7ed8\u52363D\u7ebf\u6bb5, \u6211\u4eec\u9700\u8981\u5c06\u7ebf\u6bb5\u7aef\u70b9\u7684\u5750\u6807\u4ece\u5c40\u90e8\u5750\u6807\u7cfb\u4e0b\u53d8\u6362\u5230\u76f8\u673a\u5750\u6807\u7cfb\u4e0b, \u6267\u884c\u8fd9\u79cd\u53d8\u6362\u7684\u77e9\u9635\u5982\u4e0b\u6240\u793a:$$\\mathbf{M}_{cam} = \\begin{bmatrix}<br \/>\n\\mathbf{u} &#038; \\mathbf{v} &#038; \\mathbf{w} &#038; \\mathbf{e} \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}^{-1} = \\begin{bmatrix}<br \/>\nx_u &#038; y_u &#038; z_u &#038; 0 \\\\<br \/>\nx_v &#038; y_v &#038; z_v &#038; 0 \\\\<br \/>\nx_w &#038; y_w &#038; z_w &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix} \\begin{bmatrix}<br \/>\n1 &#038; 0 &#038; 0 &#038; -x_\\mathbf{e} \\\\<br \/>\n0 &#038; 1 &#038; 0 &#038; -y_\\mathbf{e} \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; -z_\\mathbf{e} \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}.$$\u6211\u4eec\u4ea6\u53ef\u4ee5\u628a\u8fd9\u79cd\u53d8\u6362\u89c6\u4e3a\u4e00\u4e2a\u5148\u628a\u89c6\u70b9$\\mathbf{e}$\u79fb\u5230\u5c40\u90e8\u5750\u6807\u7cfb\u539f\u70b9, \u7136\u540e\u628a\u57fa$\\mathbf{u}$, $\\mathbf{v}$\u4e0e$\\mathbf{w}$\u5206\u522b\u53d8\u6362\u5230$x$\u8f74\u4e0a, $y$\u8f74\u4e0a\u4e0e$z$\u8f74\u4e0a\u7684\u8fc7\u7a0b.<\/p>\n<p><strong>2. \u6295\u5f71\u53d8\u6362<\/strong><\/p>\n<p>1\u7ef4\u900f\u89c6\u6295\u5f71\u7684\u5173\u952e\u7279\u70b9\u662f, \u5c4f\u5e55\u4e0a\u7269\u4f53\u7684\u5927\u5c0f\u4e0e\u5176$z$\u5206\u91cf\u7684\u5012\u6570$1\/z$\u6210\u6b63\u6bd4, \u5982\u4e0b\u6240\u793a:$$y_s = \\frac{d}{z}y,$$\u5176\u4e2d, \u5404\u7b26\u53f7\u7684\u5b9a\u4e49\u5982\u4e0b\u56fe\u6240\u793a.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/perspective_key_property.png\" alt=\"\" width=\"810\" height=\"374\" class=\"aligncenter size-full wp-image-3125\" srcset=\"https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/perspective_key_property.png 810w, https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/perspective_key_property-300x139.png 300w, https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/perspective_key_property-768x355.png 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/p>\n<p>\u800c\u57282\u7ef4\u900f\u89c6\u6295\u5f71\u4e2d(\u5373\u66f4\u5e38\u89c1\u7684\u6e32\u67d3\u6d41\u7a0b), \u6211\u4eec\u9700\u8981\u5728\u4eff\u5c04\u53d8\u6362\u540e\u8fdb\u884c\u9f50\u6b21\u9664\u6cd5. \u6211\u4eec\u5df2\u7ecf\u7ea6\u5b9a\u5229\u7528\u9f50\u6b21\u5750\u6807$\\begin{bmatrix}<br \/>\nx &#038; y &#038; z &#038; 1<br \/>\n\\end{bmatrix}^T$\u8868\u793a\u70b9$(x, $$ y, z)$, \u5176\u989d\u5916\u7684$w$\u5206\u91cf\u603b\u4e3a1, \u8fd9\u662f\u901a\u8fc7\u5c06$\\begin{bmatrix}<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}$\u4f5c\u4e3a\u4eff\u5c04\u53d8\u6362\u77e9\u9635\u7684\u7b2c4\u884c\u6765\u4fdd\u8bc1\u7684.<br \/>\n$\\\\$ \u63a5\u4e0b\u6765, \u6211\u4eec\u6269\u5c55\u4e0a\u8ff0\u7ea6\u5b9a: \u9f50\u6b21\u5750\u6807$\\begin{bmatrix}<br \/>\nx &#038; y &#038; z &#038; w<br \/>\n\\end{bmatrix}^T$\u8868\u793a\u70b9$(x \/ w, $$ y \/ w, z \/ $$ w)$. \u5f53$w = 1$\u65f6, \u8fd9\u4e0e\u4e0a\u8ff0\u60c5\u5f62\u5e76\u65e0\u533a\u522b, \u4f46\u5f53\u4eff\u5c04\u53d8\u6362\u77e9\u9635\u7684\u7b2c4\u884c\u4e0d\u4e3a$\\begin{bmatrix}<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}$\u65f6, \u5219\u53ef\u4ee5\u5b9e\u73b0\u66f4\u591a\u53ef\u80fd\u7684\u53d8\u6362, \u4ece\u800c\u4f7f\u5f97\u6700\u7ec8\u8ba1\u7b97\u5f97\u5230\u7684$w$\u7684\u503c\u4e0d\u4e3a1.<br \/>\n$\\\\$ \u5177\u4f53\u6765\u8bf4, \u7ebf\u6027\u53d8\u6362\u5141\u8bb8\u8ba1\u7b97\u4e0b\u8ff0\u5f62\u5f0f\u7684\u8868\u8fbe\u5f0f$$x&#8217; = ax + by + cz,$$\u800c\u4eff\u5c04\u53d8\u6362\u5219\u5c06\u53ef\u8ba1\u7b97\u7684\u8868\u8fbe\u5f0f\u5f62\u5f0f\u6269\u5c55\u4e3a\u5982\u4e0b\u5f62\u5f0f$$x&#8217; = ax + by + cz + d.$$\u5c06$w$\u4f5c\u4e3a\u5206\u6bcd, \u80fd\u5c06\u53ef\u8ba1\u7b97\u7684\u8868\u8fbe\u5f0f\u5f62\u5f0f\u8fdb\u4e00\u6b65\u5730\u6269\u5c55\u4e3a\u5982\u4e0b\u5f62\u5f0f$$x&#8217; = \\frac{ax + by + cz + d}{ex + fy + gz + h};$$\u4e0a\u8ff0\u51fd\u6570\u53ef\u88ab\u79f0\u4e3a\u5173\u4e8e$x$, $y$\u4e0e$z$\u7684&#8221;\u7ebf\u6027\u6709\u7406\u51fd\u6570&#8221;. \u7136\u800c\u9700\u8981\u6ee1\u8db3\u4e00\u4e2a\u989d\u5916\u7684\u7ea6\u675f, \u5373\u5bf9\u4e8e\u53d8\u6362\u7684\u4f5c\u7528\u70b9\u7684\u6240\u6709\u5206\u91cf\u7684\u5206\u6bcd\u662f\u76f8\u540c\u7684:$$x&#8217; = \\frac{a_1 x + b_1 y + c_1 z + d_1}{ex + fy + gz + h}, \\\\ y&#8217; = \\frac{a_2 x + b_2 y + c_2 z + d_2}{ex + fy + gz + h}, \\\\ z&#8217; = \\frac{a_3 x + b_3 y + c_3 z + d_3}{ex + fy + gz + h}.$$\u7528\u77e9\u9635\u53d8\u6362\u7684\u8bed\u8a00\u53ef\u5c06\u4e0a\u5f0f\u5199\u4e3a$$\\begin{bmatrix}<br \/>\n\\widetilde{x} \\\\<br \/>\n\\widetilde{y} \\\\<br \/>\n\\widetilde{z} \\\\<br \/>\n\\widetilde{w}<br \/>\n\\end{bmatrix} = \\begin{bmatrix}<br \/>\na_1 &#038; b_1 &#038; c_1 &#038; d_1 \\\\<br \/>\na_2 &#038; b_2 &#038; c_2 &#038; d_2 \\\\<br \/>\na_3 &#038; b_3 &#038; c_3 &#038; d_3 \\\\<br \/>\ne &#038; f &#038; g &#038; h<br \/>\n\\end{bmatrix} \\begin{bmatrix}<br \/>\nx \\\\<br \/>\ny \\\\<br \/>\nz \\\\<br \/>\n1<br \/>\n\\end{bmatrix}, \\\\ (x&#8217;, y&#8217;, z&#8217;) = (\\widetilde{x} \/ \\widetilde{w}, \\widetilde{y} \/ \\widetilde{w}, \\widetilde{z} \/ \\widetilde{w}).$$\u8fd9\u6837\u7684\u53d8\u6362\u88ab\u79f0\u4e3a\u5c04\u5f71\u53d8\u6362\u6216\u5355\u5e94\u6027\u53d8\u6362.<br \/>\n$\\\\$ \u6709\u4e00\u79cd\u66f4\u4f18\u96c5\u7684\u65b9\u5f0f\u6765\u8868\u8fbe\u540c\u6837\u7684\u601d\u60f3, \u5b83\u907f\u514d\u4e86\u5bf9$w$\u5206\u91cf\u7684\u7279\u6b8a\u5904\u7406. \u5728\u8fd9\u79cd\u89c2\u70b9\u4e0b, \u4e00\u4e2a3\u7ef4\u6295\u5f71\u53d8\u6362\u5373\u4e3a\u4e00\u4e2a\u7b80\u5355\u76844\u7ef4\u7ebf\u6027\u53d8\u6362, \u9700\u8981\u6ee1\u8db3\u7684\u7ea6\u675f\u6761\u4ef6\u4e3a\u5448\u500d\u6570\u5173\u7cfb\u7684\u9f50\u6b21\u5750\u6807\u5747\u662f\u7b49\u4ef7\u7684:$$\\mathbf{x} \\sim \\alpha \\mathbf{x}, \\forall \\alpha \\ne 0,$$\u5176\u4e2d, $\\mathbf{x}$\u4e3a\u4e00\u4e2a\u9f50\u6b21\u5750\u6807, \u7b26\u53f7$\\sim$\u8868\u793a&#8221;\u7b49\u4ef7\u4e8e&#8221;, \u4e0a\u5f0f\u8868\u793a\u4e24\u4e2a\u5448\u500d\u6570\u5173\u7cfb\u7684\u9f50\u6b21\u5750\u6807\u5747\u63cf\u8ff0\u4e863\u7ef4\u7a7a\u95f4\u4e2d\u7684\u540c\u4e00\u70b9.<\/p>\n<p><strong>3. \u900f\u89c6\u6295\u5f71<\/strong><\/p>\n<p>\u5c04\u5f71\u53d8\u6362\u7684\u673a\u5236\u4f7f\u5f97\u5b9e\u73b0\u900f\u89c6\u6295\u5f71\u6240\u9700\u7684\u9664\u4ee5$z$\u5206\u91cf\u7684\u64cd\u4f5c\u53d8\u5f97\u7b80\u5355. \u5728\u56fe7.8\u6240\u793a\u76841\u7ef4\u900f\u89c6\u6295\u5f71\u7279\u70b9\u7684\u4f8b\u5b50\u4e2d, \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u77e9\u9635\u53d8\u6362\u6765\u5b9e\u73b0\u900f\u89c6\u6295\u5f71:$$\\begin{bmatrix}<br \/>\ny_s \\\\<br \/>\n1<br \/>\n\\end{bmatrix} \\sim \\begin{bmatrix}<br \/>\nd &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; 1 &#038; 0<br \/>\n\\end{bmatrix} \\begin{bmatrix}<br \/>\ny \\\\<br \/>\nz \\\\<br \/>\n1<br \/>\n\\end{bmatrix}.$$\u4e0a\u8ff0\u77e9\u9635\u5c062\u7ef4\u9f50\u6b21\u5750\u6807$\\begin{bmatrix}<br \/>\ny; &#038; z; &#038; 1<br \/>\n\\end{bmatrix}^T$\u53d8\u6362\u4e3a1\u7ef4\u9f50\u6b21\u5750\u6807$\\begin{bmatrix}<br \/>\ndy &#038; z<br \/>\n\\end{bmatrix}^T$, \u5b83\u8868\u793a1\u7ef4\u70b9$(dy \/ z)$.<br \/>\n$\\\\$ \u5bf9\u4e8e3D\u7a7a\u95f4\u4e2d\u7684\u900f\u89c6\u6295\u5f71\u77e9\u9635, \u6211\u4eec\u5c06\u91c7\u7528\u901a\u5e38\u7684\u7ea6\u5b9a, \u5373\u76f8\u673a\u4f4d\u4e8e\u539f\u70b9\u4e14\u9762\u671d$\u2212z$\u8f74\u7684\u65b9\u5411, \u6545\u89c6\u9525\u4f53\u5185\u7684\u70b9$(0, 0, z)$\u4e0e\u76f8\u673a\u7684\u8ddd\u79bb\u4e3a$\u2212z$. \u4e0e\u6b63\u4ea4\u6295\u5f71\u4e00\u6837, \u6211\u4eec\u4ea6\u91c7\u7528\u4e86\u8fdc\u8fd1\u5e73\u9762\u7684\u6982\u5ff5, \u8fd9\u9650\u5236\u4e86\u53ef\u89c6\u8303\u56f4. \u6b64\u5904, \u6211\u4eec\u5c06\u4f7f\u7528\u8fd1\u5e73\u9762\u4f5c\u4e3a\u6295\u5f71\u5e73\u9762, \u6545\u6295\u5f71\u5e73\u9762\u4e0e\u76f8\u673a\u7684\u8ddd\u79bb\u4e3a$-n$.<br \/>\n$\\\\$ \u56e0\u6b64, \u6240\u9700\u7684\u6620\u5c04\u4e3a$y_s = (n \/ z)y$, \u540c\u7406\u53ef\u5f97$x_s = (n \/ z)x$. \u8fd9\u79cd\u53d8\u6362\u53ef\u4ee5\u901a\u8fc7\u4e0b\u8ff0\u7684\u900f\u89c6\u53d8\u6362\u77e9\u9635(\u9700\u8981\u533a\u522b\u4e8e\u900f\u89c6\u6295\u5f71\u77e9\u9635) \u5b9e\u73b0:$$\\mathbf{P} = \\begin{bmatrix}<br \/>\nn &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; n &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; n + f &#038; -fn \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; 0<br \/>\n\\end{bmatrix}.$$\u901a\u8fc7\u4e0a\u8ff0\u900f\u89c6\u6295\u5f71\u77e9\u9635\u7684\u7b2c1\u884c, \u7b2c2\u884c\u4e0e\u7b2c4\u884c, \u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0\u7b80\u5355\u7684\u900f\u89c6\u53d8\u6362, \u4e0e\u6b63\u4ea4\u77e9\u9635, \u89c6\u53e3\u77e9\u9635\u7c7b\u4f3c, \u7b2c3\u884c\u662f\u4e3a\u4e86\u5f15\u5165\u5f85\u53d8\u6362\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf, \u4ee5\u6b64\u7528\u4e8eZ-Buffer\u5254\u9664. \u7136\u800c, \u5728\u900f\u89c6\u6295\u5f71\u4e2d, \u975e\u5e38\u91cf\u5206\u6bcd\u4f7f\u5f97\u5f85\u53d8\u6362\u70b9\u7684\u539f\u672c\u5750\u6807\u7684$z$\u5206\u91cf\u7684\u8fd8\u539f\u53d8\u5f97\u5341\u5206\u56f0\u96be. \u5b9e\u9645\u4e0a, \u5728\u8fd9\u8fc7\u7a0b\u4e2d, \u6211\u4eec\u51e0\u4e4e\u4e0d\u53ef\u80fd\u963b\u6b62\u5f85\u53d8\u6362\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u7684\u6539\u53d8. \u4f46\u9000\u4e00\u6b65\u5730, \u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u4ec5\u4fdd\u6301\u8fd1\u5e73\u9762\u4e0a\u6216\u8fdc\u5e73\u9762\u4e0a\u7684\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u4e0d\u53d8.<br \/>\n$\\\\$ \u6709\u8bb8\u591a\u77e9\u9635\u53ef\u4ee5\u4f5c\u4e3a\u900f\u89c6\u53d8\u6362\u77e9\u9635, \u5b83\u4eec\u90fd\u5bf9\u5f85\u53d8\u6362\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u8fdb\u884c\u4e86\u975e\u7ebf\u6027&#8221;\u626d\u66f2&#8221;. \u8fd9\u7c7b\u7279\u5b9a\u7684\u77e9\u9635\u5177\u6709\u826f\u597d\u7684\u7279\u6027: \u5b83\u4eec\u80fd\u591f\u5c06$(z $$ = n)$-\u5e73\u9762\u4e0a\u7684\u70b9\u4e0e$(z = f)$-\u5e73\u9762\u4e0a\u7684\u70b9\u4f9d\u65e7\u4fdd\u6301\u5728\u5404\u81ea\u6240\u5728\u7684\u5e73\u9762\u4e0a(\u5176\u5750\u6807\u7684$x$\u5206\u91cf\u4e0e$y$\u5206\u91cf\u5747\u7ecf\u8fc7\u4e86\u9002\u5f53\u8c03\u6574). \u900f\u89c6\u53d8\u6362\u77e9\u9635$\\mathbf{P}$\u5bf9\u70b9$(x, y, z)$\u7684\u53d8\u6362\u8fc7\u7a0b\u4e3a$$\\mathbf{P} \\begin{bmatrix}<br \/>\nx \\\\<br \/>\ny \\\\<br \/>\nz \\\\<br \/>\n1<br \/>\n\\end{bmatrix} = \\begin{bmatrix}<br \/>\nx \\\\<br \/>\ny \\\\<br \/>\nz \\frac{n + f}{n} &#8211; f \\\\<br \/>\n\\frac{z}{n}<br \/>\n\\end{bmatrix} \\sim \\begin{bmatrix}<br \/>\n\\frac{nx}{z} \\\\<br \/>\n\\frac{ny}{z} \\\\<br \/>\nn + f &#8211; \\frac{fn}{z} \\\\<br \/>\n1<br \/>\n\\end{bmatrix}.$$\u6709\u65f6\u6211\u4eec\u60f3\u8981\u8ba1\u7b97\u900f\u89c6\u53d8\u6362\u77e9\u9635$\\mathbf{P}$\u7684\u9006\u77e9\u9635, \u4f8b\u5982\u5f53\u6b32\u6839\u636e\u5c4f\u5e55\u7a7a\u95f4\u4e0b\u7684\u5e26\u6709$z$\u5206\u91cf\u7684\u5750\u6807\u8ba1\u7b97\u539f\u59cb\u7a7a\u95f4\u4e0b\u7684\u5750\u6807\u65f6. \u5176\u9006\u77e9\u9635\u4e3a$$\\mathbf{P}^{-1} = \\begin{bmatrix}<br \/>\n\\frac{1}{n} &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; \\frac{1}{n} &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1 \\\\<br \/>\n0 &#038; 0 &#038; -\\frac{1}{fn} &#038; -\\frac{n + f}{fn}<br \/>\n\\end{bmatrix}.$$\u7531\u4e8e\u4e00\u4e2a\u9f50\u6b21\u5750\u6807\u4e58\u4ee5\u4e00\u4e2a\u6807\u91cf\u5e76\u4e0d\u4f1a\u6539\u53d8\u6240\u8868\u793a\u7684\u7b1b\u5361\u5c14\u5750\u6807, \u6545\u5bf9\u4e8e\u4f5c\u7528\u4e8e\u9f50\u6b21\u5750\u6807\u7684\u53d8\u6362\u77e9\u9635\u4ea6\u662f\u5982\u6b64. \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e58\u4ee5$nf$\u628a\u9006\u77e9\u9635\u5199\u6210\u66f4\u6f02\u4eae\u7684\u5f62\u5f0f:$$\\mathbf{P}^{-1} = \\begin{bmatrix}<br \/>\nf &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; f &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; fn \\\\<br \/>\n0 &#038; 0 &#038; -1 &#038; n + f<br \/>\n\\end{bmatrix}.$$\u4ee5\u6b63\u4ea4\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{orth}$\u4e3a\u4f8b, \u5b83\u5c06Perspective View Volume(\u5f62\u72b6\u7c7b\u4f3c\u4e8e\u91d1\u5b57\u5854\u7684\u5207\u7247\u6216\u89c6\u9525\u4f53) \u6620\u5c04\u5230Orthographic View Volume(\u8f74\u5bf9\u9f50\u7684\u7acb\u65b9\u4f53). \u900f\u89c6\u53d8\u6362\u77e9\u9635$\\mathbf{P}$\u7684\u7f8e\u5999\u4e4b\u5904\u5728\u4e8e, \u5b83\u53ef\u4ee5\u7ed3\u5408\u6b63\u4ea4\u6295\u5f71\u77e9\u9635\u6765\u83b7\u5f97Canonical View Volume, \u5373$$\\mathbf{M}_{per} = \\mathbf{M}_{orh} \\mathbf{P}.$$\u800c\u6211\u4eec\u6240\u6dfb\u52a0\u7684\u53ea\u662f\u4e00\u4e2a\u77e9\u9635\u4e0e\u9664\u4ee5$w$\u5206\u91cf\u7684\u64cd\u4f5c. \u66f4\u91cd\u8981\u7684\u662f, \u6211\u4eec\u53ef\u4ee5\u5145\u5206\u5229\u7528$4 \\times 4$\u7684\u900f\u89c6\u53d8\u6362\u77e9\u9635$\\mathbf{P}$\u7684\u6700\u540e\u4e00\u884c.<br \/>\n$\\\\$ \u7136\u800c, \u6709\u4e00\u4e2a\u95ee\u9898\u662f: \u5982\u4f55\u8ba1\u7b97\u900f\u89c6\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{per}$\u4e2d\u7684$l$, $r$, $b$\u4e0e$t$? \u5b83\u4eec\u786e\u5b9a\u4e86\u6211\u4eec\u89c2\u770b\u7684&#8221;\u7a97\u53e3&#8221;. \u7531\u4e8e\u900f\u89c6\u6295\u5f71\u77e9\u9635\u5e76\u4e0d\u4f1a\u6539\u53d8$(z = n)$\u5e73\u9762\u4e0a\u7684\u70b9\u7684\u5750\u6807\u7684$x$\u5206\u91cf\u4e0e$y$\u5206\u91cf, \u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u5728\u8be5\u5e73\u9762\u4e0a\u8ba1\u7b97$(l, r, b, $$ t)$.<br \/>\n$\\\\$ \u4e3a\u4e86\u5c06\u900f\u89c6\u53d8\u6362\u77e9\u9635$\\mathbf{P}$\u6574\u5408\u5230\u6211\u4eec\u7684\u6b63\u4ea4\u6295\u5f71\u6d41\u7a0b\u4e2d, \u6211\u4eec\u4ec5\u9700\u5c06\u900f\u89c6\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{per}$\u66ff\u6362\u4e3a\u6b63\u4ea4\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{orh}$, \u5373\u5728\u5e94\u7528\u76f8\u673a\u53d8\u6362\u77e9\u9635$\\mathbf{M}_{cam}$\u4e4b\u540e, \u6b63\u4ea4\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{orh}$\u4e4b\u524d\u5e94\u7528\u900f\u89c6\u53d8\u6362\u77e9\u9635$\\mathbf{P}$. \u7efc\u4e0a\u6240\u8ff0, \u900f\u89c6\u53d8\u6362\u7684\u5b8c\u6574\u6d41\u7a0b\u5982\u4e0b\u6240\u793a,$$\\mathbf{M} = \\mathbf{M}_{vp} \\mathbf{M}_{orh} \\mathbf{P} \\mathbf{M}_{cam},$$\u5176\u4e2d, \u900f\u89c6\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{per} = \\mathbf{M}_{orh} \\mathbf{P}$\u7684\u5f62\u5f0f\u5982\u4e0b\u6240\u793a:$$\\mathbf{M}_{per} = \\begin{bmatrix}<br \/>\n\\frac{2n}{r- l} &#038; 0 &#038; \\frac{l + r}{l &#8211; r} &#038; 0 \\\\<br \/>\n0 &#038; \\frac{2n}{t &#8211; b} &#038; \\frac{b + t}{b &#8211; t} &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; \\frac{f + n}{n &#8211; f} &#038; \\frac{2fn}{f &#8211; n} \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; 0<br \/>\n\\end{bmatrix}.$$\u7c7b\u4f3c\u7684\u77e9\u9635\u7ecf\u5e38\u51fa\u73b0\u5728\u6587\u732e\u4e2d, \u4f46\u5b83\u4eec\u901a\u5e38\u4ec5\u662f\u51e0\u4e2a\u7b80\u5355\u77e9\u9635\u7684\u4e58\u79ef, \u5e76\u975e\u60f3\u8c61\u4e2d\u7684\u5982\u6b64\u96be\u4ee5\u7406\u89e3.<\/p>\n<p><strong>4. \u900f\u89c6\u53d8\u6362\u7684\u4e00\u4e9b\u6027\u8d28<\/strong><\/p>\n<p>\u900f\u89c6\u53d8\u6362\u7684\u4e00\u4e2a\u91cd\u8981\u6027\u8d28\u4fbf\u662f\u5b83\u5c06\u76f4\u7ebf\u53d8\u6362\u4e3a\u76f4\u7ebf, \u5c06\u5e73\u9762\u53d8\u6362\u4e3a\u5e73\u9762. \u6b64\u5916, \u5b83\u5c06View Volume\u4e2d\u7684\u7ebf\u6bb5\u53d8\u6362\u4e3aCanonical Volume\u4e2d\u7684\u7ebf\u6bb5. \u4e3a\u4e86\u7406\u89e3\u8fd9\u4e00\u70b9, \u8003\u8651\u7ebf\u6bb5$$\\mathbf{q} + t(\\mathbf{Q} &#8211; \\mathbf{q}).$$\u5f53\u7528\u4e00\u4e2a$4 \\times 4$\u7684\u77e9\u9635$\\mathbf{M}$\u5bf9\u4e0a\u8ff0\u7ebf\u6bb5\u4e0a\u7684\u70b9\u8fdb\u884c\u53d8\u6362\u65f6, \u6211\u4eec\u53ef\u5f97\u4e00\u4e2a\u9f50\u6b21\u5750\u6807\u53ef\u80fd\u53d8\u5316\u7684\u70b9:$$\\mathbf{M} \\mathbf{q} + t(\\mathbf{M} \\mathbf{Q} &#8211; \\mathbf{M} \\mathbf{q}) \\equiv \\mathbf{r} + t(\\mathbf{R} &#8211; \\mathbf{r}).$$\u7ecf\u53d8\u6362\u540e\u7684\u7ebf\u6bb5\u4e0a\u7684\u70b9\u7684\u9f50\u6b21\u5750\u6807\u4e3a$$\\frac{\\mathbf{r} + t(\\mathbf{R} &#8211; \\mathbf{r})}{w_\\mathbf{r} + t(w_\\mathbf{R} &#8211; w_\\mathbf{r})}.$$\u82e5\u4e0a\u5f0f\u53ef\u5199\u4e3a\u5982\u4e0b\u5f62\u5f0f$$\\frac{\\mathbf{r}}{w_\\mathbf{r}} + f(t)(\\frac{\\mathbf{R}}{w_\\mathbf{R}} &#8211; \\frac{\\mathbf{r}}{w_\\mathbf{r}}),$$\u5219\u6240\u6709\u7684\u7ecf\u53d8\u6362\u540e\u7684\u7ebf\u6bb5\u4e0a\u7684\u70b9\u5747\u4f4d\u4e8e\u4e00\u67613D\u76f4\u7ebf\u4e0a.\u6613\u77e5, \u4ee4$$f(t) = \\frac{w_\\mathbf{R} t}{w_\\mathbf{r} + t(w_\\mathbf{R} &#8211; w_\\mathbf{r})}$$\u5373\u53ef\u6ee1\u8db3\u8981\u6c42.<\/p>\n<p><strong>5. \u89c6\u91ce(Field-of-View, \u7b80\u79f0FOV)<\/strong><\/p>\n<p>\u867d\u7136\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528$(l, r, b, t)$\u4e0e$n$\u5b9a\u4e49\u4efb\u610f\u7a97\u53e3, \u4f46\u6709\u65f6\u6211\u4eec\u5e0c\u671b\u6709\u4e00\u4e2a\u66f4\u7b80\u5355\u7684\u7cfb\u7edf, \u5728\u8be5\u7cfb\u7edf\u4e0b\u76f8\u673a\u4f4d\u4e8e\u7a97\u53e3\u4e2d\u5fc3, \u4e14\u671d\u5411\u5c4f\u5e55\u5916, \u8fd9\u610f\u5473\u7740\u9700\u8981\u589e\u52a0\u5982\u4e0b\u7ea6\u675f:$$l = -r, \\\\ b = -t.$$\u82e5\u6211\u4eec\u8fd8\u52a0\u4e0a\u50cf\u7d20\u5f62\u72b6\u4e3a\u6b63\u65b9\u5f62\u7684\u7ea6\u675f, \u5373\u56fe\u50cf\u7981\u6b62\u51fa\u73b0\u5f62\u72b6\u7578\u53d8\u7684\u95ee\u9898, \u90a3\u4e48$r$\u4e0e$t$\u7684\u6bd4\u503c\u5fc5\u987b\u7b49\u4e8e\u6c34\u5e73\u65b9\u5411\u4e0a\u7684\u50cf\u7d20\u6570\u91cf\u4e0e\u7ad6\u76f4\u65b9\u5411\u4e0a\u7684\u50cf\u7d20\u6570\u91cf\u7684\u6bd4\u503c:$$\\frac{n_x}{n_y} = \\frac{r}{t}.$$\u4e00\u65e6\u6307\u5b9a\u4e86\u6c34\u5e73\u65b9\u5411\u4e0a\u7684\u50cf\u7d20\u6570\u91cf$n_x$\u4e0e\u7ad6\u76f4\u65b9\u5411\u4e0a\u7684\u50cf\u7d20\u6570\u91cf$n_y$, \u5219\u4ec5\u5269\u4e0b\u4e00\u4e2a\u81ea\u7531\u5ea6, \u6211\u4eec\u901a\u5e38\u4f7f\u7528FOV $\\theta$\u6765\u8bbe\u7f6e, \u5982\u4e0b\u56fe\u6240\u793a. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/vertical_FOV.png\" alt=\"\" width=\"821\" height=\"384\" class=\"aligncenter size-full wp-image-3148\" srcset=\"https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/vertical_FOV.png 821w, https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/vertical_FOV-300x140.png 300w, https:\/\/www.caiqinyi.cn\/wp-content\/uploads\/2023\/04\/vertical_FOV-768x359.png 768w\" sizes=\"(max-width: 821px) 100vw, 821px\" \/><\/p>\n<p>$\\theta$\u6709\u65f6\u4ea6\u88ab\u79f0\u4e3a\u7ad6\u76f4\u65b9\u5411\u4e0a\u7684FOV, \u4ee5\u533a\u522b\u4e8e\u5de6\u53f3\u4e24\u8fb9\u7684\u5939\u89d2\u6216\u5bf9\u89d2\u4e4b\u95f4\u7684\u5939\u89d2. \u4ece\u56fe\u4e2d\u6211\u4eec\u53ef\u4ee5\u770b\u5230$$tan \\frac{\\theta}{2} = \\frac{t}{|n|}.$$\u82e5$n$\u4e0e\u7ad6\u76f4\u65b9\u5411\u4e0a\u7684FOV $\\theta$\u662f\u786e\u5b9a\u7684, \u90a3\u4e48\u6211\u4eec\u53ef\u5f97$t$. \u4e00\u822c\u6765\u8bf4, $n$\u7684\u503c\u662f\u56fa\u5b9a\u7684, \u5982\u6b64\u4e00\u6765, \u5b9a\u4e49\u7a97\u53e3\u7684\u81ea\u7531\u5ea6\u4e5f\u4fbf\u5c11\u4e86\u4e00\u4e2a.<\/p>\n<p><strong>6. \u5e38\u89c1\u95ee\u9898<\/strong><\/p>\n<p><strong>\u95ee1:<\/strong> \u6b63\u4ea4\u6295\u5f71\u5728\u5b9e\u8df5\u4e2d\u6709\u7528\u5417?<br \/>\n$\\\\$ <strong>\u7b541:<\/strong> \u6b63\u4ea4\u6295\u5f71\u5728\u9700\u8981\u8fdb\u884c\u76f8\u5bf9\u957f\u5ea6\u5224\u65ad\u7684\u5e94\u7528\u573a\u666f\u4e2d\u5341\u5206\u6709\u7528. \u6b64\u5916, \u5b83\u8fd8\u53ef\u4ee5\u7b80\u5316\u67d0\u4e9b\u533b\u5b66\u53ef\u89c6\u5316\u5e94\u7528\u7a0b\u5e8f\u4e2d\u900f\u89c6\u6295\u5f71\u5f00\u9500\u8fc7\u4e8e\u6602\u8d35\u7684\u90e8\u5206.<\/p>\n<p><strong>\u95ee2:<\/strong> \u5728\u900f\u89c6\u89c6\u56fe\u4e2d\u7ed8\u5236\u7684\u7ec6\u5206\u7403\u4f53\u770b\u8d77\u6765\u50cf\u4e00\u4e2a\u692d\u7403\u4f53, \u8fd9\u662f\u4e00\u4e2aBug\u5417?<br \/>\n$\\\\$ <strong>\u7b542:<\/strong> \u8fd9\u662f\u6b63\u786e\u7684. \u82e5\u628a\u89c6\u70b9\u653e\u7f6e\u4e8e\u76f8\u673a\u5904, \u5219\u7ec6\u5206\u7403\u4f53\u770b\u8d77\u6765\u4fbf\u50cf\u4e00\u4e2a\u692d\u7403\u4f53.<\/p>\n<p><strong>\u95ee3:<\/strong> \u900f\u89c6\u53d8\u6362\u77e9\u9635\u662f\u5426\u4f1a\u6539\u53d8\u5f85\u53d8\u6362\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u7684\u7b26\u53f7? \u82e5\u662f\u7684\u8bdd, \u8fd9\u79cd\u6027\u8d28\u662f\u5426\u4f1a\u4ea7\u751f\u95ee\u9898\u5462?<br \/>\n$\\\\$ <strong>\u7b543:<\/strong> \u4e0d\u4e00\u5b9a. \u7ecf\u53d8\u6362\u540e\u7684\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u4e3a$$z&#8217; = n + f &#8211; \\frac{fn}{z}.$$\u6545\u53ef\u4ee5\u786e\u5b9a\u7684\u662f, \u5f53$z = + \\epsilon$\u65f6, $z&#8217; = -\\infty$; \u800c\u5f53$z = &#8211; \\epsilon$\u65f6, $z&#8217; = \\infty$. \u56e0\u6b64, \u5c3d\u7ba1\u6240\u67093D\u70b9\u90fd\u5c06\u88ab\u6295\u5c04\u5230\u5c4f\u5e55\u7a7a\u95f4\u4e0a, \u4f46\u4efb\u610f\u542b\u5750\u6807\u7684$z$\u5206\u91cf\u4e3a0\u7684\u70b9\u7684\u7ebf\u6bb5\u90fd\u5c06\u88ab&#8221;\u6495\u88c2&#8221;(\u8df3\u8dc3\u95f4\u65ad\u70b9). \u5bf9\u4e8eViewing Volume(\u5176\u6240\u6709\u7aef\u70b9\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u6784\u6210\u7684\u533a\u95f4\u4e0d\u5305\u542b0) \u5185\u7684\u5f85\u53d8\u6362\u70b9, \u662f\u4e0d\u4f1a\u4ea7\u751f&#8221;\u6495\u88c2&#8221; \u73b0\u8c61\u7684. \u800c\u5bf9\u4e8eViewing Volume\u5916\u7684\u70b9, \u5219\u9700\u8981\u8fdb\u884c\u88c1\u526a. \u6362\u53e5\u8bdd\u8bf4, &#8220;\u6495\u88c2&#8221; \u73b0\u8c61\u4f7f\u88c1\u526a\u672c\u8eab\u53d8\u5f97\u66f4\u52a0\u590d\u6742.<\/p>\n<p><strong>\u95ee4:<\/strong> \u900f\u89c6\u53d8\u6362\u77e9\u9635\u6539\u53d8\u9f50\u6b21\u5750\u6807\u7684$w$\u5206\u91cf, \u8fd9\u662f\u5426\u4f1a\u4f7f\u5f97\u5e73\u79fb\u53d8\u6362\u4e0e\u7f29\u653e\u53d8\u6362\u4e0d\u518d\u6b63\u5e38\u5de5\u4f5c?<br \/>\n$\\\\$ <strong>\u7b544:<\/strong> \u5c06\u4e00\u4e2a\u5e73\u79fb\u53d8\u6362\u77e9\u9635\u4f5c\u7528\u4e8e\u9f50\u6b21\u5750\u6807\u4e0a, \u6211\u4eec\u53ef\u5f97$$\\begin{bmatrix}<br \/>\n1 &#038; 0 &#038; 0 &#038; t_x \\\\<br \/>\n0 &#038; 1 &#038; 0 &#038; t_y \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; t_z \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix} \\begin{bmatrix}<br \/>\nhx \\\\<br \/>\nhy \\\\<br \/>\nhz \\\\<br \/>\nh<br \/>\n\\end{bmatrix} = \\begin{bmatrix}<br \/>\nhx + ht_x \\\\<br \/>\nhy + ht_y \\\\<br \/>\nhz + ht_z \\\\<br \/>\nh<br \/>\n\\end{bmatrix} \\xrightarrow[]{homogenize} \\begin{bmatrix}<br \/>\nx + t_x \\\\<br \/>\ny + t_y \\\\<br \/>\nz + t_z \\\\<br \/>\n1<br \/>\n\\end{bmatrix}.$$\u540c\u7406\u53ef\u77e5, \u5f53\u4e00\u4e2a\u7f29\u653e\u53d8\u6362\u77e9\u9635\u4f5c\u7528\u4e8e\u9f50\u6b21\u5750\u6807\u4e0a\u65f6, \u4ea6\u53ef\u6b63\u5e38\u5de5\u4f5c.<\/p>\n<p><strong>7. \u76f8\u5173\u4e60\u9898<\/strong><\/p>\n<p><strong>7.1<\/strong> \u6784\u5efa\u4e00\u4e2a\u89c6\u53e3\u53d8\u6362\u77e9\u9635, \u5176\u4f5c\u7528\u7684\u50cf\u7d20\u5750\u6807\u7684$y$\u5206\u91cf\u662f\u4ece\u56fe\u50cf\u81ea\u9876\u5411\u4e0b\u9012\u589e\u7684.<br \/>\n$\\\\$ <strong>\u89e3:<\/strong> \u5c06\u539f\u89c6\u53e3\u53d8\u6362\u77e9\u9635$\\mathbf{M}_{vp}$\u4e2d\u7684$n_y$\u66ff\u6362\u4e3a$1 &#8211; n_y$\u5373\u53ef\u5f97$$\\mathbf{M}_{vp}&#8217; = \\begin{bmatrix}<br \/>\n\\frac{n_x}{2} &#038; 0 &#038; 0 &#038; \\frac{n_x &#8211; 1}{2} \\\\<br \/>\n0 &#038; \\frac{1 &#8211; n_y}{2} &#038; 0 &#038; \\frac{-n_y}{2} \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}.$$<br \/>\n<strong>7.2<\/strong> \u5c06\u6b63\u4ea4\u6295\u5f71\u77e9\u9635\u4e0e\u89c6\u53e3\u53d8\u6362\u77e9\u9635\u76f8\u4e58.<br \/>\n$\\\\$ <strong>\u89e3:<\/strong> \u6613\u77e5, \u89c6\u53e3\u53d8\u6362\u77e9\u9635\u4e3a$$\\mathbf{M}_{vp} = \\begin{bmatrix}<br \/>\n\\frac{n_x}{2} &#038; 0 &#038; 0 &#038; \\frac{n_x &#8211; 1}{2} \\\\<br \/>\n0 &#038; \\frac{n_y}{2} &#038; 0 &#038; \\frac{n_y &#8211; 1}{2} \\\\<br \/>\n0 &#038; 0 &#038; 1 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix},$$\u6b63\u4ea4\u6295\u5f71\u77e9\u9635\u4e3a$$\\mathbf{M}_{orh} = \\begin{bmatrix}<br \/>\n\\frac{2}{r &#8211; l} &#038; 0 &#038; 0 &#038; -\\frac{r + l}{r &#8211; l} \\\\<br \/>\n0 &#038; \\frac{2}{t &#8211; b} &#038; 0 &#038; -\\frac{t + b}{t &#8211; b} \\\\<br \/>\n0 &#038; 0 &#038; \\frac{2}{n &#8211; f} &#038; -\\frac{n + f}{n &#8211; f} \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix},$$\u5c06\u4e0a\u8ff0\u4e24\u4e2a\u77e9\u9635\u76f8\u4e58\u53ef\u5f97,$$\\mathbf{M}_{orh} \\mathbf{M}_{vp} = \\begin{bmatrix}<br \/>\n\\frac{n_x}{r &#8211; l} &#038; 0 &#038; 0 &#038; -\\frac{l n_x}{r &#8211; l} &#8211; \\frac{1}{2} \\\\<br \/>\n0 &#038; \\frac{n_y}{t &#8211; b} &#038; 0 &#038; -\\frac{b n_y}{t &#8211; b} &#8211; \\frac{1}{2}\\\\<br \/>\n0 &#038; 0 &#038; \\frac{2}{n &#8211; f} &#038; -\\frac{n + f}{n &#8211; f} \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}.$$\u4e0d\u59a8\u8bb0$$x_h = r, x_l = l, \\\\ x_h&#8217; = n_x &#8211; \\frac{1}{2}, x_l&#8217; = -\\frac{1}{2}, \\\\ y_h = t, y_l = b, \\\\ y_h&#8217; = n_y &#8211; \\frac{1}{2}, y_l&#8217; = -\\frac{1}{2}, \\\\ z_h = n, z_l = g, \\\\ z_h&#8217; = 1, z_l&#8217; = -1,$$\u5219\u4e0a\u8ff0\u6b63\u4ea4\u6295\u5f71\u77e9\u9635$\\mathbf{M}_{orh}$\u4e0e\u89c6\u53e3\u53d8\u6362\u77e9\u9635$\\mathbf{M}_{vp}$\u76f8\u4e58\u7684\u7ed3\u679c\u53ef\u7b80\u8bb0\u4e3a$$\\begin{bmatrix}<br \/>\n\\frac{x_h&#8217; &#8211; x_l&#8217;}{x_h &#8211; x_l} &#038; 0 &#038; 0 &#038; \\frac{x_l&#8217; x_h &#8211; x_h&#8217; x_l}{x_h &#8211; x_l} \\\\<br \/>\n0 &#038; \\frac{y_h&#8217; &#8211; y_l&#8217;}{y_h &#8211; y_l} &#038; 0 &#038; \\frac{y_l&#8217; y_h &#8211; y_h&#8217; y_l}{y_h &#8211; y_l} \\\\<br \/>\n0 &#038; 0 &#038; \\frac{z_h&#8217; &#8211; z_l&#8217;}{z_h &#8211; z_l} &#038; \\frac{z_l&#8217; z_h &#8211; z_h&#8217; z_l}{z_h &#8211; z_l} \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix}.$$<br \/>\n<strong>7.3<\/strong> \u8bc1\u660e\u7ecf\u6b63\u4ea4\u6295\u5f71\u53d8\u6362\u540e, \u8fd1\u5e73\u9762\u4e0a\u7684\u70b9\u4f9d\u65e7\u5728\u8fd1\u5e73\u9762\u4e0a, \u8fdc\u5e73\u9762\u4e0a\u7684\u70b9\u4f9d\u65e7\u5728\u8fdc\u5e73\u9762\u4e0a.<br \/>\n$\\\\$ <strong>\u8bc1:<\/strong> \u5c06\u4e00\u4e2a\u6b63\u4ea4\u6295\u5f71\u77e9\u9635\u4f5c\u7528\u4e8e\u8fd1\u5e73\u9762\u4e0a\u7684\u70b9\u7684\u9f50\u6b21\u5750\u6807\u4e0a, \u6211\u4eec\u53ef\u5f97$$\\mathbf{M}_{orh} \\mathbf{x} = \\begin{bmatrix}<br \/>\n\\frac{2}{r &#8211; l} &#038; 0 &#038; 0 &#038; -\\frac{r + l}{r &#8211; l} \\\\<br \/>\n0 &#038; \\frac{2}{t &#8211; b} &#038; 0 &#038; -\\frac{t + b}{t &#8211; b} \\\\<br \/>\n0 &#038; 0 &#038; \\frac{2}{n &#8211; f} &#038; -\\frac{n + f}{n &#8211; f} \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; 1<br \/>\n\\end{bmatrix} \\begin{bmatrix}<br \/>\nx \\\\<br \/>\ny \\\\<br \/>\nn \\\\<br \/>\n1<br \/>\n\\end{bmatrix} = \\begin{bmatrix}<br \/>\n\\frac{2}{r &#8211; l} x &#8211; \\frac{r + l}{r &#8211; l}\\\\<br \/>\n\\frac{2}{t &#8211; b} y &#8211; \\frac{t + b}{t &#8211; b} \\\\<br \/>\n1 \\\\<br \/>\n1<br \/>\n\\end{bmatrix}.$$\u6545\u7ecf\u6b63\u4ea4\u6295\u5f71\u53d8\u6362\u540e, \u8fd1\u5e73\u9762\u4e0a\u7684\u70b9\u4f9d\u65e7\u5728\u8fd1\u5e73\u9762\u4e0a. \u540c\u7406\u53ef\u5f97, \u7ecf\u6b63\u4ea4\u6295\u5f71\u53d8\u6362\u540e, \u8fdc\u5e73\u9762\u4e0a\u7684\u70b9\u4f9d\u65e7\u5728\u8fdc\u5e73\u9762\u4e0a. \u547d\u9898\u5f97\u8bc1.<\/p>\n<p><strong>7.4<\/strong> \u4f7f\u7528\u4ee3\u6570\u65b9\u6cd5\u8bc1\u660e\u900f\u89c6\u77e9\u9635\u80fd\u591f\u4fdd\u6301\u5f85\u53d8\u6362\u70b9\u5728View Volume\u5185\u7684\u5750\u6807\u7684$z$\u5206\u91cf\u987a\u5e8f.<br \/>\n$\\\\$ <strong>\u8bc1:<\/strong> \u6295\u5f71\u53d8\u6362\u662f\u6574\u4e2a\u6e32\u67d3\u7ba1\u7ebf\u91cc, \u8bbe\u8ba1\u5f97\u6700\u590d\u6742\u7684, \u4e5f\u6700\u5de7\u5999\u7684\u4e00\u6b21\u53d8\u6362. \u5176\u5b9e\u57fa\u672c\u7406\u89e3\u4e86\u8fd9\u4e9b\u53d8\u6362, \u5bf9\u6574\u4e2a\u6e32\u67d3\u7ba1\u7ebf\u5c31\u6709\u4e86\u5927\u6982\u7684\u8ba4\u8bc6\u4e86. \u63a5\u4e0b\u6765\u6211\u4eec\u4e00\u6b65\u6b65\u6765\u8ba8\u8bba, \u4e3a\u4ec0\u4e48\u6295\u5f71\u53d8\u6362\u77e9\u9635\u8981\u8fd9\u4e48\u8bbe\u8ba1? \u4e3a\u4ec0\u4e48\u88c1\u526a\u5728\u900f\u89c6\u9664\u6cd5\u4e4b\u524d? \u4e3a\u4ec0\u4e48\u89c2\u5bdf\u5750\u6807\u7cfb\u662f\u53f3\u624b\u5750\u6807\u7cfb? \u5982\u4f55\u5b9e\u73b0\u7684\u8fd1\u5927\u8fdc\u5c0f? \u5982\u4f55\u5b9e\u73b0\u7684Early-Z?<\/p>\n<p><strong>7.4.1 \u6295\u5f71\u53d8\u6362\u7684\u76ee\u7684<\/strong><\/p>\n<p>\u5750\u6807\u8f6c\u6362\u5230\u89c2\u5bdf\u7a7a\u95f4\u540e, \u7531\u4e8e\u76f4\u63a5\u4f7f\u7528\u6444\u50cf\u673a\u7684\u5e73\u622a\u5934\u4f53\u8fdb\u884c\u88c1\u526a\u6bd4\u8f83\u590d\u6742(\u5e73\u622a\u5934\u4f53\u7684\u8fb9\u754c\u65b9\u7a0b\u6c42\u4ea4\u56f0\u96be), \u6240\u4ee5\u9700\u8981\u5c06\u5176\u8f6c\u5316\u5230\u88c1\u526a\u7a7a\u95f4(Clip\u7a7a\u95f4).<br \/>\n$\\\\$ \u4ece\u89c2\u5bdf\u7a7a\u95f4\u5230\u88c1\u526a\u7a7a\u95f4\u7684\u53d8\u6362\u53eb\u505a\u6295\u5f71\u53d8\u6362.<br \/>\n$\\\\$ \u88c1\u526a\u7a7a\u95f4\u53d8\u6362\u7684\u601d\u8def\u662f, \u5bf9\u5e73\u622a\u5934\u4f53\u8fdb\u884c\u7f29\u653e, \u4f7f\u8fd1\u88c1\u526a\u9762\u548c\u8fdc\u88c1\u526a\u9762\u53d8\u6210\u6b63\u65b9\u5f62, \u4f7f\u5750\u6807\u7684$w$\u5206\u91cf\u8868\u793a\u88c1\u526a\u8303\u56f4, \u6b64\u65f6, \u53ea\u9700\u8981\u7b80\u5355\u7684\u6bd4\u8f83$x$, $y$, $z$\u548c$w$\u5206\u91cf\u7684\u5927\u5c0f\u5373\u53ef\u88c1\u526a\u56fe\u5143.<br \/>\n$\\\\$ \u867d\u7136\u53eb\u505a\u6295\u5f71\u53d8\u6362, \u4f46\u662f\u6295\u5f71\u53d8\u6362\u5e76\u6ca1\u6709\u8fdb\u884c\u771f\u6b63\u7684\u6295\u5f71.<\/p>\n<p><strong>7.4.2 \u900f\u89c6\u6295\u5f71\u53d8\u6362\u52062\u6b65:<\/strong><\/p>\n<p>$\\cdot$ \u4eceFrustum\u5185\u4e00\u70b9\u6295\u5f71\u5230\u8fd1\u526a\u88c1\u5e73\u9762.<br \/>\n$\\\\$ $\\cdot$ \u7531\u8fd1\u526a\u88c1\u5e73\u9762\u7f29\u653e\u6210\u89c4\u5219\u89c2\u5bdf\u4f53(Canonical View Volume), CVV\u7a7a\u95f4, \u5f97\u5230Clip\u5750\u6807(\u6b64\u65f6\u6ca1\u6709\u9664\u4ee5$w$\u53d8\u62103D\u5750\u6807, \u662f\u9f50\u6b21\u5750\u6807).<br \/>\n$\\\\$ \u76f8\u673a\u7a7a\u95f4\u4e2d\u7684\u9876\u70b9, \u5982\u679c\u5728\u89c6\u9525\u4f53\u4e2d, \u5219\u53d8\u6362\u540e\u5c31\u5728CVV\u4e2d. \u5982\u679c\u5728\u89c6\u9525\u4f53\u5916, \u53d8\u6362\u540e\u5c31\u5728CVV\u5916. CVV\u672c\u8eab\u7684\u89c4\u5219\u6027\u5bf9\u4e8e\u591a\u8fb9\u5f62\u7684\u88c1\u526a\u5f88\u6709\u5229.<\/p>\n<p><strong>7.4.3 \u900f\u89c6\u6295\u5f71\u63a8\u5bfc<\/strong><\/p>\n<p>\u6295\u5f71\u5750\u6807\u7cfb\u6709\u4e24\u79cd\u77e9\u9635: \u900f\u89c6\u77e9\u9635\u548c\u6b63\u4ea4\u77e9\u9635, \u6211\u4eec\u9009\u62e9OpenGL\u7684\u900f\u89c6\u6295\u5f71\u53d8\u6362\u8fdb\u884c\u5206\u6790:<br \/>\n$\\\\$ <strong>1) \u7b2c\u4e00\u6b65: \u6295\u5f71\u5230\u8fd1\u526a\u88c1\u5e73\u9762<\/strong><br \/>\n$\\\\$ \u6211\u4eec\u5148\u4ece\u4e00\u4e2a\u65b9\u5411\u8003\u5bdf\u6295\u5f71\u5173\u7cfb. \u8bbe$\\mathbf{P}(x, z)$\u662f\u7ecf\u8fc7\u76f8\u673a\u53d8\u6362\u4e4b\u540e\u7684\u70b9, \u89c6\u9525\u4f53\u7531\u773c\u775b\u4f4d\u7f6eEye, \u8fd1\u88c1\u526a\u5e73\u9762$np$\u4e0e\u8fdc\u88c1\u526a\u5e73\u9762$fp$\u7ec4\u6210. \u6b64\u5916, $N$\u662f\u773c\u775b\u5230\u8fd1\u88c1\u526a\u5e73\u9762\u7684\u8ddd\u79bb, $F$\u662f\u773c\u775b\u5230\u8fdc\u88c1\u526a\u5e73\u9762\u7684\u8ddd\u79bb, \u9009\u62e9\u8fd1\u88c1\u526a\u5e73\u9762\u4f5c\u4e3a\u6295\u5f71\u5e73\u9762. \u8bbe$\\mathbf{P&#8221;}(x&#8221;, z&#8221;)$\u662f\u6295\u5f71\u4e4b\u540e\u7684\u70b9, \u5219\u6709$z&#8217; = -N$. \u901a\u8fc7\u76f8\u4f3c\u4e09\u89d2\u5f62\u6027\u8d28:$$x \/ x&#8217; = z \/ z&#8217; = z \/ -N,$$\u6240\u4ee5$$x&#8217; = -N * x \/ z.$$\u540c\u7406, \u6709$$y&#8217; = -N * y \/ z.$$\u8fd9\u6837, \u6211\u4eec\u4fbf\u5f97\u5230\u4e86$\\mathbf{P}$\u6295\u5f71\u540e\u7684\u70b9$\\mathbf{P&#8217;}$,$$\\mathbf{P&#8217;} = (-N * x \/ z, -N * y \/ z, -N).$$\u4ece\u4e0a\u9762\u53ef\u4ee5\u770b\u51fa, \u5f53Frustum\u5185\u7684\u70b9\u6295\u5f71\u5230\u8fd1\u526a\u88c1\u5e73\u9762\u7684\u65f6\u5019, \u6295\u5f71\u7684\u7ed3\u679c$z&#8221;$\u59cb\u7ec8\u7b49\u4e8e$-N$, \u5728\u6295\u5f71\u9762\u4e0a. \u5b9e\u9645\u4e0a, $z&#8221;$\u5bf9\u4e8e\u6295\u5f71\u540e\u7684$\\mathbf{P&#8221;}$\u5df2\u7ecf\u6ca1\u6709\u610f\u4e49\u4e86. \u6b64\u5904, \u70b9$\\mathbf{P&#8221;}$\u7531$\\mathbf{P}$\u6295\u5f71\u540e\u7684\u70b9$\\mathbf{P&#8217;}$\u5ffd\u7565$y$\u5206\u91cf\u540e\u5f97\u5230.<br \/>\n$\\\\$ <strong>2) \u5145\u5206\u5229\u7528$z&#8217;$\u503c, \u4e00\u6b65\u6b65\u5bf9$z&#8217;$\u6539\u9020<\/strong><br \/>\n$\\\\$ $\\cdot$ \u540e\u9762\u5728\u8fdb\u5165\u7247\u5143\u64cd\u4f5c\u4e4b\u524d\u8fd8\u6709Early-Z\u6d4b\u8bd5, \u6709\u5fc5\u8981\u628a\u6295\u5f71\u4e4b\u524d\u7684$z$\u4fdd\u5b58\u4e0b\u6765, \u65b9\u4fbf\u540e\u9762\u4f7f\u7528.<br \/>\n$\\\\$ \u6240\u6709\u4f4d\u4e8e\u7ebf\u6bb5$\\mathbf{P&#8217;} \\mathbf{P}$\u4e0a\u7684\u70b9, \u6700\u7ec8\u90fd\u4f1a\u6295\u5f71\u5230$\\mathbf{P&#8217;}$\u70b9, \u90a3\u4e48\u5982\u679c\u8fd9\u6761\u7ebf\u6bb5\u4e0a\u6709\u591a\u4e2a\u70b9, \u5982\u4f55\u786e\u5b9a\u6700\u7ec8\u4fdd\u7559\u54ea\u4e00\u4e2a\u5462? \u5f53\u7136\u662f\u79bb\u89c2\u5bdf\u8fd9\u6700\u8fd1\u7684\u8fd9\u4e2a\u4e86, \u4e5f\u5c31\u662f\u6df1\u5ea6\u503c($z$\u503c) \u6700\u5c0f\u7684. \u6240\u4ee5$z&#8217;$\u5750\u6807\u9700\u8981\u4fdd\u5b58$\\mathbf{P&#8217;}$\u70b9\u7684$z$\u503c. \u90a3\u4e48$$\\mathbf{P&#8217;} = (-N * x \/ z, -N * y \/ z, z).$$\u53c8\u56e0\u4e3a\u5728\u5149\u6805\u5316\u4e4b\u524d, \u6211\u4eec\u9700\u8981\u5bf9$z$\u5750\u6807\u8fdb\u884c\u63d2\u503c.<br \/>\n$\\\\$ $\\cdot$ \u540e\u9762\u6295\u5f71\u4e4b\u540e\u7684\u5149\u6805\u5316\u9636\u6bb5, \u8981\u901a\u8fc7$x&#8217;$\u548c$y&#8217;$\u5bf9$z$\u8fdb\u884c\u7ebf\u6027\u63d2\u503c, \u4ee5\u6c42\u51fa\u4e09\u89d2\u5f62\u5185\u90e8\u7247\u5143\u7684$z$, \u8fdb\u884cZ\u7f13\u51b2\u6df1\u5ea6\u6d4b\u8bd5.<br \/>\n$\\\\$ \u4ece$x&#8217; = -N * x \/ z$\u53ef\u4ee5\u770b\u51fa, \u6295\u5f71\u540e\u7684$x&#8217;$\u548c$y&#8217;$, \u4e0e$z$\u4e0d\u662f\u7ebf\u6027\u5173\u7cfb, \u4e0e$1 \/ z$\u624d\u662f\u7ebf\u6027\u5173\u7cfb. \u6240\u4ee5\u7528$1 \/ z$\u7684\u7ebf\u6027\u7ec4\u5408\u503c\u548c$x&#8217;$, $y&#8217;$\u4e00\u8d77\u63d2\u503c\u624d\u662f\u6b63\u786e\u7684.<br \/>\n$\\\\$ $\\cdot$ <strong>\u540c\u65f6\u4e3a\u4e86\u4fdd\u8bc1\u8fd1\u5904\u7cbe\u5ea6\u66f4\u9ad8, \u6211\u4eec\u4f7f\u7528$z$\u5750\u6807\u7684\u7684\u5012\u6570<\/strong>$$z&#8217; = 1 \/ z.$$$\\cdot$ $\\mathbf{P&#8217;}$\u76843\u4e2a\u4ee3\u6570\u5206\u91cf\u7edf\u4e00\u5730\u9664\u4ee5\u5206\u6bcd$-z$, \u6613\u4e8e\u4f7f\u7528\u9f50\u6b21\u5750\u6807\u53d8\u4e3a\u666e\u901a\u5750\u6807\u6765\u5b8c\u6210.<br \/>\n$\\\\$ \u6240\u4ee5: \u6211\u4eec\u6682\u65f6\u5f97\u5230\u7684\u65b0\u7684\u70b9$\\mathbf{P&#8217;}$\u8868\u793a\u4e3a:$$\\mathbf{P&#8217;} = (-N * x \/ z, -N * y \/ z, -1 \/ z).$$<strong>3) \u7b2c2\u6b65: \u7f29\u653e\u5230CVV\u7a7a\u95f4<\/strong><br \/>\n$\\\\$ CVV\u662f\u4e00\u4e2a$x$, $y$, $z$\u7684\u8303\u56f4\u90fd\u4e3a[-1, 1]\u7684\u89c4\u5219\u4f53, \u4fbf\u4e8e\u8fdb\u884c\u591a\u8fb9\u5f62\u88c1\u526a.<br \/>\n$\\\\$ <strong>\u6211\u4eec\u5148\u4e0d\u7ba1$x$\u548c$y$, \u5148\u6620\u5c04$z$\u5230[-1, 1]\u4e4b\u95f4. \u8981\u8fdb\u884c\u6620\u5c04\uff0c\u5e38\u7528\u7684\u4e3b\u8981\u662fWrap\u548c\u7ebf\u6027\u6620\u5c04, \u6211\u4eec\u76f4\u63a5\u4f7f\u7528\u7ebf\u6027\u516c\u5f0f:<\/strong><br \/>\n$\\\\$ \u6211\u4eec\u5bf9$-1 \/ z$\u9002\u5f53\u7684\u9009\u62e9\u7cfb\u6570$a$\u548c$b$, \u4e5f\u5c31\u662f$$a + b * (-1 \/ z),$$\u8fd9\u4e2a\u5f0f\u5b50\u5728$z = -N$\u7684\u65f6\u5019\u503c\u4e3a-1, \u800c\u5728$z = -F$\u7684\u65f6\u5019\u503c\u4e3a1, \u4ece\u800c\u5728$z$\u65b9\u5411\u4e0a\u6784\u5efaCVV.<br \/>\n$\\\\$\u6240\u4ee5\u6700\u7ec8\u8bb0\u5f55\u7684$\\mathbf{P}$\u7684$z$\u503c:$$z&#8217; = -(a + b\/ z),$$\u6240\u4ee5: \u6211\u4eec\u5f97\u5230\u7684\u65b0\u7684\u70b9\u6682\u65f6\u8868\u793a\u4e3a:$$\\mathbf{P&#8217;} = (-N \\frac{x}{z}, -N \\frac{y}{z}, -\\frac{az + b}{z}).$$\u6211\u4eec\u4e3a\u4e86\u5728GPU\u4e2d\u8fd0\u7b97\u66f4\u5feb, \u540c\u65f6\u80fd\u5408\u5e76\u4e4b\u524d\u7684\u77e9\u9635\u53d8\u6362, \u6240\u4ee5\u6211\u4eec\u6700\u7ec8\u8981\u4f7f\u7528\u77e9\u9635\u5f62\u5f0f\u6765\u505a\u900f\u89c6\u53d8\u6362. \u6240\u4ee5\u8fd9\u4e00\u6b65\u8fd8\u662f\u8981\u8f6c\u4e3a\u9f50\u6b21\u5750\u6807$$\\mathbf{P&#8217;} = (-N * x \/ z, -N * y \/ z, -(a + b \/ z), 1).$$\u5bf9\u4e8e\u9f50\u6b21\u5750\u6807, \u6211\u4eec\u53ef\u4ee5\u5bf9\u6240\u6709\u9879\u4e58\u4ee5\u4e00\u4e2a\u76f8\u540c\u7684\u503c, \u4e0d\u4f1a\u6539\u53d8\u4ed6\u7684\u4f4d\u7f6e.$$\\mathbf{P&#8217;} = \\mathbf{P&#8217;} * (-z) = (N * x, N * y, (az + b), -z).$$<strong>\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u51d1\u51fa\u4e0b\u9762\u7684\u77e9\u9635\u4e58\u6cd5:<\/strong>$$\\begin{pmatrix}<br \/>\nN &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; N &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; a &#038; b \\\\<br \/>\n0 &#038; 0 &#038; -1 &#038; 0<br \/>\n\\end{pmatrix} \\begin{pmatrix}<br \/>\nx \\\\<br \/>\ny \\\\<br \/>\nz \\\\<br \/>\n1<br \/>\n\\end{pmatrix} = \\begin{pmatrix}<br \/>\nNx \\\\<br \/>\nNy \\\\<br \/>\naz + b \\\\<br \/>\n-z<br \/>\n\\end{pmatrix} \\sim \\begin{pmatrix}<br \/>\n-Nx \/ z \\\\<br \/>\n-Ny \/ z \\\\<br \/>\n-(az + b) \/ z \\\\<br \/>\n1<br \/>\n\\end{pmatrix},$$\u8fd9\u4e00\u6b65\u5728\u900f\u89c6\u6295\u5f71\u8fc7\u7a0b\u4e2d\u79f0\u4e3a\u900f\u89c6\u9664\u6cd5(Perspective Division), \u8fd9\u662f\u900f\u89c6\u6295\u5f71\u53d8\u6362\u7684\u7b2c2\u6b65, \u7ecf\u8fc7\u8fd9\u4e00\u6b65, \u5c31\u4e22\u5f03\u4e86\u539f\u59cb\u7684$z$\u503c(\u5f97\u5230\u4e86CVV\u4e2d\u5bf9\u5e94\u7684$z$\u503c), \u9876\u70b9\u624d\u7b97\u5b8c\u6210\u4e86\u6295\u5f71. \u800c\u5728\u8fd9\u4e24\u6b65\u4e4b\u95f4\u7684\u5c31\u662fCVV\u88c1\u526a\u8fc7\u7a0b, \u6240\u4ee5\u88c1\u526a\u7a7a\u95f4\u4f7f\u7528\u7684\u662f\u9f50\u6b21\u5750\u6807.<br \/>\n$\\\\$ <strong>\u4e3a\u4ec0\u4e48\u4e0d\u628a\u900f\u89c6\u9664\u6cd5\u6574\u5408\u5230\u77e9\u9635\u4e2d?<\/strong> \u6211\u4eec\u5728\u540e\u9762\u8be6\u7ec6\u8ba8\u8bba\u539f\u56e0.<br \/>\n$\\\\$ \u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u6c42\u51fa$a$\u548c$b$: \u56e0\u4e3aCVV\u662f-1\u52301\u8303\u56f4, \u6240\u4ee5:$$-\\frac{az + b}{z} = \\left\\{\\begin{matrix}<br \/>\n-1, &#038; when \\ z = -N, \\\\<br \/>\n1, &#038; when \\ z = -F.<br \/>\n\\end{matrix}\\right.$$\u6240\u4ee5:$$a = -\\frac{F + N}{F &#8211; N}, \\\\ b = \\frac{-2FN}{F &#8211; N}.$$\u6211\u4eec\u5f97\u5230\u4e86\u900f\u89c6\u6295\u5f71\u77e9\u9635\u7684\u7b2c\u4e00\u4e2a\u7248\u672c:$$\\begin{pmatrix}<br \/>\nN &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; N &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; a &#038; b \\\\<br \/>\n0 &#038; 0 &#038; -1 &#038; 0<br \/>\n\\end{pmatrix},$$\u5176\u4e2d, $a = -\\frac{F + N}{F &#8211; N}$, $b = \\frac{-2FN}{F &#8211; N}.$<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9e\u5728\u662f\u60ed\u6127, \u6700\u8fd1\u51e0\u5468\u5b9e\u5728\u662f\u6709\u70b9\u5fd9(\u4e3b\u8981\u56e0\u4e3a\u5468\u672b\u4e5f\u8fc7\u5b81\u6ce2\u4e86\u2026\u2026), \u5bfc\u81f4\u4e5f\u633a\u4e45\u6ca1\u66f4\u65b0\u535a\u5ba2\u4e86. \u672c\u6765\u60f3\u7740\u4eca\u5929\u7ee7\u7eed &hellip; <a href=\"https:\/\/www.caiqinyi.cn\/index.php\/2023\/04\/22\/viewing_mark\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Viewing\u6ce8\u8bb0(\u5148\u5360\u4e2a\u5751\u2026\u2026)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/posts\/3101"}],"collection":[{"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/comments?post=3101"}],"version-history":[{"count":30,"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/posts\/3101\/revisions"}],"predecessor-version":[{"id":3122,"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/posts\/3101\/revisions\/3122"}],"wp:attachment":[{"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/media?parent=3101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/categories?post=3101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.caiqinyi.cn\/index.php\/wp-json\/wp\/v2\/tags?post=3101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}