Version: 2022.3
阴影故障排除
光照设置资源

Lighting 窗口

Lighting 窗口(菜单:__Window__ > Rendering > __Lighting__)是 Unity 光照功能的主要控制点。使用 Lighting 窗口调整与场景中的光照有关的设置,并根据质量、烘焙时间和存储空间来优化预计算的光照数据。

相关 API

可以使用 LightingSettingsLightmapping API,通过脚本执行 Lighting 窗口中提供的许多函数。

Lighting 窗口的布局

Lighting 窗口包含以下元素:

Scene 选项卡

Scene 选项卡显示有关分配给活动场景光照设置资源的信息。如果没有为活动场景分配光照设置资源,它会显示有关默认 LightingSettings 对象的信息。

The Scene tab is divided into several sections:

Lighting Settings Asset controls(光照设置资源的控件)

使用此部分中的控件将光照设置资源分配给活动场景,或创建新的光照设置资源。

属性: 功能:
Lighting Settings 分配给活动场景的光照设置资源。
New Lighting Settings 单击此按钮可在您的项目中生成新的光照设置资源,并自动将该新的光照设置资源分配给活动场景。

Lighting Settings(光照设置)

Use this section to view and edit the properties of the Lighting Settings Asset or LightingSettings object assigned to the current Scene. See Lighting Settings Asset.

Workflow settings(工作流设置)

此部分包含可帮助您调试场景的设置。

属性: 功能:
GPU Baking Device 使用此属性更改 Unity 用于预计算光照数据的 GPU。此属性仅在您使用 GPU 渐进光照贴图后端时可见。
Light Probe Visualization 用于过滤哪些光照探针显示在 Scene 视图中。默认值为 Only Probes Used By Selection
Only Probes Used By Selection 只有影响当前选择的光照探针才会显示在 Scene 视图中。
All Probes No Cells 所有光照探针都将显示在 Scene 视图中。
All Probes With Cells 所有光照探针都将显示在 Scene 视图中,还会显示用于光照探针数据插值的四面体。
任何光照探针都不显示在 Scene 视图中。
Display Weights 启用此复选框时,Unity 将从用于有效选择的光照探针到用于插值的四面体上的位置绘制一条线。这是一种调试探针插值和放置问题的方法。
Display Occlusion 启用此复选框时,如果 Lighting Mode 设置为 Shadowmask__,则 Unity 将显示光照探针的遮挡数据。 | | Highlight Invalid Cells||Enable to highlight tetrahedrons that Unity can’t use for indirect lighting. For example if the Light Probes are very close together. | | Recalculate Environment Lighting__ When enabled, Unity automatically calculates environment lighting using the SkyManager for all open scenes, if you haven’t generated precomputed lighting data.

Environment 选项卡

Environment 选项卡包含相关当前场景的环境光照效果的设置。内容取决于您的项目使用的渲染管线。

The Environment tab is divided into two sections:

Environment(环境)

Environment 部分包含与光照相关的设置和控件,这些设置和控件适用于当前场景中的环境光照,例如天空盒、漫射光照和反射。

属性: 功能:
Skybox Material 天空盒是一种材质,它出现在场景中的所有其他对象后方,用于模拟天空或其他遥远的背景。使用此属性可选择要用于场景的天空盒。默认值是内置的默认天空盒 (Default Skybox)。
Sun Source Select a Light to use as the sun in your Scene. Unity uses this Light to simulate the effect of sun position and intensity on the Skybox and your Scene. If you set this to None, Unity considers the brightest directional light in the Scene the sun. Lights whose Render Mode property is set to Not Important do not affect the Skybox.

For more information about the Render Mode setting, see the Additional settings section of Lights.
Realtime Shadow Color Define the color that Unity uses to render real-time shadows in Subtractive Lighting Mode.
Environment Lighting 此部分包含可影响当前场景中的环境光的设置。
Source 使用此属性可定义场景中环境光的光源颜色。默认值为 Skybox
Skybox 使用 Skybox Material 中设置的天空盒颜色来确定来自不同角度的环境光。这可以实现比 Gradient 更精细的效果。
Gradient 可为来自天空、地平线和地面的环境光选择单独的颜色,并在它们之间平滑混合。
Color 对所有环境光使用单调颜色。
Intensity Multiplier 使用此属性可设置场景中环境光的亮度,定义为 0 到 8 之间的值。默认值为 1。
Environment Reflections 此部分包含反射探针烘焙的全局设置,以及影响全局反射的设置。
Source Use this setting to specify whether you want to use the Skybox for reflection effects, or a Cubemap of your choice. The default value is Skybox.
Skybox 选择此选项可使用天空盒作为反射源。
Custom Select this to use either a Cubemap asset or a RenderTexture of type cube for reflections.
Resolution 使用此属性可设置用于反射的天空盒的分辨率。仅当 Source 设置为 Skybox 时,此属性才可见。
Cubemap Use this to specify the Cubemap to use for reflection purposes. This property is visible only when Source is set to Cubemap.
Compression 使用此属性可定义是否压缩反射纹理。默认设置是 Auto
Auto 如果压缩格式合适,则压缩反射纹理。
Uncompressed 反射纹理以非压缩状态存储在内存中。
Compressed 压缩纹理。
Intensity Multiplier 反射源在反射对象中可见的程度。
Bounces 当来自一个对象的反射随后被另一个对象反射时,便发生反射反弹。使用此属性可设置反射探针评估对象之间来回反弹的次数。如果设置为 1,则 Unity 只会考虑初始反射(来自 Reflection Source 属性中指定的天空盒和立方体贴图)。

Other Settings

Other Settings 部分包含雾、光环光晕剪影的设置。

属性: 功能:
Fog 在场景中启用或禁用雾效。请注意,此模式无法用于延迟渲染路径
Color 使用拾色器设置 Unity 用于在场景中绘制雾的颜色。
Mode 定义雾化效果随着与摄像机距离变化而积累的方式。
Linear 雾效强度随着距离线性增加。
Start 设置在距离摄像机多远时开始雾效。
End 设置在距离摄像机多远时雾效完全遮挡场景游戏对象。
Exponential 雾效强度随着距离呈指数增加。
Density 用于控制雾效的强度。雾效随着 Density 增加而显示为更强。
Exponential Squared 雾效强度随着距离更快速增加(指数和平方)。
Density 用于控制雾效的强度。雾效随着 Density 增加而显示为更强。
Halo Texture 设置要用于在光源周围绘制光环的纹理。
Halo Strength 定义光源周围光环的可见性,值在 0 到 1 之间。
Flare Fade Speed 定义最初出现镜头光晕之后从视图中淡出的时间(以秒为单位)。默认情况下,该值设置为 3。
Flare Strength 定义光源下镜头光晕的可见性,值在 0 到 1 之间。
Spot Cookie Set the Cookie texture you want to use for Spot Lights. The default is ‘Soft’. To revert to ‘Soft’, select None.

Realtime Lightmaps 选项卡

The Realtime Lightmaps tab shows a list of all lightmaps generated by the Enlighten Realtime Global Illumination system in the current Scene. If Enlighten Realtime Global Illumination is not enabled in your Project, this tab will be empty.

Baked Lightmaps 选项卡

此选项卡显示光照贴图为当前场景生成的所有光照贴图的列表,以及光照数据资源。如果项目中未启用烘焙全局光照 (Baked Global Illumination),则此选项卡将为空。

控件区域

用于预计算光照数据的控件位于 Lighting 窗口的底部。

属性: 功能:
Auto Generate If Auto Generate is enabled, Unity precomputes lighting data automatically when you make changes to the Scene.

This data includes lightmaps for the Baked Global Illumination system, lightmaps for the Enlighten Realtime Global Illumination system, Light Probes, and Reflection Probes.

Unity usually begins the bake a few seconds after you make a change to the Scene. If Auto Generate is disabled, you must manually invoke a bake yourself, using the Generate Lighting button in the Lighting window, or the Lightmapping.Bake or Lightmapping.BakeAsync APIs.

When you precompute lighting data using Auto Generate, Unity does not store the Scene’s precomputed lighting data as Assets in your Project. Instead, Unity stores this data in memory and serializes it as part of the Scene.

This property is only available if the active Scene has a Lighting Settings Asset assigned to it.

Note: From Unity Editor version 2022.2, Auto Generate mode is unavailable when the Entities package is installed. When you generate lighting in a project where you have installed the Entities package, the Unity Editor opens all loaded subscenes, which may slow down Editor performance.
Generate Lighting Click the Generate Lighting button to precompute lighting data for all open Scenes. This data includes lightmaps for the Baked Global Illumination system, lightmaps for the Enlighten Realtime Global Illumination system, Light Probes, and Reflection Probes.

Click the dropdown menu on the right hand side of the Generate Lighting and then click Bake Reflection Probes to bake only the Reflection Probes for all open Scenes.

Click the dropdown menu on the right hand side of the Generate Lighting and then click Clear Baked Data to clear all precomputed lighting data from all open Scenes without clearing the GI Cache.

This button is enabled only if Auto Generate is disabled.

  • [光照设置资源]添加于 2020.1 NewIn20201
阴影故障排除
光照设置资源