Lighting 窗口(菜单:__Window__ > __Lighting > Settings__)是 Unity 的全局光照 (GI) 功能的主要控制点。虽然 Unity 中的 GI 可以使用默认设置提供良好的效果,但 Lighting 窗口的属性允许您调整 GI 过程的许多方面,自定义场景,或根据需要优化质量、速度和存储空间。此窗口还包括环境光、光环、剪影和雾效的设置。
Lighting 窗口的控件分为三个选项卡:
Scene 选项卡设置适用于整体场景,而不是个别游戏对象。这些设置控制光照效果和优化选项。
Global maps 选项卡显示 GI 光照过程生成的所有光照贴图资源文件。
Object maps 选项卡显示当前所选游戏对象的 GI 光照贴图纹理(包括阴影遮罩)的预览。
此窗口还会在内容下面显示 Auto Generate 复选框。如果您勾选此复选框,则 Unity 将在您编辑场景时更新光照贴图数据。请注意,更新通常需要几秒钟时间,而不是立即完成。如果您不勾选 Auto Generate 复选框,则该复选框右侧的 Generate Lighting 按钮将激活;使用此按钮可在您需要的时候触发光照贴图更新。如果要在不清除 GI 缓存的情况下清除场景中的烘焙数据,请使用 Generate Lighting 按钮。
Scene 选项卡包含适用于整体场景(而不是个别游戏对象)的设置。Scene 选项卡包含若干部分:
Environmental Lighting 部分包含天空盒、漫射光照和反射的设置。
属性: | 功能: | |
---|---|---|
Skybox Material | A skybox is a Material that appears behind everything else in the Scene to simulate the sky or other distant background. Use this property to choose the skybox Material you want to use for the Scene. The default value is the Material Default-Skybox in the Standard Assets. | |
Sun Source | 使用程序化天空盒时,使用此选项可指定带有方向光组件的游戏对象,从而指示“太阳”(或任何照亮场景的大型远距离光源)的方向。如果设置为 None__(默认值),则假设场景中最亮的方向光代表太阳。 | | Environment Lighting__ | 这些设置会影响来自远处环境的光线。 |
Source | 漫射环境光(也称为环境光)是场景周围存在的光,并非来自任何特定的光源对象。此项可用于定义光源颜色。默认值为 Skybox。 | |
Color | 选择此选项可将单调颜色用于场景中的所有环境光。 | |
Gradient | 选择此选项可为来自天空、地平线和地面的环境光选择单独的颜色,并在它们之间平滑混合。 | |
Skybox | 选择此选项可使用天空盒的颜色(如果已通过 Skybox Material 指定)来确定来自不同角度的环境光。这可以实现比 Gradient 更精细的效果。 | |
Intensity Multiplier | 使用此属性可设置场景中漫射环境光的亮度,定义为 0 到 8 之间的值。默认值为 1。 | |
Ambient Mode | 使用此属性可指定应该用于处理场景中的环境光的全局光照模式。仅当场景中同时启用了实时光照和烘焙光照时,此属性才可用。 | |
Realtime | 如果希望实时计算和更新场景中的环境光,请选择 Realtime。 | |
Baked | 如果希望预先计算环境光并在运行时将其放入到场景中,请选择 Baked。 | |
Environment Reflections | 这些设置用于控制反射探针烘焙中涉及的全局设置,以及影响全局反射的设置。 | |
Source | 使用此设置指定是要将天空盒用于反射效果,还是使用您选择的立方体贴图。默认值为 Skybox。 | |
Skybox | 选择此选项可对反射使用天空盒。如果您选择 Skybox__,则将显示一个名为 Resolution__ 的额外选项。使用此选项可设置用于反射的天空盒的分辨率。 | |
Custom | 选择此选项可对反射使用立方体贴图。如果您选择 Custom,则将显示一个名为 Cubemap 的额外选项。使用此选项可设置用于反射的立方体贴图的分辨率。 |
|
Compression | 使用此属性可定义是否压缩反射纹理。默认设置是 Auto。 | |
Auto | 如果压缩格式合适,则压缩反射纹理。 | |
Uncompressed | 反射纹理以非压缩状态存储在内存中。 | |
Compressed | 压缩纹理。 | |
Intensity Multiplier | 反射源(在 Reflection Source 属性中指定的天空盒或立方体贴图)在反射对象中可见的程度。 | |
Bounces | 当来自一个对象的反射随后被另一个对象反射时,便发生反射“反弹”。应通过使用反射探针在场景中捕获反射。使用此属性可设置反射探针评估对象之间来回反弹的次数。如果设置为 1,则 Unity 只会考虑初始反射(来自 Reflection Source 属性中指定的天空盒和立方体贴图)。 |
属性: | 功能: |
---|---|
Realtime Global Illumination | 如果勾选此复选框,则 Unity 将实时计算和更新光照。请参阅有关实时全局光照的文档以了解更多信息。 |
属性: | 功能: |
---|---|
Baked Global Illumination | 如果选中此复选框,则 Unity 将预计算光照并在运行时将其放入到场景中。请参阅有关烘焙全局光照的文档以了解更多信息。 |
Lighting Mode |
Lighting Mode 确定混合光源和阴影在场景中作用于游戏对象的方式。 注意__:当您更改 Lighting Mode__ 时,您还需要重新烘焙场景。如果在 Lighting 窗口中启用了 Auto Generate__,则会自动进行此操作。如果未启用 Auto Generate__,则单击 Generate Lighting 即可看到更新后的光照效果。 |
Realtime Shadow Color | 定义用于渲染实时阴影的颜色。仅当 Lighting Mode 设置为 Subtractive 时,此设置才可用。 |
属性: | 功能: |
---|---|
Lightmapper | Use this to specify which internal lighting calculation software to use to calculate lightmaps in the Scene. The options are Enlighten and Progressive (experimental). The default value is Enlighten. See documentation on the Progressive Lightmapper for more information about the experimental Progressive Lightmapper feature. |
Indirect Resolution | Use this value to specify the number of texels per unit to use for indirect lighting calculations. Increasing this value improves the visual quality of indirect light, but also increases the time it takes to bake lightmaps. The default value is 2. |
Lightmap Resolution | Use this value to specify the number of texels per unit to use for lightmaps. Increasing this value improves lightmap quality, but also increases bake times. The default value is 40. |
Lightmap Padding | Use this value to specify the separation (in texel units) between separate shapes in the baked lightmap. The default value is 2. |
Lightmap Size | 完整光照贴图纹理的大小(以像素为单位),其中包含单个对象纹理的单独区域。默认值为 1024。 |
Compress Lightmaps | A compressed lightmap requires less storage space, but the compression process can introduce unwanted visual effects into the texture. Tick this checkbox to compress lightmaps, or untick it to keep them uncompressed. The checkbox is ticked by default. |
Ambient Occlusion | When ticked, this opens a group of settings which allow you to control the relative brightness of surfaces in ambient occlusion. Higher values indicate a greater contrast between the occluded and fully lit areas. This is only applied to the indirect lighting calculated by the GI system. This setting is enabled by default. |
Max Distance | Set a value to control how far rays are cast in order to determine whether an object is occluded or not. A larger value produces longer rays and contributes more shadows to the lightmap, while a smaller value produces shorter rays that contribute shadows only when objects are very close to one another. A value of 0 casts an infinitely long ray that has no maximum distance. The default value is 1. |
Indirect Contribution | Use the slider to scale the brightness of indirect light as seen in the final lightmap (that is, ambient light, or light bounced and emitted from objects) from a value between 0 and 10. The default value is 1. Values less than 1 reduce the intensity, while values greater than 1 increase it. |
Direct Contribution | 使用滑动条可以从值 0 到 10 之间缩放直射光的亮度。默认值为 0。此值越大,应用于直接光照的对比度越大。 |
Final Gather | When Final Gather is enabled, the final light bounce in the GI calculation is calculated at the same resolution as the baked lightmap. This improves the visual quality of the lightmap, but at the cost of additional baking time in the editor. |
Ray Count | Use this value to define the number of rays emitted for each final gather point. The default value is 256. |
Denoising | Tick this checkbox to apply a denoising filter to the final gather output. This box is ticked by default. |
Directional Mode | You can set the lightmap up to store information about the dominant incoming light at each point on the objects’ surfaces. See documentation on Directional Lightmapping for further details. The default mode is Directional. |
Directional | In Directional mode, a second lightmap is generated to store the dominant direction of incoming light. This allows diffuse normal mapped materials to work with the GI. Directional mode requires about twice as much storage space for the additional lightmap data. |
Non-directional |
Non-directional mode switches both these options off. |
Indirect Intensity | Use this slider to control the brightness of indirect light stored in realtime and baked lightmaps, from a value between 0 and 5. A value above 1 increases the intensity of indirect light while a value of less that 1 reduces indirect light intensity. The default value is 1. |
Albedo Boost | Use this slider to control the amount of light bounced between surfaces by intensifying the albedo of materials in the Scene, from a value between 1 and 10. Increasing this draws the albedo value towards white for indirect light computation. The default value of 1 is physically accurate. |
Lightmap Parameters | Unity uses a set of general parameters for the lightmapping in addition to properties of the Lighting window. A few defaults are available from the menu for this property but you can also create your own lightmap parameter file using the Create New option. See the Lightmap Parameters page for further details. The default value is Default-Medium. |
属性: | 功能: |
---|---|
Other Settings | 雾效、光环、光晕和剪影的设置。 |
Fog | Enables or disables fog in the Scene. Note that fog is not available with the Deferred rendering path. For deferred rendering, the Global Fog effect may suit your needs. |
Color | Set the color Unity uses to draw fog in the Scene. |
Mode | 定义雾化效果随着与摄像机距离变化而积累的方式。 |
Linear | 雾效强度随着距离线性增加。 |
Start | 设置在距离摄像机多远时开始雾效。 |
End | 设置在距离摄像机多远时雾效完全遮挡场景游戏对象。 |
Exponential | 雾效强度随着距离呈指数增加。 |
Density | Use this to control the density of the fog. The Fog appears more dense as the Density increases. |
Exponential Squared | Fog density increases even faster than exponentially with distance (exponentially and squared). |
Density | Use this to control the density of the fog. The Fog appears more dense as the Density increases. |
Halo Texture | 设置要用于在光源周围绘制光环的纹理。 |
Halo Strength | Define the visibility of halos around lights, from a value between 0 and 1. |
Flare Fade Speed | 定义最初出现镜头光晕之后从视图中淡出的时间(以秒为单位)。默认情况下,该值设置为 3。 |
Flare Strength | 定义光源下镜头光晕的可见性,值在 0 到 1 之间。 |
Spot Cookie | 设置要用于点光源的剪影纹理。 |
属性: | 功能: |
---|---|
Debug Settings | 这些设置可帮助您调试场景。 |
Update Statistics | If ticked, the statistics window at the bottom of the Lighting settings window is updated as the Scene changes. This can have an impact on performance during Play mode. For better performance in Play mode, untick this box. |
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 视图中,还会显示用于光照探针数据插值的四面体。 |
None | 任何光照探针都不显示在 Scene 视图中。 |
Display Weights | 勾选此复选框时,Unity 将从用于有效选择的光照探针到用于插值的四面体上的位置绘制一条线。这是一种调试探针插值和放置问题的方法。 |
Display Occlusion | 勾选此复选框时,如果混合光照模式为 Distance Shadowmask 或 Shadowmask,则 Unity 将显示光照探针的遮挡数据。 |
At the bottom of the Scene tab, the Statistics window lists information about Lights in the Scene. Lights are separated by type, Meshes, emissive Materials, Light Probes and Reflection Probes.
Note also that there is a dockable window called the Light Explorer, to help you work with large numbers of Lights.
使用 Global maps 选项卡可查看光照系统正在使用的实际纹理。这些内容包括强度光照贴图、阴影遮罩和方向贴图。仅当使用烘焙光照或混合光照时可用;对于实时光照,预览为空白。
使用 Object maps 选项卡可查看仅限当前所选游戏对象的烘焙纹理的预览,包括阴影遮罩。
2017–06–08 Page published with limited editorial review
5.6 版更新