Version: 2023.2
生成光照数据
Global Illumination (GI) cache

光照数据资源

光照数据资源可以存储 Unity Editor 场景预计算的光照数据。出于工作流程原因,光照数据资源在项目中作为单独的文件存在;将预计算的光照数据存储在单独的文件中意味着对预计算的光照数据的更改不会导致对场景文件的更改。光照数据资源不供用户编辑。

Unity stores precomputed lighting data in a Lighting Data Asset when you invoke a lighting precompute, either by using the Generate Lighting button in the Lighting window, or by using the Lightmapping.Bake or Lightmapping.BakeAsync APIs.

The Lighting Data Asset contains global illumination data and all the supporting files needed to recreate the lighting for a scene. This asset references the renderers, the real-time lightmaps, the baked lightmaps, light probes, reflection probes and a data structure which stores the relationships between these elements. It also includes all the precomputed Enlighten Realtime Global Illumination data needed to update how real-time global illumination looks in the Player.

当您更改场景时(例如,中断一个标记为 Contribute GI 的游戏对象上的预制件连接),资源数据将过时,因此必须重新构建。

在光照构建过程中生成但生成播放器构建时不需要的中间文件不属于资源的一部分,因此存储在 GI 缓存中。

光照数据资源的构建时间可能有所不同。如果您的 GI 缓存已填满,例如,您之前在机器上进行了烘焙(场景处于最新状态),则构建速度会很快。如果将场景拉到空缓存的计算机或由于缓存大小限制而删除了所需的缓存数据,则必须首先使用中间文件填充缓存,而这需要运行预计算和烘焙过程。这些步骤可能会消耗一些时间。

Default Lighting Data Assets

When you add a new scene, Unity uses a default Lighting Data Asset. The asset references a hidden ambient probe and a hidden Reflection Probe that capture environment lighting from Unity’s built-in Default Skybox. The asset doesn’t appear in the Project window.

The data in the hidden probes is fixed. For example, if you change the Skybox Material in the Lighting window, the data in the probes doesn’t change, so environment lighting on objects stays the same.

To stop using the default Lighting Data Asset, select Generate Lighting or Clear Baked Data in the Lighting window. Unity then creates and uses a new default Lighting Data Asset and a new baked Reflection Probe (the ambient Reflection Probe). These assets appear in the Project window, and update when you select Generate Lighting.

生成光照数据
Global Illumination (GI) cache