动态反射优化
Dynamic reflections in the scene may significantly drop the performance if they aren't properly set up. For example, the planar reflection doubles the polygon count since it takes into account all geometry in the scene by default. It may raise performance issues in large and heavy scenes.如果未正确设置场景中的动态反射,则可能会严重降低性能。例如,由于默认情况下平面反射考虑了场景中的所有几何图形,因此平面反射使多边形计数加倍。在大型和繁重的场景中可能会引起性能问题。
As an alternative, you can try to keep the number of reflections as low as possible. However, there is a way to optimize dynamic reflections usage without visual losses.作为替代方案,您可以尝试使反射次数尽可能少。但是,有一种方法可以优化动态反射的使用而不会造成视觉损失。
The number of reflection polygons for each surface can be checked using the Surfaces tab of the Content Profiler tool.每个曲面反射多边形的数量可以使用 Content Profiler 工具的 Surfaces 选项卡进行检查。
Using Reflection Masks使用反射罩#
The Reflection mask allows controlling rendering of dynamic reflections into the reflection camera viewport. This mask can be set for dynamic Environment Probes and planar reflections. Reflection蒙版 允许控制将动态反射呈现到反射相机视口中。可以为动态Environment Probes和平面反射设置此蒙版。
Optimizing planar reflections优化平面反射#
To optimize the scene with planar reflection probes, you can apply the following approach: set up the scene so that only the required planar reflections are rendered, and use less consuming Screen Space Reflections (SSR) for other reflections. An example workflow is as follows:要使用平面反射优化场景,可以应用以下方法:设置场景,以便仅渲染所需的平面反射,并为其他反射使用较少消耗的Screen Space Reflections (SSR)。示例工作流如下:
- Decide, which bit of the viewport mask would be responsible for reflection of the object.决定视口蒙版的哪一位负责对象的反射。
- Open the Camera Settings window and enable the selected bit in the Reflection Viewport mask of the camera. 打开“摄像机设置”窗口,并启用摄像机Reflection Viewport掩码中的选定位。
- In the Materials Hierarchy, select the reflective material and enable the same bit in the Reflection Viewport Mask in the Parameters tab of the Material Editor. 在Materials_Hierarchy中,选择反射材质,然后在“材质编辑器”的Parameters选项卡的“平面反射”的Viewport Mask中启用相同的位。
- In the World Hierarchy, select the node to be reflected and go to the Node tab of the Parameters window.在“世界层次结构”中,选择要反射的节点,然后转到Parameters窗口的Node选项卡。
- In the Surfaces section, enable the selected bit in the Viewport Mask for all surfaces that should be reflected.
You can create the special low-poly LOD surface that will be used for reflections only; the viewport mask of such a LOD shouldn't match the camera's viewport mask to exclude it from rendering.在Surfaces部分中,为所有应反射的表面启用Viewport Mask中的选定位。You can create the special low-poly LOD surface that will be used for reflections only; the viewport mask of such a LOD shouldn't match the camera's viewport mask to exclude it from rendering.You can create the special low-poly LOD surface that will be used for reflections only; the viewport mask of such a LOD shouldn't match the camera's viewport mask to exclude it from rendering.You can create the special low-poly LOD surface that will be used for reflections only; the viewport mask of such a LOD shouldn't match the camera's viewport mask to exclude it from rendering.您可以创建特殊的低多边形LOD曲面,该曲面仅用于反射。这样的LOD的视口蒙版不应与摄影机的视口蒙版匹配,以将其从渲染中排除。
- In the Materials Hierarchy, select the material of the node that should be reflected and enable the selected bit in the Viewport Mask in the Common tab of the Materials Editor.
In the picture below, the reflection viewport mask of the plane has the same matching bit (or bits) with the camera reflection viewport mask and the Viewport masks of the red material ball and its material. The viewport masks of the other material balls don't have a matching bit with the reflection camera viewport mask and/or with the planar reflection viewport mask and, therefore, they aren't reflected:In the picture below, the reflection viewport mask of the plane has the same matching bit (or bits) with the camera reflection viewport mask and the Viewport masks of the red material ball and its material. The viewport masks of the other material balls don't have a matching bit with the reflection camera viewport mask and/or with the planar reflection viewport mask and, therefore, they aren't reflected:
Masked planar reflectionMasked planar reflectionIn the picture below, the reflection viewport mask of the plane has the same matching bit (or bits) with the camera reflection viewport mask and the Viewport masks of the red material ball and its material. The viewport masks of the other material balls don't have a matching bit with the reflection camera viewport mask and/or with the planar reflection viewport mask and, therefore, they aren't reflected:Masked planar reflection在“材质层次结构”中,选择应反映的节点的材质,然后在“材质编辑器”的Common选项卡的Viewport Mask中启用所选位。In the picture below, the reflection viewport mask of the plane has the same matching bit (or bits) with the camera reflection viewport mask and the Viewport masks of the red material ball and its material. The viewport masks of the other material balls don't have a matching bit with the reflection camera viewport mask and/or with the planar reflection viewport mask and, therefore, they aren't reflected:在下图中,平面的反射视口蒙版与相机反射视口蒙版和红色实物球及其材质的视口蒙版具有相同的匹配位(或多个位)。 其他材质球的视口罩与反射相机视口罩和/或平面反射视口罩没有匹配的位,因此不会被反射:
Masked planar reflection遮罩的平面反射 - Enable Screen Space Reflections to produce reflections of other nodes in the scene: on the Menu Bar, toggle the Rendering -> Features -> SSR option on.
The SSR effect should be also enabled for the reflective material: go the Post Processing section of the States tab and check if the SSR option is enabled.The SSR effect should be also enabled for the reflective material: go the Post Processing section of the States tab and check if the SSR option is enabled.Masked planar reflection + SSRMasked planar reflection + SSRThe SSR effect should be also enabled for the reflective material: go the Post Processing section of the States tab and check if the SSR option is enabled.Masked planar reflection + SSR启用Screen Space Reflections产生场景中其他节点的反射:在菜单栏上,将Rendering -> Features -> SSR选项打开。Masked planar reflection + SSR遮罩的平面反射+ SSR
Optimizing environment probe reflections优化环境探针反射#
Dynamic reflections provided by Environment Probes can be optimized in the same way as described above. To specify the Reflection Viewport mask for the Environment Probe, go to the Environment Probe section of the Parameters window and set the Reflection Viewport Mask parameter in the Baking Settings section.可以按照与上述相同的方式优化Environment Probes提供的动态反射。要为Environment Probe指定Reflection Viewport蒙版,请转到Parameters窗口的Environment Probe部分,然后在Baking Settings部分中设置Reflection Viewport Mask参数。
In the left picture below, the reflection viewport mask of the Environment Probe matches the camera's Reflection Viewport mask and the Viewport masks of the red material ball and its material. In the right picture, the Reflection Viewport mask of the Environment Probe doesn't match the camera's Reflection Viewport mask:在下面的左图中,Environment Probe的反射视口蒙版与摄影机的Reflection Viewport蒙版以及红色实物球及其材质的Viewport蒙版匹配。在右图中,Environment Probe的Reflection Viewport遮罩与相机的Reflection Viewport遮罩不匹配:
Setting Up Reflection Distance设置反射距离#
One more method that allows optimizing rendering of dynamic reflections is to set the distance at which reflections are turned off.允许优化动态反射渲染的另一种方法是设置关闭反射的距离:
- In the Menu Bar, choose Windows -> Settings and go to the Visibility Distances section of the Settings window that opens. 在菜单栏中,选择Windows -> Settings并转到打开的“设置”窗口的Visibility Distances部分。
- For the Dynamic Reflections parameter, specify the distance from the camera, starting from which the reflections aren't rendered.对于Dynamic Reflections参数,请指定距相机的距离,从该距离开始不渲染反射。