{"id":6540,"date":"2026-10-09T14:17:08","date_gmt":"2026-10-09T06:17:08","guid":{"rendered":"https:\/\/blog.coolcoding.cn\/?p=6540"},"modified":"2026-10-09T14:27:07","modified_gmt":"2026-10-09T06:27:07","slug":"urp-forward","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=6540","title":{"rendered":"URP Forward+"},"content":{"rendered":"\n<p>\u5728 URP \u4e2d\uff0c<strong>Forward+\uff08\u524d\u5411\u52a0\uff09<\/strong> \u6e32\u67d3\u8def\u5f84\u7684\u5b9e\u73b0\u6838\u5fc3\u5728 <code>ForwardLights.cs<\/code> \u811a\u672c\u4e2d\uff0c\u5e76\u501f\u52a9\u4e86 Unity Jobs (Burst \u7f16\u8bd1) \u5b9e\u73b0\u4e86\u57fa\u4e8e\u5c4f\u5e55\u7a7a\u95f4 Tile \u548c Z-Bin \u7684\u591a\u7ebf\u7a0b\u5254\u9664\u4e0e\u706f\u5149\u5206\u914d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u6570\u636e\u7ed3\u6784\u4e0e\u7f13\u51b2\u533a\u521d\u59cb\u5316<\/h3>\n\n\n\n<p>\u5728 Forward+ \u6a21\u5f0f\u4e0b (<code>m_UseForwardPlus == true<\/code>)\uff0c\u4e0d\u518d\u50cf\u4f20\u7edf\u524d\u5411\u6e32\u67d3\u90a3\u6837\u4ec5\u4f9d\u8d56\u5168\u5c40\u7684\u9010\u7269\u4f53\u706f\u5149\u5217\u8868\u3002<code>ForwardLights<\/code> \u4f1a\u8c03\u7528 <code>CreateForwardPlusConstantBuffers()<\/code> \u7533\u8bf7\u4e13\u95e8\u7684 GPU \u6570\u636e\u7ed3\u6784\uff1a<\/p>\n\n\n\n<ul>\n<li><strong><code>m_ZBins<\/code>&nbsp;\u548c&nbsp;<code>m_ZBinsBuffer<\/code><\/strong>\uff1a\u7528\u4e8e\u6309\u6df1\u5ea6 (Z) \u5207\u5206\u5c4f\u5e55\u7a7a\u95f4\uff0c\u8bb0\u5f55\u4e0d\u540c\u6df1\u5ea6\u8303\u56f4\u5185\u7684\u706f\u5149\u4fe1\u606f\u3002<\/li>\n\n\n\n<li><strong><code>m_TileMasks<\/code>&nbsp;\u548c&nbsp;<code>m_TileMasksBuffer<\/code><\/strong>\uff1a\u7528\u4e8e\u6309 2D \u7f51\u683c\u5207\u5206\u5c4f\u5e55\uff08\u5373 Tile\uff09\uff0c\u63a9\u7801\uff08Mask\uff09\u4f4d\u7528\u4e8e\u6807\u8bb0\u6bcf\u4e2a\u5c4f\u5e55\u5206\u5757\u91cc\u6709\u54ea\u4e9b\u5c40\u90e8\u5149\u6e90\u6216\u53cd\u5c04\u63a2\u9488\u3002<\/li>\n\n\n\n<li>\u989d\u5916\u5b9e\u4f8b\u5316\u4e86&nbsp;<code>ReflectionProbeManager<\/code>&nbsp;\u7528\u4e8e\u7edf\u4e00\u7ba1\u7406\u53cd\u5c04\u63a2\u9488\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u591a\u7ebf\u7a0b\u5c4f\u5e55\u7a7a\u95f4\u706f\u5149\u5206\u914d (Clustering Jobs)<\/h3>\n\n\n\n<p>\u5728\u6bcf\u5e27\u7684\u51c6\u5907\u9636\u6bb5 (<code>PreSetup<\/code> \u4e2d\u8c03\u7528 <code>ScheduleClusteringJobs<\/code>)\uff0cURP \u907f\u514d\u4e86\u5728\u4e3b\u7ebf\u7a0b\u8fdb\u884c\u6602\u8d35\u7684\u5149\u7167\u6c42\u4ea4\u6d4b\u8bd5\uff0c\u800c\u662f\u6d3e\u53d1\u4e86\u51e0\u4e2a\u9ad8\u6548\u7684 C# Jobs\uff1a<\/p>\n\n\n\n<ul>\n<li><strong><code>TilingJob<\/code><\/strong>\uff1a\u5e76\u884c\u904d\u5386\u5f53\u524d\u6444\u50cf\u673a\u5185\u7684\u53ef\u89c1\u5149\u548c\u53cd\u5c04\u63a2\u9488\u3002\u5b83\u4f1a\u5c06\u5149\u6e90\u7684\u4f5c\u7528\u8303\u56f4\uff08\u70b9\u5149\u7403\u4f53\u6216\u805a\u5149\u9525\u4f53\uff09\u6295\u5f71\u5230\u76f8\u673a\u7684\u89c6\u9525\u4f53\u9762\u4e0a\uff0c\u5e76\u8ba1\u7b97\u5176\u5728 Y \u8f74\u548c\u6df1\u5ea6\u4e0a\u7684 Tile \u8986\u76d6\u8fb9\u754c\u3002<\/li>\n\n\n\n<li><strong><code>TileRangeExpansionJob<\/code><\/strong>\uff1a\u63a5\u6536\u4e0a\u4e00\u6b65\u8ba1\u7b97\u7684\u8303\u56f4\uff0c\u5c06\u5176\u5c55\u5f00\u5e76\u5408\u5e76\u3002\u5b83\u4e3a\u6bcf\u4e2a Tile \u751f\u6210 uint \u4f4d\u63a9\u7801 (<code>tileMasks<\/code>)\u3002\u63a9\u7801\u4e0a\u7684\u6bcf\u4e00\u201c\u4f4d(bit)\u201d\u4ee3\u8868\u8be5 Tile \u662f\u5426\u53d7\u5230\u67d0\u76cf\u7279\u5b9a\u5c40\u90e8\u5149\u7684\u5f71\u54cd\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u8df3\u8fc7\u4f20\u7edf\u9010\u7269\u4f53\u5149\u7167\u7d22\u5f15<\/h3>\n\n\n\n<p>\u4f20\u7edf\u7684\u524d\u5411\u6e32\u67d3 (<code>Forward<\/code>) \u4f1a\u5728 CPU \u7aef\u8ba1\u7b97\u6bcf\u4e00\u4e2a\u7269\u4f53\u5177\u4f53\u53d7\u54ea\u51e0\u76cf\u706f\u5149\u5f71\u54cd\uff0c\u5e76\u628a\u8fd9\u4e9b\u7d22\u5f15\u5199\u8fdb\u4e00\u4e2a <code>LightIndexMap<\/code>\u3002<\/p>\n\n\n\n<p>\u5728 <code>ForwardLights.cs<\/code> \u7684 <code>SetupPerObjectLightIndices<\/code> \u51fd\u6570\u4e2d\u53ef\u4ee5\u770b\u5230\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (lightData.additionalLightsCount == 0 || m_UseForwardPlus)\n    return lightData.additionalLightsCount;\n<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u542f\u7528\u4e86 Forward+\uff0c\u5f15\u64ce\u76f4\u63a5\u8df3\u8fc7\u4e86\u751f\u6210 <code>GetLightIndexMap<\/code> \u7684\u903b\u8f91\u3002\u8fd9\u6b63\u662f Forward+ \u7684\u6838\u5fc3\u4f18\u52bf\u2014\u2014\u5b83\u5c06\u5149\u7167\u5206\u914d\u95ee\u9898\u4ece\u201c\u9010\u7269\u4f53 (Per-Object)\u201d\u8f6c\u79fb\u5230\u4e86\u201c\u5c4f\u5e55\u7a7a\u95f4\u5206\u5757 (Per-Tile)\u201d\u4e0a\uff0c\u89e3\u51b3\u4e86\u591a\u5149\u6e90\u4e0b\u7531\u4e8e\u7269\u4f53\u4ea4\u9519\u5bfc\u81f4\u7684\u5149\u7167\u4e0a\u9650\u548c CPU \u6027\u80fd\u74f6\u9888\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. GPU \u6570\u636e\u4e0a\u4f20\u4e0e\u5b8f\u5207\u6362<\/h3>\n\n\n\n<p>\u6e32\u67d3\u547d\u4ee4\u771f\u6b63\u6267\u884c\u524d\uff08<code>SetupLights<\/code> \u51fd\u6570\u4e2d\uff09\uff1a<\/p>\n\n\n\n<ul>\n<li>\u9996\u5148\u8c03\u7528&nbsp;<code>m_CullingHandle.Complete()<\/code>&nbsp;\u7b49\u5f85\u591a\u7ebf\u7a0b\u5206\u5757\u5254\u9664\u4efb\u52a1\u8dd1\u5b8c\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528&nbsp;<code>SetData<\/code>&nbsp;\u628a CPU \u7b97\u597d\u7684&nbsp;<code>m_ZBins<\/code>&nbsp;\u548c&nbsp;<code>m_TileMasks<\/code>&nbsp;\u6570\u7ec4\u5168\u91cf\u538b\u5165 GPU \u7684 Constant Buffer\uff08\u5728 Shader \u4e2d\u4f53\u73b0\u4e3a&nbsp;<code>_ZBinBuffer<\/code>&nbsp;\u548c&nbsp;<code>_TileBuffer<\/code>\uff09\u3002<\/li>\n\n\n\n<li>\u901a\u8fc7 CommandBuffer \u4e3a\u5168\u5c40\u542f\u7528 Shader \u53d8\u4f53\u5b8f\u3002\u4e3b\u8981\u5173\u952e\u5b57\u4e3a\u00a0<code>_CLUSTER_LIGHT_LOOP<\/code>\uff08\u65e7\u7248\u517c\u5bb9\u6807\u8bb0\u4e3a\u00a0<code>_FORWARD_PLUS<\/code>\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>URP \u7684 Forward+ \u5b9e\u73b0\u5c06\u573a\u666f\u7684\u5149\u7167\u7ba1\u7406\u53d8\u6210\u4e86\u7c7b\u4f3c\u8ba1\u7b97\u7740\u8272\u5668\uff08Compute Shader\uff09\u4e2d\u7684 <strong>Tile-based Light Culling<\/strong> \u903b\u8f91\uff0c\u4f46\u662f\u5b83\u662f\u5229\u7528 CPU (Unity Job System + Burst Compiler) \u6765\u5e76\u884c\u5b8c\u6210\u706f\u5149\u89c6\u9525\u4f53\u6c42\u4ea4\u7684\uff0c\u7136\u540e\u5c06\u751f\u6210\u7684 Tile \u63a9\u7801\u548c\u6df1\u5ea6 Bin \u4ee5 Constant Buffer \u5f62\u5f0f\u63d0\u4ea4\u7ed9 GPU\u3002\u6700\u540e\uff0c\u7247\u6bb5\u7740\u8272\u5668 (Fragment Shader) \u53ea\u9700\u8981\u6839\u636e\u5f53\u524d\u50cf\u7d20\u7684\u5c4f\u5e55\u5750\u6807\u548c\u6df1\u5ea6\uff0c\u67e5\u8868\u83b7\u53d6\u5f53\u524d Tile \u4e2d\u53d7\u5f71\u54cd\u7684\u706f\u5149 Mask\uff0c\u53ea\u5faa\u73af\u5904\u7406\u6709\u5f71\u54cd\u7684\u5149\u6e90\u5373\u53ef\uff0c\u4ece\u800c\u5927\u5e45\u63d0\u5347\u4e86\u591a\u5c40\u90e8\u5149\u6e90\u573a\u666f\u7684\u6e32\u67d3\u6027\u80fd\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5728 Forward+ \u5b9e\u73b0\u4e2d\uff0c<strong>\u6ca1\u6709\u4f7f\u7528 Compute Shader (<code>.compute<\/code>) \u6765\u505a\u706f\u5149\u7684\u88c1\u526a\u4e0e\u5206\u5757 (Clustering)<\/strong>\u3002\u5b83\u7684\u5206\u5757\u7b97\u6cd5\uff08Tile \u4e0e Z-Bin \u5212\u5206\uff09\u7eaf\u7cb9\u662f\u9760 CPU \u7aef\u7684 C# Job System\uff08\u914d\u5408 Burst \u7f16\u8bd1\u5668\uff09\u6765\u5b8c\u6210\u7684\uff0c\u6b63\u5982\u6211\u4eec\u5728\u4e0a\u4e00\u6b65\u4e2d\u770b\u5230\u7684 <code>TilingJob<\/code> \u548c <code>TileRangeExpansionJob<\/code>\u3002<\/p>\n\n\n\n<p>\u867d\u7136\u6ca1\u6709\u4f7f\u7528 Compute Shader \u505a\u5254\u9664\uff0c\u4f46\u5728<strong>\u6e32\u67d3\u7740\u8272\u5668 (Rendering Shaders)<\/strong> \u8fd9\u4e00\u4fa7\uff0cForward+ \u7684\u8bfb\u53d6\u903b\u8f91\u5341\u5206\u5de7\u5999\uff0c\u8fd9\u5957\u673a\u5236\u7c7b\u4f3c\u4e8e\u4e00\u4e9b\u73b0\u4ee3\u5f15\u64ce\u4e2d\u901a\u8fc7 Compute Shader \u5199\u5165\u7684\u6570\u636e\u7ed3\u6784\u3002\u4ee5\u4e0b\u662f\u6e32\u67d3 Shader \u7aef\u5982\u4f55\u914d\u5408 Forward+ \u5de5\u4f5c\u7684\u6df1\u5ea6\u89e3\u6790\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u5b8f\u5f00\u5173\uff1a<code>_CLUSTER_LIGHT_LOOP<\/code><\/h3>\n\n\n\n<p>\u51e0\u4e4e\u6240\u6709\u7684 URP \u6807\u51c6\u7740\u8272\u5668\uff08\u5982 <code>Lit.shader<\/code>\uff0c<code>ComplexLit.shader<\/code>\uff0c\u690d\u88ab\u548c\u7c92\u5b50 Shader \u7b49\uff09\u90fd\u5305\u542b\u4e0b\u9762\u8fd9\u53e5\u53d8\u4f53\u58f0\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#pragma multi_compile _ _CLUSTER_LIGHT_LOOP\n<\/code><\/pre>\n\n\n\n<p>\u5f53 C# \u7aef\u542f\u7528\u4e86 Forward+\uff0c\u5c31\u4f1a\u5168\u5c40\u5f00\u542f\u8fd9\u4e2a\u5b8f\uff0c\u4ece\u800c\u6539\u53d8 Shader \u5185\u90e8\u904d\u5386\u989d\u5916\u5149\u6e90\uff08Additional Lights\uff09\u7684\u65b9\u5f0f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u6838\u5fc3\u8fed\u4ee3\u5668\uff1a<code>Clustering.hlsl<\/code><\/h3>\n\n\n\n<p>\u5728 Shader \u7aef\u89e3\u6790 Forward+ \u6570\u636e\u7ed3\u6784\u7684\u6838\u5fc3\u903b\u8f91\u5b58\u653e\u5728 <code>Packages\/com.unity.render-pipelines.universal\/ShaderLibrary\/Clustering.hlsl<\/code> \u4e2d\u3002\u8fd9\u91cc\u5b9a\u4e49\u4e86\u4e00\u4e2a\u975e\u5e38\u9ad8\u6548\u7684 <code>ClusterIterator<\/code>\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">A. \u7a7a\u95f4\u6620\u5c04\u5b9a\u4f4d<\/h4>\n\n\n\n<p>\u5728 <code>ClusterInit<\/code> \u51fd\u6570\u4e2d\uff0cShader \u9700\u8981\u77e5\u9053\u5f53\u524d\u6b63\u5728\u6e32\u67d3\u7684\u50cf\u7d20\u5c5e\u4e8e\u54ea\u4e2a Tile \u548c\u54ea\u4e2a Z-Bin\uff1a<\/p>\n\n\n\n<ul>\n<li><strong>\u6c42 Tile Index<\/strong>\uff1a\u6839\u636e\u5f53\u524d\u50cf\u7d20\u7684\u5c4f\u5e55\u7a7a\u95f4 UV (<code>normalizedScreenSpaceUV<\/code>) \u4e58\u4ee5 Tile \u7684\u6a2a\u7eb5\u6570\u91cf\uff0c\u76f4\u63a5\u7b97\u51fa\u5f53\u524d\u7684 2D \u7d22\u5f15\u3002<\/li>\n\n\n\n<li><strong>\u6c42 Z-Bin Index<\/strong>\uff1a\u6839\u636e\u5f53\u524d\u7247\u5143\u5728\u89c2\u5bdf\u7a7a\u95f4 (View Space) \u4e2d\u7684\u6df1\u5ea6\u503c&nbsp;<code>viewZ<\/code>\uff0c\u6620\u5c04\u51fa\u4e00\u4e2a\u5bf9\u6570\u6df1\u5ea6\u7684\u7d22\u5f15&nbsp;<code>zBinIndex<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">B. \u6570\u636e\u67e5\u8868\u4e0e\u4f4d\u8fd0\u7b97\u63a9\u7801<\/h4>\n\n\n\n<p>CPU \u4f20\u8fc7\u6765\u7684\u706f\u5149\u6570\u636e\u5b58\u5728\u5168\u5c40 Buffer \u91cc\u9762 (<code>urp_Tiles<\/code> \u548c <code>urp_ZBins<\/code>)\uff0c\u6bcf\u4e2a\u706f\u5149\u5206\u914d\u5360\u636e\u63a9\u7801\u4e2d\u7684\u4e00\u4f4d\uff081 bit\uff09\u3002 Shader \u4e2d\u5c06 Tile \u7684\u4f4d\u63a9\u7801\u548c Z-Bin \u7684\u4f4d\u63a9\u7801\u8fdb\u884c**\u6309\u4f4d\u4e0e\uff08Bitwise AND\uff09**\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>it.tileMask = Select4(asuint(urp_Tiles&#91;tileWordIndex \/ 4]), ...) &amp; \n              Select4(asuint(urp_ZBins&#91;zBinWordIndex \/ 4]), ...);\n<\/code><\/pre>\n\n\n\n<p>\u5f97\u51fa\u7684 <code>tileMask<\/code> \u4e2d\uff0c\u53ea\u8981\u4e3a <code>1<\/code> \u7684\u4f4d\uff0c\u5c31\u4ee3\u8868\u8fd9\u76cf\u706f\u5149\u65e2\u6295\u5f71\u5230\u4e86\u5f53\u524d\u50cf\u7d20\u7684 2D \u5c4f\u5e55\u5757\u5185\uff0c\u4e5f\u843d\u5728\u4e86\u5f53\u524d\u50cf\u7d20\u6df1\u5ea6\u7684\u5207\u7247\u8303\u56f4\u5185\uff0c\u610f\u5473\u7740\u8be5\u706f\u5149\u786e\u5b9e\u7167\u4eae\u4e86\u5f53\u524d\u50cf\u7d20\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">C. \u9ad8\u6548\u904d\u5386 (<code>ClusterNext<\/code>)<\/h4>\n\n\n\n<p>\u5f97\u5230\u63a9\u7801\u540e\uff0cShader \u5229\u7528\u5185\u7f6e\u786c\u4ef6\u6307\u4ee4 <code>firstbitlow()<\/code> \u5feb\u901f\u627e\u5230\u63a9\u7801\u4e2d\u6700\u4f4e\u4f4d\u7684 <code>1<\/code>\uff08\u5373\u4e0b\u4e00\u4e2a\u5f71\u54cd\u8be5\u50cf\u7d20\u7684\u706f\u5149\u7d22\u5f15\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>uint bitIndex = firstbitlow(it.tileMask);\nit.tileMask ^= (1u &lt;&lt; bitIndex); \/\/ \u6e05\u9664\u8be5\u4f4d\uff0c\u51c6\u5907\u627e\u4e0b\u4e00\u76cf\u706f\nentityIndex = ... + bitIndex;\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e00\u6b65\u5b8c\u5168\u907f\u514d\u4e86\u65e0\u6548\u5faa\u73af\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5149\u7167\u8ba1\u7b97\u5faa\u73af (<code>RealtimeLights.hlsl<\/code>&nbsp;\/&nbsp;<code>Lighting.hlsl<\/code>)<\/h3>\n\n\n\n<p>\u5728\u4f20\u7edf\u7684\u524d\u5411\u6e32\u67d3\u4e2d\uff0c\u7247\u5143\u7740\u8272\u5668 (Fragment Shader) \u662f\u901a\u8fc7\u76f4\u63a5\u5faa\u73af\u5f53\u524d\u7269\u4f53\u7684\u706f\u5149\u5217\u8868\u6765\u8ba1\u7b97\u5149\u7167\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u4f20\u7edf\u505a\u6cd5\uff08\u4f2a\u4ee3\u7801\uff09\nint pixelLightCount = GetAdditionalLightsCount();\nfor (int i = 0; i &lt; pixelLightCount; ++i) {\n    Light light = GetAdditionalLight(i, positionWS);\n    \/\/ ... \u7d2f\u52a0\u5149\u7167 ...\n}\n<\/code><\/pre>\n\n\n\n<p>\u4f46\u5728 Forward+ \u6a21\u5f0f\uff08\u5b9a\u4e49\u4e86 <code>USE_CLUSTER_LIGHT_LOOP<\/code>\uff09\u4e0b\uff0c\u4e0a\u9762\u7684\u4ee3\u7801\u4f1a\u88ab\u66ff\u6362\u4e3a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Forward+ \u505a\u6cd5\uff08\u4f2a\u4ee3\u7801\uff09\nClusterIterator it = ClusterInit(screenUV, positionWS, 0);\nuint lightIndex;\nwhile (ClusterNext(it, lightIndex)) {\n    Light light = GetAdditionalLight(lightIndex, positionWS);\n    \/\/ ... \u7d2f\u52a0\u5149\u7167 ...\n}\n<\/code><\/pre>\n\n\n\n<p>\u5728 URP \u7684 Forward+ \u67b6\u6784\u4e2d\uff0c\u5f15\u64ce\u523b\u610f<strong>\u907f\u5f00\u4e86\u5728 GPU \u7aef\u4f7f\u7528 Compute Shader \u505a\u5254\u9664<\/strong>\u3002\u8fd9\u662f\u56e0\u4e3a\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u591a\u7aef\u517c\u5bb9\u6027\u8003\u91cf<\/strong>\uff1a Compute Shader \u7684\u652f\u6301\u5728\u4f4e\u7aef\u79fb\u52a8\u7aef\u6216\u90e8\u5206 WebGL \u5e73\u53f0\u4e0a\u4f9d\u7136\u6709\u9650\u3002<\/li>\n\n\n\n<li><strong>\u5229\u7528\u591a\u6838 CPU \u7684\u95f2\u7f6e\u7b97\u529b<\/strong>\uff1aUnity Job System \u548c Burst \u7684\u6027\u80fd\u6781\u9ad8\uff0c\u53ef\u4ee5\u5c06\u89c6\u9525\u4f53\u5254\u9664\u5de5\u4f5c\u5e76\u884c\u5206\u53d1\u7ed9\u95f2\u7f6e\u7684 CPU \u6838\u5fc3\uff0c\u800c GPU \u4e13\u5fc3\u505a\u6e32\u67d3\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u6700\u7ec8\u7684\u5f62\u6001\u662f\uff1a<strong>CPU (Burst) \u8d1f\u8d23\u706f\u5149\u5206\u5757 -&gt; \u5c06 Mask \u7f16\u7801\u6210 Constant Buffer (UBO) \u53d1\u9001 -&gt; \u7247\u6bb5\u7740\u8272\u5668 (Fragment Shader) \u67e5\u8868\u89e3\u7801\u63a9\u7801 -&gt; \u4ec5\u9488\u5bf9\u6709\u6548\u5149\u6e90\u8fdb\u884c\u6e32\u67d3\u5faa\u73af<\/strong>\u3002\u8fd9\u5957\u7cfb\u7edf\u65e2\u62ff\u5230\u4e86 Forward+ \u7684\u6027\u80fd\u6536\u76ca\uff0c\u53c8\u4fdd\u6301\u4e86\u6781\u597d\u7684\u5411\u4e0b\u517c\u5bb9\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 URP \u4e2d\uff0cForward+\uff08\u524d\u5411\u52a0\uff09 \u6e32\u67d3\u8def\u5f84\u7684\u5b9e\u73b0\u6838\u5fc3\u5728 ForwardLights.cs \u811a\u672c\u4e2d\uff0c\u5e76 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"hide_page_title":"","footnotes":""},"categories":[58],"tags":[18],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6540"}],"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=6540"}],"version-history":[{"count":2,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6540\/revisions"}],"predecessor-version":[{"id":6543,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6540\/revisions\/6543"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}