Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

保存資源

為什麼要使用解析度縮放?

隨著現代遊戲的渲染複雜性不斷增加,以原始解析度進行渲染不再總是可行,尤其是在低端 GPU 上。

解析度縮放是影響場景 GPU 要求的最直接方法之一。在 GPU(而不是 CPU)成為瓶頸的場景中,降低解析度比例可以顯著提高效能。解析度縮放對於效能和功耗預算有限的行動 GPU 尤其重要。

雖然解析度縮放是一個重要的工具,但請記住,解析度縮放並不是要取代低階硬體上降低圖形設定的方法。考慮在遊戲選單中公開解析度比例和圖形設定。

也參考

除了這份說明文件,你可能也會想看看 Godot Demo 專案

備註

解析度縮放目前不適用於 2D 渲染,但可以使用「viewport」拉伸模式進行模擬。請參閱 doc_multiple_resolutions 以了解更多資訊。

資源路徑

在進階專案設定的 渲染 > 縮放 3D 部分中,您可以找到用於 3D 解析度縮放的多個選項:

縮放模式

  • 雙線性: 標準雙線性濾波(預設)。

  • FSR 1.0: AMD FidelityFX Super Resolution 1.0. Slower, but higher quality compared to bilinear scaling. On very slow GPUs, the cost of FSR1 may be too expensive to be worth using it over bilinear scaling.

  • FSR 2.2: AMD FidelityFX Super Resolution 2.2 (since Godot 4.2). Slowest, but even higher quality compared to FSR1 and bilinear scaling. On slow GPUs, the cost of FSR2 may be too expensive to be worth using it over bilinear scaling or FSR1. To match FSR2 performance with FSR1, you need to use a lower resolution scale factor.

Here are comparison images between native resolution, bilinear scaling with 50% resolution scale, FSR1, and FSR2 scaling with 50% resolution scale:

../../_images/resolution_scaling_bilinear_0.5.png ../../_images/resolution_scaling_fsr1_0.5.png ../../_images/resolution_scaling_fsr2_0.5.webp

FSR1 upscaling works best when coupled with another form of antialiasing. Temporal antialiasing (TAA) or multisample antialiasing (MSAA) should preferably be used in this case, as FXAA does not add temporal information and introduces more blurring to the image.

On the other hand, FSR2 provides its own temporal antialiasing. This means you don't need to enable other antialiasing methods for the resulting image to look smooth. The Use TAA project setting is ignored when FSR2 is used as the 3D scaling method, since FSR2's temporal antialiasing takes priority.

以下是相同的比較,但在所有影像上啟用了 4× MSAA:

../../_images/resolution_scaling_bilinear_msaa_4x_0.5.png ../../_images/resolution_scaling_fsr1_msaa_4x_0.5.png ../../_images/resolution_scaling_fsr2_msaa_4x_0.5.webp

Notice how the edge upscaling of FSR1 becomes much more convincing once 4× MSAA is enabled. However, FSR2 doesn't benefit much from enabling MSAA since it already performs temporal antialiasing.

渲染

渲染 > 縮放 3D > 比例 設定可調整解析度比例。 「1.0」表示全解析度比例,3D 渲染解析度與 2D 渲染解析度相符。解析度比例*低於*“1.0”可用於加速渲染,但代價是最終影像更模糊和更多鋸齒。

可以透過變更 class_Viewport 節點上的 scaling_3d_scale 屬性在執行時調整渲染比例。

解析度比例*以上*「1.0」可用於超級取樣抗鋸齒 (SSAA)。這將以*非常*高的性能成本提供抗鋸齒功能,並且對於大多數用例來說**不建議** 。請參閱 doc_3d_antialiasing 以了解更多資訊。

下表列出了常見的螢幕解析度、最終的 3D 渲染解析度以及根據渲染比例選項每個畫面需要渲染的百萬像素數。每個表中的行按從最快到最慢的順序排序。

備註

分辨率比例是在**每軸**的基礎上定義的。例如,這意味著將解析度比例因子減半將使每影格渲染的百萬像素數減少4 倍,而不是2 倍。因此,非常低或非常高的解析度比例因子可能會對效能產生比預期更大的影響。

1920×1080(全高清)

遠端屬性面板。

著色器語言限制

渲染前一影格的時間

0.50

960×540

0.52 像素

0.67

1286×723

0.93 像素

0.75

1440×810

1.17 MPix

0.85

1632×918

1.50 MPix

1.00 (本地)

1920×1080

2.07 MPix

``1.33``(超級取樣)

2553×1436

3.67 MPix

``1.50``(超級取樣)

2880×1620

4.67 MPix

``2.00``(超級取樣)

3840×2160

8.29 MPix

2560×1440(QHD)

遠端屬性面板。

著色器語言限制

渲染前一影格的時間

0.50

1280×720

0.92 像素

0.67

1715×964

1.65 像素

0.75

1920×1080

2.07 MPix

0.85

2176×1224

2.66 像素

1.00 (本地)

2560×1440

3.69 MPix

``1.33``(超級取樣)

3404×1915

6.52 像素

``1.50``(超級取樣)

3840×2160

8.29 MPix

``2.00``(超級取樣)

5120×2880

14.75 像素

3840×2160(超高清「4K」)

遠端屬性面板。

著色器語言限制

渲染前一影格的時間

0.50

1920×1080

2.07 MPix

0.67

2572×1447

3.72 MPix

0.75

2880×1620

4.67 MPix

0.85

3264×1836

5.99 像素

1.00 (本地)

3840×2160

8.29 MPix

``1.33``(超級取樣)

5107×2872

14.67 像素

``1.50``(超級取樣)

5760×3240

18.66 像素

``2.00``(超級取樣)

7680×4320

33.18 MPix

FSR 銳度

When using the FSR1 or FSR2 scaling modes, the sharpness can be controlled using the Rendering > Scaling 3D > FSR Sharpness advanced project setting.

與大多數其他銳利度滑桿相比,強度是相反的:「較低」值將導致最終影像更銳利,而「較高」值將「減少」銳利化濾鏡的影響。 0.0 是最銳利的,而``2.0`` 是最不銳利的。預設值「0.2」在保留原始影像的清晰度和避免因過度銳化而產生額外鋸齒之間提供了平衡。

備註

If you wish to use sharpening when rendering at native resolution, Godot currently doesn't allow using the sharpening component of FSR1 (RCAS) independently from the upscaling component (EASU).

As a workaround, you can set the 3D rendering scale to 0.99, set the scaling mode to FSR 1.0 then adjust FSR sharpness as needed. This allows using FSR1 while rendering at a near-native resolution.

Alternatively, you can set the scaling mode to FSR 2.2 with the 3D rendering scale set to 1.0 if you have enough GPU headroom. This also provides high-quality temporal antialiasing. The FSR Sharpness setting remains functional in this case.

Mipmap

當 3D 解析度比例設定為低於「1.0」時,Godot 會自動使用負紋理 mipmap 偏差。這樣可以更好地保留紋理細節,但代價是詳細紋理上出現顆粒狀外觀。

目前,紋理 LOD 偏差以相同的方式影響 2D 和 3D 渲染。但是,請記住,它僅對啟用 mipmap 的紋理產生影響。預設情況下,2D 中使用的紋理不會啟用 mipmap,這表示只有 3D 渲染會受到影響,除非您在匯入塢中對 2D 紋理啟用 mipmap。

用來決定紋理 mipmap 偏差的公式為: TODO

為了抵消某些抗鋸齒方法增加的模糊度,Godot 還在啟用 FXAA 時新增了「-0.25」偏移量,在啟用 TAA 時新增了「-0.5」偏移量。如果同時啟用兩者,則使用“-0.75”偏移量。此 mipmap 偏移偏移在解析度縮放偏移之前應用,因此它不會根據解析度縮放而變化。

可以透過調整 渲染 > 紋理 > 預設濾鏡 > 紋理 Mipmap 偏差 高級專案設定來手動更改紋理 LOD 偏差。它也可以在運作時透過調整“texture_mipmap_bias”屬性在“視口 <class_Viewport>”上進行更改。

警告

手動調整 mipmap LOD 偏差在某些情況下可能很有用,但應小心執行,以防止最終影像在運動中看起來有顆粒感。

mipmap LOD 偏差也會降低效能,因為必須在更遠的距離取樣更高解析度的 mip。手動偏移的建議值在“-0.5”和“0.0”之間。

mipmap LOD 偏差將使 mipmap 紋理看起來比預期更模糊。這可能會稍微提高性能,但不建議這樣做,因為視覺品質的損失通常不值得性能的提升。

下面的範例顯示了一個極端情況,其中 mipmap LOD 偏差為“-1.0”並禁用各向異性篩選以使差異更加明顯:

../../_images/resolution_scaling_texture_mipmap_bias_comparison.png

疑難排解

降低解析度比例時效能不會增加太多

如果將解析度比例降低到「0.5」之類的值時效能沒有增加太多,則可能表示效能瓶頸在場景的其他地方。例如,您的場景可能有太多繪製呼叫,導致出現 CPU 瓶頸。同樣,您可能啟用了太多圖形效果供 GPU 處理(例如 SDFGI、SSAO 或 SSR)。

更多資訊請參考 匯出專案