分辨率缩放

为什么要使用分辨率缩放?

随着现代游戏的渲染复杂度不断增加,以原始分辨率进行渲染不再总是可行,尤其是在低端 GPU 上。

分辨率缩放是影响场景 GPU 要求的最直接方法之一。在 GPU(而不是 CPU)成为瓶颈的场景中,降低分辨率比例可以显着提高性能。分辨率缩放对于性能和功耗预算有限的移动 GPU 尤为重要。

虽然分辨率缩放是一个重要的工具,但请记住,分辨率缩放并不是要取代低端硬件上降低图形设置的方法。考虑在游戏菜单中公开分辨率比例和图形设置的办法。

参见

你可以使用`3D 抗锯齿演示项目 <https://github.com/godotengine/godot-demo-projects/tree/master/3d/antialiasing>`__ 比较分辨率缩放模式和实际影响因素。

备注

分辨率缩放目前不适用于 2D 渲染,但可以使用 viewport 拉伸模式进行模拟。请参阅 多分辨率 了解更多信息。

分辨率缩放选项

在高级项目设置的 渲染 > 缩放 3D 部分中,可以找到用于 3D 分辨率缩放的多个选项:

缩放模式

  • Bilinear: 标准双线性过滤(默认)。

  • FSR 1.0: AMD FidelityFX Super Resolution 1.0 。与双线性缩放相比,速度较慢,但质量较高。在非常慢的 GPU 上,FSR 1 的性能成本可能太高,比起双线性缩放来说并不值得使用它。

  • FSR 2.2: AMD FidelityFX Super Resolution 2.2(自 Godot 4.2 起支持) 。与 FSR1 和双线性缩放相比,速度最慢,但质量更高。在慢速 GPU 上,相比起双线性缩放或 FSR1,使用 FSR2 的性能成本可能太过昂贵,因而不值得使用。为了使 FSR2 性能与 FSR1 相匹配,你需要使用较低的分辨率缩放因子。

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 可用于加速渲染,但代价是最终图像变得更模糊和并具有更多锯齿。

可以通过更改 Viewport 节点上的 scaling_3d_scale 属性在运行时调整渲染缩放。

分辨率缩放在 1.0 以上 可用于超采样抗锯齿 (SSAA)。这将以 非常 高的性能成本提供抗锯齿功能,并且对于大多数用例来说 不推荐 。请参阅 3D 抗锯齿 了解更多信息。

下表列出了常见的屏幕分辨率、最终的 3D 渲染分辨率以及根据渲染缩放选项每帧需要渲染的百万像素数(megapixel )。每个表中的行按从最快到最慢的顺序排序。

备注

分辨率缩放是在 每轴 (per-axis)的基础上定义的。例如,将分辨率缩放因子减半意味着将使每帧渲染的百万像素数减少 4 倍,而不是 2 倍。因此,非常低或非常高的分辨率缩放因子都可能会对性能产生比预期更大的影响。

1920×1080(Full HD)

远程检查器

3D 渲染分辨率

渲染前一帧的时间

0.50

960×540

0.52 MPix

0.67

1286×723

0.93 MPix

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)

远程检查器

3D 渲染分辨率

渲染前一帧的时间

0.50

1280×720

0.92 MPix

0.67

1715×964

1.65 MPix

0.75

1920×1080

2.07 MPix

0.85

2176×1224

2.66 MPix

1.00 (原生)

2560×1440

3.69 MPix

1.33 (超采样)

3404×1915

6.52 MPix

1.50 (超采样)

3840×2160

8.29 MPix

2.00 (超采样)

5120×2880

14.75 MPix

3840×2160 (Ultra HD “4K”)

远程检查器

3D 渲染分辨率

渲染前一帧的时间

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 MPix

1.00 (原生)

3840×2160

8.29 MPix

1.33 (超采样)

5107×2872

14.67 MPix

1.50 (超采样)

5760×3240

18.66 MPix

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 bias)

当 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 偏置。它也可以在运行时通过在 Viewport 上调整 texture_mipmap_bias 属性进行更改。

警告

手动调整 mipmap LOD 偏差在某些情况下可能很有用,但应小心执行,以防止最终图像在运动中看起来有颗粒感。

mipmap LOD 偏置也会降低性能,因为必须在更远的距离采样更高分辨率的 mip。手动偏移的建议值在 -0.50.0 之间。

mipmap LOD 偏置将使 mipmap 纹理看起来比预期更模糊。这可能会稍微提高性能,但并不建议这样做,因为视觉质量的损失通常不值得性能的提升。

下面的示例展示了一个极端情况,其中 mipmap LOD 偏置为 -1.0 ,并禁用各向异性过滤以使差异更加明显:

../../_images/resolution_scaling_texture_mipmap_bias_comparison.png

故障排除

降低分辨率缩放比例时性能不会增加太多

如果将分辨率比例降低到 0.5 之类的值时,性能并没有增加太多,则可能意味着性能瓶颈在场景的其他地方。例如,你的场景可能有太多绘制调用(draw call),导致出现 CPU 瓶颈。同样,你可能启用了太多图形效果供 GPU 处理(例如 SDFGI、SSAO 或 SSR)。

详见 性能 教程。

Previous Next


© 版权所有 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision b1c660f7.

Built with Sphinx using a theme provided by Read the Docs.