Unreal 的效能建議Performance recommendations for Unreal

Unreal Engine 有幾項可提高應用程式效能的功能,全部都是以混合實境效能建議中的討論為基礎。Unreal Engine has several features that can increase an apps performance, all based on the discussion outlined in performance recommendations for mixed reality. 建議您先閱讀應用程式瓶頸、分析和剖析混合實境應用程式,並進行一般效能修正,再繼續進行。You're encouraged to read up on application bottlenecks, analyzing and profiling mixed reality apps, and general performance fixes before continuing.

您可以在 [編輯] > [專案設定] 中找到下列每個設定。You can find each of the following settings in Edit > Project Settings.

  1. 使用行動 VR 轉譯器:Using the mobile VR renderer:
    • 向下捲動至 [專案] 區段、選取 [目標硬體],然後將目標平台設定為 [行動裝置/平板電腦]Scroll to the Project section, select Target Hardware, and set the target platform to Mobile/Tablet

行動目標設定

  1. 使用前向轉譯器:Using the Forward Renderer:
    • 前向轉譯器可個別關閉的功能較多,因此在混合實境中的適用性遠優於預設的延遲轉譯管線。Forward Renderer is much better for Mixed Reality than the default Deferred rendering pipeline because of the number of features that can be individually turned off.
    • 您可以在 Unreal 的文件中找到詳細資訊。You can find more information in Unreal's documentation.

前向轉譯

  1. 使用行動多重檢視:Using mobile multi-view:
    • 向下捲動至 [引擎] 區段、選取 [轉譯]、展開 [VR] 區段,然後同時啟用 [執行個體化立體聲] 和 [行動多重檢視]。Scroll to the Engine section, select Rendering, expand the VR section, and enable both Instanced Stereo and Mobile Multi-View. 應取消核取行動設備 HDR。Mobile HDR should be unchecked.

VR 轉譯設定

  1. [僅 OpenXR] 確保 [預設] 或 [D3D12] 是選取的 [預設 RHI]:[OpenXR only] Ensure Default or D3D12 is the selected Default RHI:
    • 選取 D3D11 會對效能造成負面影響,因為平台會執行額外的轉譯行程。Selecting D3D11 will have a negative performance impact due to the platform performing an additional render pass. 除了避免額外的轉譯行程,D3D12 應提供轉譯效能改善。D3D12 should provide rendering performance improvements besides avoiding the additional render pass.

預設 RHI

  1. 停用頂點霧化:Disabling Vertex Fogging:
    • 頂點霧化會在多邊形的每個頂點套用霧計算,然後在多邊形的整個表面上插補結果。Vertex fogging applies fog calculations at each vertex in a polygon and then interpolates the results across the face of the polygon. 如果您的遊戲未使用霧,建議您停用頂點霧化以提高陰影效能。If your game does not use fog, we recommend disabling Vertex Fogging to increase shading performance.

頂點霧化選項

  1. 停用遮蔽消除:Disabling occlusion culling:
    • 向下捲動至 [引擎] 區段、選取 [轉譯]、展開 [消除] 區段,然後取消勾選 [遮蔽消除]。Scroll to the Engine section, select Rendering, expand the Culling section, and uncheck Occlusion Culling.
      • 如果您需要針對轉譯的詳細場景進行遮蔽消除,建議您在 [引擎] > [轉譯] 中啟用 [支援軟體遮蔽消除]。If you need occlusion culling for a detailed scene being rendered, it's recommended that you enable Support Software Occlusion Culling in Engine > Rendering. Unreal 將在 CPU 上執行此工作,並避免 GPU 的遮蔽查詢 (此功能在 HoloLens 2 上的執行效能不佳)。Unreal will do the work on the CPU and avoid GPU occlusion queries, which perform poorly on HoloLens 2.
    • 在行動裝置上,對 GPU 消除遮蔽的速度很慢。Occlusion culling on the GPU on mobile devices is slow. 一般來說,您會希望 GPU 主要用在轉譯上。Generally, you want the GPU to be primarily concerned with rendering. 如果您覺得遮蔽有助於效能,請試著改為啟用軟體遮蔽。If you feel that occlusion will help performance, try enabling software occlusion instead.

注意

如果您的 CPU 已受限於大量的繪製呼叫,啟用軟體遮蔽可能會使效能變差。Enabling software occlusion could make performance worse if you're already CPU bound by a large number of draw-calls.

停用遮蔽消除

  1. 停用自訂深度樣板傳遞:Disabling Custom Depth-Stencil Pass:
    • 停用自訂深度樣板需要額外的傳遞,這表示速度會很慢。Disabling Custom Depth-Stencil requires an extra pass, meaning it's slow. 透明度在 Unreal 上的執行速度也很慢。Translucency is also slow on Unreal. 您可以在 Unreal 的文件中找到詳細資訊。You can find more information in Unreal's documentation.

深度樣板

  1. 減少重疊的陰影圖:Reducing Cascaded Shadow Maps:
    • 減少陰影圖的數目將可改善效能。Reducing the number of shadow maps will improve performance. 一般而言,若沒有可見的品質損失,則應將屬性設定為 1。Generally, you should set the property to 1 unless there's a visible quality loss.

重疊的陰影圖

選擇性設定Optional settings

注意

下列設定可能會改善效能,但代價是某些功能須停用。The following settings may improve performance, but at the cost of disabling certain features. 只有在您確定不需要這類功能時,才可使用這些設定。Only use these settings if you're sure you don't need the features in question.

  1. 減少行動著色器排列Mobile Shader Permutation Reduction
    • 如果您的燈光不會脫離相機獨立移動,則可以安全地將屬性值設定為 0。If your lights don't move independently of the camera, then you can safely set the property value to 0. 其主要的優點是可以讓 Unreal 消除數個著色器排列,加快著色器編譯速度。The primary benefit is that it will allow Unreal to cull several shader permutations, speeding up shader compilation.

減少行動著色器排列

另請參閱See also