The Light Inspector 光组件检视器 光照系列5

本文档介绍了Unity中的Light Inspector,探讨如何利用光源组件创建复杂的光照效果,如阴影和Cookie(光贴图)。内容涵盖不同类型的光源、阴影设置以及与着色器的配合,特别指出VertexLit着色器不支持Cookie和阴影。此外,提供了优化建议,如使用VertexLit着色器提升性能,并给出使用带有Cookie的聚光灯模拟窗户光线效果等实用技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The Light Inspector 光组件检视器

本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.3版本
参考链接:https://docs.unity3d.com/Manual/class-Light.html

Lights determine the shading of an object and the shadows it casts. As such, they are a fundamental part of graphical rendering. See documentation on lighting and Global Illumination for further details about lighting concepts in Unity.
光源决定物体的着色和投射的阴影。因此,它们是图形渲染的基本部分。有关Unity中照明概念的更多细节,请参阅关于照明和全局照明的文档。
在这里插入图片描述

PropertyFunction
ModeSpecify the Light Mode used to determine if and how a light is “baked”. Possible modes are Realtime, Mixed and Baked. See documentation on Realtime Lighting, Mixed Lighting, and Baked Lighting for more detailed information.
模式指定用于确定是否以及如何“烘焙”的光照模式。可能的模式是实时的,混合和烘焙。有关实时照明、混合照明和烘焙照明的详细信息,请参阅文档。
Indirect MultiplierUse this value to vary the intensity of indirect light. Indirect light is light that has bounced from one object to another. The Indirect Multiplier defines the brightness of bounced light calculated by the global illumination (GI) system. If you set Indirect Multiplier to a value lower than 1, the bounced light becomes dimmer with every bounce. A value higher than 1 makes light brighter with each bounce. This is useful, for example, when a dark surface in shadow (such as the interior of a cave) needs to be brighter in order to make detail visible. Alternatively, if you want to use Realtime Global Illumination, but want to limit a single real-time Light so that it only emits direct light, set its Indirect Multiplier to 0.
间接照明乘数用这个值来改变间接光的强度。间接光是从一个物体反射到另一个物体的光。间接倍增器定义了由全局照明(GI)系统计算出的反射光的亮度。如果将间接倍增器设置为小于1的值,反弹的光会随着每次反弹而变暗。值大于1时,每次反弹都会使光线更亮。这很有用,例如,当阴影中的暗面(比如洞穴的内部)需要变得更亮以使细节可见时。
Shadow TypeDetermine whether this Light casts Hard Shadows, Soft Shadows, or no shadows at all.
阴影类型确定这个光投射的是硬阴影、软阴影还是完全没有阴影。
Baked Shadow AngleIf Type is set to Directional and Shadow Type is set to Soft Shadows, this property adds some artificial softening to the edges of shadows and gives them a more natural look.
烘焙阴影角度如果Type 设置为Directional ,Shadow Type设置为Soft Shadows这一特性为阴影的边缘添加了一些人为软化,使其看起来更加自然。
Baked Shadow RadiusIf Type is set to Point or Spot and Shadow Type is set to Soft Shadows, this property adds some artificial softening to the edges of shadows and gives them a more natural look.
烘焙阴影半径如果类型设置为Point或Spot,而阴影类型设置为Soft Shadows,则此属性将为阴影的边缘添加一些人为软化,并使其具有更自然的外观。
Realtime ShadowsThese properties are available when Shadow Type is set to Hard Shadows or Soft Shadows. Use these properties to control real-time shadow rendering settings.
实时阴影当阴影类型设置为硬阴影或软阴影时,可以使用这些属性。使用这些属性来控制实时阴影渲染设置。
-StrengthUse the slider to control how dark the shadows cast by this Light are, represented by a value between 0 and 1. This is set to 1 by default.
-强度使用滑块来控制由这盏灯投射的阴影有多暗,由0到1之间的值表示。默认设置为1。
-ResolutionControl the rendered resolution of shadow maps. A higher resolution increases the fidelity of shadows, but requires more GPU time and memory usage.
-分辨率控制阴影贴图的渲染分辨率。更高的分辨率可以增加阴影的保真度,但是需要更多的GPU时间和内存使用。
-BiasUse the slider to control the distance at which shadows are pushed away from the light, defined as a value between 0 and 2. This is useful for avoiding false self-shadowing artifacts. See Shadow mapping and the bias property for more information. This is set to 0.05 by default.
-偏差使用滑块来控制阴影远离光线的距离,定义为0到2之间的值。这对于避免错误的人为自阴影很有用。有关更多信息,请参阅阴影映射和偏见属性。默认设置为0.05。
Normal BiasUse the slider to control distance at which the shadow casting surfaces are shrunk along the surface normal, defined as a value between 0 and 3. This is useful for avoiding false self-shadowing artifacts. See documentation on Shadow mapping and the bias property for more information. This is set to 0.4 by default.
法线偏差使用滑块控制阴影投射面沿表面法线收缩的距离,定义为0到3之间的值。这对于避免错误的人为自阴影很有用。有关阴影映射和偏差属性的更多信息,请参阅文档。默认设置为0.4。
Near PlaneUse the slider to control the value for the near clip plane when rendering shadows, defined as a value between 0.1 and 10. This value is clamped to 0.1 units or 1% of the light’s Range property, whichever is lower. This is set to 0.2 by default.
近平面当渲染阴影时,使用滑块来控制近剪切平面的值,定义为0.1到10之间的值。最小值在0.1个单位或光照范围属性的1%选取,以较低的为准。默认设置为0.2。
CookieSpecify a Texture mask through which shadows are cast (for example, to create silhouettes, or patterned illumination for the Light).
剪影指定一个纹理遮罩,通过它投射阴影(例如,创建剪影,或为光创建有图案的光照)。
Draw HaloTick this box to draw a spherical Halo of light with a diameter equal to the Range value. You can also use the Halo component to achieve this. Note that the Halo component is drawn in addition to the halo from the Light component, and that the Halo component’s Size parameter determines its radius, not its diameter.
绘制光晕勾选可绘制直径等于范围值的球形光晕。您还可以使用Halo组件来实现这一点。请注意,光晕组件是在光组件的光晕之外绘制的,光晕组件的大小参数决定了它的半径,而不是直径。
FlareIf you want to set a Flare to be rendered at the Light’s position, place an Asset in this field to be used as its source.
镜头眩光如果你想设置一个眩光被渲染在灯光的位置,放置一个相应资产在这个属性上被用作它的来源。
Render ModeUse this drop-down to set the rendering priority of the selected Light. This can affect lighting fidelity and performance (see Performance Considerations, below).
渲染模式使用此下拉列表设置所选光的渲染优先级。这可能会影响光照精度和性能(请参阅下面的性能注意事项)。
-AutoThe rendering method is determined at run time, depending on the brightness of nearby lights and the current Quality settings.
自动渲染方法在运行时确定,取决于附近灯光的亮度和当前的质量设置。
ImportantThe light is always rendered at per-pixel quality. Use Important mode only for the most noticeable visual effects (for example, the headlights of a player’s car).
重要光线总是以每像素的质量渲染。只对最明显的视觉效果使用重要模式(例如,玩家的汽车前灯)。
Not ImportantThe light is always rendered in a faster, vertex/object light mode.
不重要渲染速度更快,顶点/对象 光照模式
Culling MaskUse this to selectively exclude groups of objects from being affected by the Light. For more information, see Layers.
剔除遮罩用这个来选择性地排除一组物体不受光照的影响。有关更多信息,请参见层。

Details 细节

If you create a Texture that contains an alpha channel and assign it to the Cookie variable of the light, the cookie is projected from the light. The cookie’s alpha mask modulates the light’s brightness, creating light and dark spots on surfaces. This is a great way to add complexity or atmosphere to a scene.
如果你创建一个包含alpha通道的纹理,并将其赋值给光线的剪影(Cookie)变量,那么光线就会投射出Cookie。Cookie的alpha蒙版可以调节光线的亮度,在表面上产生光斑和暗斑。这是为场景增加复杂性或气氛的好方法。

All built-in shaders in Unity seamlessly work with any type of light. However, VertexLit shaders cannot display Cookies or Shadows.
Unity中所有内置的着色器都可以无缝地与任何类型的光一起工作。然而,VertexLit着色器不能显示cookie或阴影。

All Lights can optionally cast Shadows. To do this, set the Shadow Type property of each individual Light to either Hard Shadows or Soft Shadows. See documentation on Shadows for more information.
所有的灯光都可以选择投射阴影。为此,将每个单独光源的阴影类型属性设置为硬阴影或软阴影。有关阴影的更多信息,请参见文档。

Directional Light Shadows 平行光阴影

See documentation on directional light shadows for an in-depth explanation of how they work. Note that shadows are disabled for directional lights with cookies when forward rendering is used. It is possible to write custom shaders to enable shadows in this case; see documentation on writing surface shaders for further details.
有关平行光阴影的详细说明,请参阅文档。请注意,当使用正向渲染时,平行光使用cookie时,阴影是禁用的。在这种情况下,可以编写自定义着色器来启用阴影;有关编写表面着色器的详细信息,请参阅文档。(测试发现平行光还是保持阴影的,聚光灯无阴影,点光源无法使用cookie)

Hints 提示

  • Spot lights with cookies can be extremely effective for creating the effect of light coming in from a window. 带有cookie的聚光灯可以非常有效地产生来自窗口的光线效果。
  • Low-intensity point lights are good for providing depth to a Scene. 低强度的点灯有利于为场景提供深度感。
  • For maximum performance, use a VertexLit shader. This shader only does per-vertex lighting, giving a much higher throughput on low-end cards. 要获得最佳性能,请使用VertexLit着色器。这个着色器只对每个顶点进行光照,在低端卡片上提供更高的吞吐量。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值