Version: 2019.3
光照探针和网格渲染器
光照探针代理体 (Light Probe Proxy Volume) 组件

光照探针和场景加载

Unity 会根据您加载或卸载场景的方式而以不同方式更新其光照探针数据。

Unity 使用 LightProbes C# 对象为所有当前加载的场景存储光照探针数据。LightProbes 对象包含一个内部数据结构,称为四面体曲面细分。Unity 在其计算中使用四面体曲面细分来确定光照探针照亮游戏对象的方式。

加载或卸载场景时,Unity 会自动更新 LightProbes 对象,以包含所有当前加载的场景中所有光照探针的位置和系数。但是,Unity 是否更新四面体曲面细分取决于加载或卸载场景的方式。

使用 LoadSceneMode.Single 来加载场景时,Unity 将在加载过程中自动更新四面体曲面细分。 使用 LoadSceneMode.Additive 来加载场景,或使用 UnloadSceneAsync 来卸载场景时,Unity 不会更新四面体曲面细分。

If Unity performs calculations using an out-of-date tetrahedral tessellation, the results do not take into account any newly loaded or unloaded Light Probes. This means that Light Probes might not light GameObjects as expected, and calls to LightmapSettings.lightProbes.CalculateInterpolatedLightAndOcclusionProbes() or LightmapSettings.lightProbes.GetInterpolatedProbe() might return unexpected results.

To force Unity to update the tetrahedral tessellation, you can call LightmapSettings.lightProbes.Tetrahedralize() or LightmapSettings.lightProbes.TetrahedralizeAsync(). These functions cause Unity to update the tetrahedral tessellation with data from all Light Probes for all currently loaded Scenes.

更新四面体曲面细分是一项 CPU 密集型操作,并且随着光照探针数量的增加,CPU 的负载也会增加。如果要加载和卸载多个场景,并且由于更新四面体细分而对性能产生了影响,那么最好是延迟更新:等到加载或卸载了一定量的内容或者等到 CPU 负载不太可能影响应用程序性能时,再进行更新。

光照探针和网格渲染器
光照探针代理体 (Light Probe Proxy Volume) 组件
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961